improvements

This commit is contained in:
Rene
2021-02-14 22:57:28 +01:00
parent 2f6468a6b3
commit af99cfa97c
30 changed files with 375 additions and 18 deletions
+4 -4
View File
@@ -1450,7 +1450,7 @@ const createStructureSetup = (target) => {
}
let { _target, _padding, _viewport, _content } = osTargetObj;
let destroyFns = [];
const destroyFns = [];
const isTextarea = is(_target, 'textarea');
const isBody = !isTextarea && is(_target, 'body');
@@ -1458,9 +1458,6 @@ const createStructureSetup = (target) => {
const getTargetContents = (contentSlot) => (isTextarea ? _target : contents(contentSlot));
const ownerDocument = _target.ownerDocument;
const bodyElm = ownerDocument.body;
const wnd = ownerDocument.defaultView;
const isTextareaHostGenerated = isTextarea && _host !== osTargetObj._host;
if (isTextareaHostGenerated) {
@@ -1517,6 +1514,9 @@ const createStructureSetup = (target) => {
addClass(_padding, classNamePadding);
addClass(_viewport, classNameViewport);
addClass(_content, classNameContent);
const ownerDocument = _target.ownerDocument;
const bodyElm = ownerDocument.body;
const wnd = ownerDocument.defaultView;
const ctx = {
_windowElm: wnd,
_documentElm: ownerDocument,
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+3 -3
View File
@@ -1619,9 +1619,6 @@
return isTextarea ? _target : contents(contentSlot);
};
var ownerDocument = _target.ownerDocument;
var bodyElm = ownerDocument.body;
var wnd = ownerDocument.defaultView;
var isTextareaHostGenerated = isTextarea && _host !== osTargetObj._host;
if (isTextareaHostGenerated) {
@@ -1678,6 +1675,9 @@
addClass(_padding, classNamePadding);
addClass(_viewport, classNameViewport);
addClass(_content, classNameContent);
var ownerDocument = _target.ownerDocument;
var bodyElm = ownerDocument.body;
var wnd = ownerDocument.defaultView;
var ctx = {
_windowElm: wnd,
_documentElm: ownerDocument,
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -67,15 +67,11 @@ export const createStructureSetup = (target: OSTarget | OSTargetObject): Structu
}
let { _target, _padding, _viewport, _content } = osTargetObj;
let destroyFns: (() => any)[] = [];
const destroyFns: (() => any)[] = [];
const isTextarea = is(_target, 'textarea');
const isBody = !isTextarea && is(_target, 'body');
const _host = (isTextarea ? osTargetObj._host || createDiv() : _target) as HTMLElement;
const getTargetContents = (contentSlot: HTMLElement) => (isTextarea ? (_target as HTMLTextAreaElement) : contents(contentSlot as HTMLElement));
const ownerDocument: HTMLDocument = _target.ownerDocument;
const bodyElm = ownerDocument.body as HTMLBodyElement;
const wnd = ownerDocument.defaultView as Window;
const isTextareaHostGenerated = isTextarea && _host !== osTargetObj._host;
// only insert host for textarea after target if it was generated
@@ -137,6 +133,9 @@ export const createStructureSetup = (target: OSTarget | OSTargetObject): Structu
addClass(_viewport, classNameViewport);
addClass(_content, classNameContent);
const ownerDocument: HTMLDocument = _target.ownerDocument;
const bodyElm = ownerDocument.body as HTMLBodyElement;
const wnd = ownerDocument.defaultView as Window;
const ctx: OSTargetContext = {
_windowElm: wnd,
_documentElm: ownerDocument,
+10
View File
@@ -6,6 +6,16 @@ export type InternalVersionOf<T> = {
export type OSTargetElement = HTMLElement | HTMLTextAreaElement;
/**
* Object for special initialization.
*
* Target is always required, if element is not provided or undefined it will be generated.
*
* If element is provided, the provided element takes all its responsibilities.
* DOM hierarchy isn't checked in this case, its assumed that hieararchy is correct in such a case.
*
* If element is null it won't be generated, and the responsibilities (feautes) of this element are lost.
*/
export interface OSTargetObject {
target: OSTargetElement;
host?: HTMLElement;
+17
View File
@@ -1,4 +1,21 @@
/**
* Adds the given OverlayScrollbars instance to the given element.
* @param target The element which is the target of the OverlayScrollbars instance.
* @param osInstance The OverlayScrollbars instance.
*/
export declare const addInstance: (target: Element, osInstance: any) => void;
/**
* Removes a OverlayScrollbars instance from the given element.
* @param target The element from which its OverlayScrollbars instance shall be removed.
*/
export declare const removeInstance: (target: Element) => void;
/**
* 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.
*/
export declare const getInstance: (target: Element) => any;
/**
* Gets a Map which represents all active OverayScrollbars instances.
* The Key is the ekement and the value is the instance.
*/
export declare const allInstances: () => ReadonlyMap<Element, any>;
@@ -15,4 +15,10 @@ export interface LifecycleOptionInfo<T> {
_changed: boolean;
}
export declare type LifecycleCheckOption = <T>(path: string) => LifecycleOptionInfo<T>;
/**
* Creates a object which can be seen as the base of a lifecycle because it provides all the tools to manage a lifecycle and its options, cache and base functions.
* @param defaultOptionsWithTemplate A object which describes the options and the default options of the lifecycle.
* @param initialOptions The initialOptions for the lifecylce. (Can be undefined)
* @param updateFunction The update function where cache and options updates are handled. Has two arguments which are the changedOptions and the changedCache objects.
*/
export declare const createLifecycleBase: <O>(defaultOptionsWithTemplate: OptionsWithOptionsTemplate<Required<O>>, initialOptions: O | undefined, updateFunction: (force: boolean, checkOption: LifecycleCheckOption) => any) => LifecycleBase<O>;
@@ -6,6 +6,20 @@ export declare const jsCache: {
export declare const cssCache: {
[key: string]: string;
};
/**
* Gets the name of the given CSS property with vendor prefix if it isn't supported without, or undefined if unsupported.
* @param name The name of the CSS property which shall be get.
*/
export declare const cssProperty: (name: string) => string | undefined;
/**
* Get the name of the given CSS property value(s), with vendor prefix if it isn't supported wuthout, or undefined if no value is supported.
* @param property The CSS property to which the CSS property value(s) belong.
* @param values The value(s) separated by spaces which shall be get.
* @param suffix A suffix which is added to each value in case the value is a function or something else more advanced.
*/
export declare const cssPropertyValue: (property: string, values: string, suffix?: string | undefined) => string | undefined;
/**
* Get the requested JS function, object or constructor with vendor prefix if it isn't supported without or undefined if unsupported.
* @param name The name of the JS function, object or constructor.
*/
export declare const jsAPI: <T = any>(name: string) => T | undefined;
@@ -1,9 +1,36 @@
/**
* Gets or sets a attribute with the given attribute of the given element depending whether the value attribute is given.
* Returns null if the element has no attribute with the given name.
* @param elm The element of which the attribute shall be get or set.
* @param attrName The attribute name which shall be get or set.
* @param value The value of the attribute which shall be set.
*/
export declare function attr(elm: HTMLElement | null, attrName: string): string | null;
export declare function attr(elm: HTMLElement | null, attrName: string, value: string): void;
/**
* Removes the given attribute from the given element.
* @param elm The element of which the attribute shall be removed.
* @param attrName The attribute name.
*/
export declare const removeAttr: (elm: Element | null, attrName: string) => void;
/**
* Gets or sets the scrollLeft value of the given element depending whether the value attribute is given.
* @param elm The element of which the scrollLeft value shall be get or set.
* @param value The scrollLeft value which shall be set.
*/
export declare function scrollLeft(elm: HTMLElement | null): number;
export declare function scrollLeft(elm: HTMLElement | null, value: number): void;
/**
* Gets or sets the scrollTop value of the given element depending whether the value attribute is given.
* @param elm The element of which the scrollTop value shall be get or set.
* @param value The scrollTop value which shall be set.
*/
export declare function scrollTop(elm: HTMLElement | null): number;
export declare function scrollTop(elm: HTMLElement | null, value: number): void;
/**
* Gets or sets the value of the given input element depending whether the value attribute is given.
* @param elm The input element of which the value shall be get or set.
* @param value The value which shall be set.
*/
export declare function val(elm: HTMLInputElement | null): string;
export declare function val(elm: HTMLInputElement | null, value: string): void;
+20
View File
@@ -1,4 +1,24 @@
/**
* Check whether the given element has the given class name(s).
* @param elm The element.
* @param className The class name(s).
*/
export declare const hasClass: (elm: Element | null | undefined, className: string) => boolean;
/**
* Adds the given class name(s) to the given element.
* @param elm The element.
* @param className The class name(s) which shall be added. (separated by spaces)
*/
export declare const addClass: (elm: Element | null | undefined, className: string) => void;
/**
* Removes the given class name(s) from the given element.
* @param elm The element.
* @param className The class name(s) which shall be removed. (separated by spaces)
*/
export declare const removeClass: (elm: Element | null | undefined, className: string) => void;
/**
* Takes two className strings, compares them and returns the difference as array.
* @param classNameA ClassName A.
* @param classNameB ClassName B.
*/
export declare const diffClass: (classNameA: string | null | undefined, classNameB: string | null | undefined) => string[];
@@ -1,2 +1,9 @@
/**
* Creates a div DOM node.
*/
export declare const createDiv: (classNames?: string | undefined) => HTMLDivElement;
/**
* Creates DOM nodes modeled after the passed html string and returns the root dom nodes as a array.
* @param html The html string after which the DOM nodes shall be created.
*/
export declare const createDOM: (html: string) => ReadonlyArray<Node>;
@@ -2,9 +2,32 @@ export interface WH<T = number> {
w: T;
h: T;
}
/**
* Returns the window inner- width and height.
*/
export declare const windowSize: () => WH;
/**
* Returns the scroll- width and height of the passed element. If the element is null the width and height values are 0.
* @param elm The element of which the scroll- width and height shall be returned.
*/
export declare const offsetSize: (elm: HTMLElement | null | undefined) => WH;
/**
* Returns the client- width and height of the passed element. If the element is null the width and height values are 0.
* @param elm The element of which the client- width and height shall be returned.
*/
export declare const clientSize: (elm: HTMLElement | null | undefined) => WH;
/**
* Returns the client- width and height of the passed element. If the element is null the width and height values are 0.
* @param elm The element of which the client- width and height shall be returned.
*/
export declare const scrollSize: (elm: HTMLElement | null | undefined) => WH;
/**
* Returns the BoundingClientRect of the passed element.
* @param elm The element of which the BoundingClientRect shall be returned.
*/
export declare const getBoundingClientRect: (elm: HTMLElement) => DOMRect;
/**
* Determines whether the passed element has any dimensions.
* @param elm The element.
*/
export declare const hasDimensions: (elm: HTMLElement | null | undefined) => boolean;
@@ -3,7 +3,29 @@ export interface OnOptions {
_passive?: boolean;
_once?: boolean;
}
/**
* Removes the passed event listener for the passed events with the passed options.
* @param target The element from which the listener shall be removed.
* @param eventNames The eventsnames for which the listener shall be removed.
* @param listener The listener which shall be removed.
* @param capture The options of the removed listener.
*/
export declare const off: (target: EventTarget, eventNames: string, listener: EventListener, capture?: boolean | undefined) => void;
/**
* Adds the passed event listener for the passed eventnames with the passed options.
* @param target The element to which the listener shall be added.
* @param eventNames The eventsnames for which the listener shall be called.
* @param listener The listener which is called on the eventnames.
* @param options The options of the added listener.
*/
export declare const on: (target: EventTarget, eventNames: string, listener: EventListener, options?: OnOptions | undefined) => (() => void);
/**
* Shorthand for the stopPropagation event Method.
* @param evt The event of which the stopPropagation method shall be called.
*/
export declare const stopPropagation: (evt: Event) => void;
/**
* Shorthand for the preventDefault event Method.
* @param evt The event of which the preventDefault method shall be called.
*/
export declare const preventDefault: (evt: Event) => void;
@@ -1,7 +1,31 @@
declare type NodeCollection = ArrayLike<Node> | Node | null | undefined;
/**
* Appends the given children at the end of the given Node.
* @param node The Node to which the children shall be appended.
* @param children The Nodes which shall be appended.
*/
export declare const appendChildren: (node: Node | null | undefined, children: NodeCollection) => void;
/**
* Prepends the given children at the start of the given Node.
* @param node The Node to which the children shall be prepended.
* @param children The Nodes which shall be prepended.
*/
export declare const prependChildren: (node: Node | null | undefined, children: NodeCollection) => void;
/**
* Inserts the given Nodes before the given Node.
* @param node The Node before which the given Nodes shall be inserted.
* @param insertedNodes The Nodes which shall be inserted.
*/
export declare const insertBefore: (node: Node | null | undefined, insertedNodes: NodeCollection) => void;
/**
* Inserts the given Nodes after the given Node.
* @param node The Node after which the given Nodes shall be inserted.
* @param insertedNodes The Nodes which shall be inserted.
*/
export declare const insertAfter: (node: Node | null | undefined, insertedNodes: NodeCollection) => void;
/**
* Removes the given Nodes from their parent.
* @param nodes The Nodes which shall be removed.
*/
export declare const removeElements: (nodes: NodeCollection) => void;
export {};
@@ -2,5 +2,13 @@ export interface XY<T = number> {
x: T;
y: T;
}
/**
* Returns the offset- left and top coordinates of the passed element relative to the document. If the element is null the top and left values are 0.
* @param elm The element of which the offset- top and left coordinates shall be returned.
*/
export declare const absoluteCoordinates: (elm: HTMLElement | null | undefined) => XY;
/**
* Returns the offset- left and top coordinates of the passed element. If the element is null the top and left values are 0.
* @param elm The element of which the offset- top and left coordinates shall be returned.
*/
export declare const offsetCoordinates: (elm: HTMLElement | null | undefined) => XY;
+18
View File
@@ -7,12 +7,30 @@ export interface TRBL {
declare type CssStyles = {
[key: string]: string | number;
};
/**
* Gets or sets the passed styles to the passed element.
* @param elm The element to which the styles shall be applied to / be read from.
* @param styles The styles which shall be set or read.
*/
export declare function style(elm: HTMLElement | null | undefined, styles: CssStyles): void;
export declare function style(elm: HTMLElement | null | undefined, styles: string): string;
export declare function style(elm: HTMLElement | null | undefined, styles: Array<string> | string): {
[key: string]: string;
};
/**
* Hides the passed element (display: none).
* @param elm The element which shall be hidden.
*/
export declare const hide: (elm: HTMLElement | null) => void;
/**
* Shows the passed element (display: block).
* @param elm The element which shall be shown.
*/
export declare const show: (elm: HTMLElement | null | undefined) => void;
/**
* Returns a top
* @param elm
* @param property
*/
export declare const topRightBottomLeft: (elm: HTMLElement | null | undefined, property?: string | undefined) => TRBL;
export {};
@@ -1,10 +1,44 @@
declare type InputElementType = Element | Node | null | undefined;
declare type OutputElementType = Element | null;
/**
* Find all elements with the passed selector, outgoing (and including) the passed element or the document if no element was provided.
* @param selector The selector which has to be searched by.
* @param elm The element from which the search shall be outgoing.
*/
declare const find: (selector: string, elm?: InputElementType) => Element[];
/**
* Find the first element with the passed selector, outgoing (and including) the passed element or the document if no element was provided.
* @param selector The selector which has to be searched by.
* @param elm The element from which the search shall be outgoing.
*/
declare const findFirst: (selector: string, elm?: InputElementType) => OutputElementType;
/**
* Determines whether the passed element is matching with the passed selector.
* @param elm The element which has to be compared with the passed selector.
* @param selector The selector which has to be compared with the passed element. Additional selectors: ':visible' and ':hidden'.
*/
declare const is: (elm: InputElementType, selector: string) => boolean;
/**
* Returns the children (no text-nodes or comments) of the passed element which are matching the passed selector. An empty array is returned if the passed element is null.
* @param elm The element of which the children shall be returned.
* @param selector The selector which must match with the children elements.
*/
declare const children: (elm: InputElementType, selector?: string | undefined) => ReadonlyArray<Element>;
/**
* Returns the childNodes (incl. text-nodes or comments etc.) of the passed element. An empty array is returned if the passed element is null.
* @param elm The element of which the childNodes shall be returned.
*/
declare const contents: (elm: InputElementType) => ReadonlyArray<ChildNode>;
/**
* Returns the parent element of the passed element, or null if the passed element is null.
* @param elm The element of which the parent element shall be returned.
*/
declare const parent: (elm: InputElementType) => OutputElementType;
/**
* Determines whether the given element lies between two selectors in the DOM.
* @param elm The element.
* @param highBoundarySelector The high boundary selector.
* @param deepBoundarySelector The deep boundary selector.
*/
declare const liesBetween: (elm: InputElementType, highBoundarySelector: string, deepBoundarySelector: string) => boolean;
export { find, findFirst, is, children, contents, parent, liesBetween };
@@ -3,4 +3,9 @@ export interface OptionsWithOptionsTemplateTransformation<T extends Required<T>>
_template: OptionsTemplate<T>;
_options: T;
}
/**
* Transforms the given OptionsWithOptionsTemplate<T> object to its corresponding generic (T) Object or its corresponding Template object.
* @param optionsWithOptionsTemplate The OptionsWithOptionsTemplate<T> object which shall be converted.
* @param toTemplate True if the given OptionsWithOptionsTemplate<T> shall be converted to its corresponding Template object.
*/
export declare function transformOptions<T extends Required<T>>(optionsWithOptionsTemplate: OptionsWithOptionsTemplate<T>): OptionsWithOptionsTemplateTransformation<T>;
@@ -1,6 +1,28 @@
import { OptionsTemplate, OptionsTemplateType, Func, OptionsValidationResult } from 'support/options';
import { PlainObject } from 'typings';
/**
* A object which serves as a mapping for "normal" types and template types.
* Key = normal type string
* value = template type string
*/
declare const optionsTemplateTypes: OptionsTemplateTypesDictionary;
/**
* Validates the given options object according to the given template object and returns a object which looks like:
* {
* foreign : a object which consists of properties which aren't defined inside the template. (foreign properties)
* validated : a object which consists only of valid properties. (property name is inside the template and value has a correct type)
* }
* @param options The options object which shall be validated.
* @param template The template according to which the options object shall be validated.
* @param optionsDiff When provided the returned validated object will only have properties which are different to this objects properties.
* Example (assume all properties are valid to the template):
* Options object : { a: 'a', b: 'b', c: 'c' }
* optionsDiff object : { a: 'a', b: 'b', c: undefined }
* Returned validated object : { c: 'c' }
* Because the value of the properties a and b didn't change, they aren't included in the returned object.
* Without the optionsDiff object the returned validated object would be: { a: 'a', b: 'b', c: 'c' }
* @param doWriteErrors True if errors shall be logged into the console, false otherwise.
*/
declare const validateOptions: <T extends PlainObject<any>>(options: T, template: OptionsTemplate<Required<T>>, optionsDiff?: T | null | undefined, doWriteErrors?: boolean | undefined) => OptionsValidationResult<T>;
export { validateOptions, optionsTemplateTypes };
declare type OptionsTemplateTypesDictionary = {
@@ -1,14 +1,45 @@
import { PlainObject } from 'typings';
declare type RunEachItem = ((...args: any) => any | any[]) | null | undefined;
/**
* Iterates through a array or object
* @param arrayLikeOrObject The array or object through which shall be iterated.
* @param callback The function which is responsible for the iteration.
* If the function returns true its treated like a "continue" statement.
* If the function returns false its treated like a "break" statement.
*/
export declare function each<T>(array: Array<T> | ReadonlyArray<T>, callback: (value: T, indexOrKey: number, source: Array<T>) => boolean | void): Array<T> | ReadonlyArray<T>;
export declare function each<T>(array: Array<T> | ReadonlyArray<T> | null | undefined, callback: (value: T, indexOrKey: number, source: Array<T>) => boolean | void): Array<T> | ReadonlyArray<T> | null | undefined;
export declare function each<T>(arrayLikeObject: ArrayLike<T>, callback: (value: T, indexOrKey: number, source: ArrayLike<T>) => boolean | void): ArrayLike<T>;
export declare function each<T>(arrayLikeObject: ArrayLike<T> | null | undefined, callback: (value: T, indexOrKey: number, source: ArrayLike<T>) => boolean | void): ArrayLike<T> | null | undefined;
export declare function each(obj: PlainObject, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject;
export declare function each(obj: PlainObject | null | undefined, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject | null | undefined;
/**
* Returns the index of the given inside the given array or -1 if the given item isn't part of the given array.
* @param arr The array.
* @param item The item.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
*/
export declare const indexOf: <T = any>(arr: T[], item: T, fromIndex?: number | undefined) => number;
/**
* Pushesh all given items into the given array and returns it.
* @param array The array the items shall be pushed into.
* @param items The items which shall be pushed into the array.
*/
export declare const push: <T>(array: T[], items: T | ArrayLike<T>, arrayIsSingleItem?: boolean | undefined) => T[];
/**
* Creates a shallow-copied Array instance from an array-like or iterable object.
* @param arr The object from which the array instance shall be created.
*/
export declare const from: <T = any>(arr: ArrayLike<T>) => T[];
/**
* Check whether the passed array is empty.
* @param array The array which shall be checked.
*/
export declare const isEmptyArray: (array: Array<any> | null | undefined) => boolean | null | undefined;
/**
* Calls all functions in the passed array/set of functions.
* @param arr The array filled with function which shall be called.
* @param p1 The first param.
*/
export declare const runEach: (arr: ArrayLike<RunEachItem> | Set<RunEachItem>, p1?: unknown) => void;
export {};
@@ -1,6 +1,30 @@
import { WH, XY, TRBL } from 'support/dom';
import { PlainObject } from 'typings';
/**
* Compares two objects and returns true if all values of the passed prop names are identical, false otherwise or if one of the two object is falsy.
* @param a Object a.
* @param b Object b.
* @param props The props which shall be compared.
*/
export declare const equal: <T extends PlainObject<any>>(a: T | undefined, b: T | undefined, props: (keyof T)[]) => boolean;
/**
* Compares object a with object b and returns true if both have the same property values, false otherwise.
* Also returns false if one of the objects is undefined or null.
* @param a Object a.
* @param b Object b.
*/
export declare const equalWH: (a?: WH<number> | undefined, b?: WH<number> | undefined) => boolean;
/**
* Compares object a with object b and returns true if both have the same property values, false otherwise.
* Also returns false if one of the objects is undefined or null.
* @param a Object a.
* @param b Object b.
*/
export declare const equalXY: (a?: XY<number> | undefined, b?: XY<number> | undefined) => boolean;
/**
* Compares object a with object b and returns true if both have the same property values, false otherwise.
* Also returns false if one of the objects is undefined or null.
* @param a Object a.
* @param b Object b.
*/
export declare const equalTRBL: (a?: TRBL | undefined, b?: TRBL | undefined) => boolean;
@@ -1,2 +1,8 @@
export declare const noop: () => void;
/**
* Debounces the given function either with a timeout or a animation frame.
* @param functionToDebounce The function which shall be debounced.
* @param timeout The timeout for debouncing. If 0 or lower animation frame is used for debouncing, a timeout otherwise.
* @param maxWait A maximum amount of ms. before the function will be called even with debounce.
*/
export declare const debounce: (functionToDebounce: (...args: any) => any, timeout?: number | undefined, maxWait?: number | undefined) => () => void;
@@ -1,8 +1,21 @@
/**
* Determines whether the passed object has a property with the passed name.
* @param obj The object.
* @param prop The name of the property.
*/
export declare const hasOwnProperty: (obj: any, prop: string | number | symbol) => boolean;
/**
* Returns the names of the enumerable string properties and methods of an object.
* @param obj The object of which the properties shall be returned.
*/
export declare const keys: (obj: any) => Array<string>;
export declare function assignDeep<T, U>(target: T, object1: U): T & U;
export declare function assignDeep<T, U, V>(target: T, object1: U, object2: V): T & U & V;
export declare function assignDeep<T, U, V, W>(target: T, object1: U, object2: V, object3: W): T & U & V & W;
export declare function assignDeep<T, U, V, W, X>(target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X;
export declare function assignDeep<T, U, V, W, X, Y>(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y;
/**
* Returns true if the given object is empty, false otherwise.
* @param obj The Object.
*/
export declare function isEmptyObject(obj: any): boolean;
@@ -8,7 +8,23 @@ export declare function isBoolean(obj: any): obj is boolean;
export declare function isFunction(obj: any): obj is (...args: Array<unknown>) => unknown;
export declare function isArray(obj: any): obj is Array<any>;
export declare function isObject(obj: any): boolean;
/**
* Returns true if the given object is array like, false otherwise.
* @param obj The Object
*/
export declare function isArrayLike<T extends PlainObject = any>(obj: any): obj is ArrayLike<T>;
/**
* Returns true if the given object is a "plain" (e.g. { key: value }) object, false otherwise.
* @param obj The Object.
*/
export declare function isPlainObject<T = any>(obj: any): obj is PlainObject<T>;
/**
* Checks whether the given object is a HTMLElement.
* @param obj The object which shall be checked.
*/
export declare function isHTMLElement(obj: any): obj is HTMLElement;
/**
* Checks whether the given object is a Element.
* @param obj The object which shall be checked.
*/
export declare function isElement(obj: any): obj is Element;
+10
View File
@@ -5,6 +5,16 @@ export declare type InternalVersionOf<T> = {
[K in keyof T as `_${Uncapitalize<string & K>}`]: T[K];
};
export declare type OSTargetElement = HTMLElement | HTMLTextAreaElement;
/**
* Object for special initialization.
*
* Target is always required, if element is not provided or undefined it will be generated.
*
* If element is provided, the provided element takes all its responsibilities.
* DOM hierarchy isn't checked in this case, its assumed that hieararchy is correct in such a case.
*
* If element is null it won't be generated, and the responsibilities (feautes) of this element are lost.
*/
export interface OSTargetObject {
target: OSTargetElement;
host?: HTMLElement;
+2 -1
View File
@@ -228,6 +228,7 @@ const rollupConfig = (config = {}, { project = process.cwd(), overwrite = {}, si
...(esm ? esmBabelConfig : legacyBabelConfig),
babelHelpers: 'runtime',
extensions: resolve.extensions,
shouldPrintComment: () => false,
caller: {
name: 'babel-rollup-build',
},
@@ -259,7 +260,7 @@ const rollupConfig = (config = {}, { project = process.cwd(), overwrite = {}, si
}),
],
}
: []
: {}
),
external: [...Object.keys(devDependencies), ...Object.keys(peerDependencies), ...((Array.isArray(external) && external) || [])],
plugins: pipeline.reduce((arr, item) => {
+1 -1
View File
@@ -11,7 +11,7 @@
"suppressImplicitAnyIndexErrors": true,
"module": "ESNext",
"moduleResolution": "node",
"removeComments": true
"removeComments": false
},
"exclude": ["node_modules", "**/node_modules/*"]
}