update rollup dependencies and rebuild

This commit is contained in:
Rene
2021-01-09 02:35:06 +01:00
parent 2f80cac9e5
commit 388b0152b4
22 changed files with 289 additions and 172 deletions
+3 -3
View File
@@ -8,11 +8,11 @@
"@babel/plugin-transform-runtime": "^7.11.0",
"@babel/preset-env": "^7.11.0",
"@babel/preset-typescript": "^7.10.4",
"@rollup/plugin-babel": "^5.1.0",
"@rollup/plugin-commonjs": "^14.0.0",
"@rollup/plugin-babel": "^5.2.2",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-html": "^0.2.0",
"@rollup/plugin-inject": "^4.0.2",
"@rollup/plugin-node-resolve": "^8.4.0",
"@rollup/plugin-node-resolve": "^11.0.1",
"@rollup/plugin-typescript": "^5.0.2",
"@testing-library/dom": "^7.26.3",
"@types/expect-puppeteer": "^4.4.3",
+78 -58
View File
@@ -130,24 +130,27 @@ const from = (arr) => {
});
return result;
};
const runEach = (arr) => {
const runEach = (arr, p1) => {
if (arr instanceof Set) {
arr.forEach((fn) => fn && fn());
arr.forEach((fn) => fn && fn(p1));
} else {
each(arr, (fn) => fn && fn());
each(arr, (fn) => fn && fn(p1));
}
};
const matches = (elm, selector) => {
const elmPrototype = Element.prototype;
const is = (elm, selector) => {
if (elm) {
const fn = Element.prototype.matches || Element.prototype.msMatchesSelector;
const fn = elmPrototype.matches || elmPrototype.msMatchesSelector;
return fn.call(elm, selector);
}
return false;
};
const is = (elm, selector) => matches(elm, selector);
const contents = (elm) => (elm ? from(elm.childNodes) : []);
const parent = (elm) => (elm ? elm.parentElement : null);
const before = (parentElm, preferredAnchor, insertedElms) => {
@@ -237,6 +240,13 @@ const clientSize = (elm) =>
h: elm.clientHeight,
}
: zeroObj;
const scrollSize = (elm) =>
elm
? {
w: elm.scrollWidth,
h: elm.scrollHeight,
}
: zeroObj;
const getBoundingClientRect = (elm) => elm.getBoundingClientRect();
let passiveEventsSupport;
@@ -307,6 +317,7 @@ const equal = (a, b, props) => {
return false;
};
const equalWH = (a, b) => equal(a, b, ['w', 'h']);
const equalXY = (a, b) => equal(a, b, ['x', 'y']);
const equalTRBL = (a, b) => equal(a, b, ['t', 'r', 'b', 'l']);
const hasOwnProperty = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
@@ -438,13 +449,13 @@ const createCache = (update, options) => {
let _previous;
return (force, context) => {
const prev = _value;
const curr = _value;
const newVal = update(context, _value, _previous);
const changed = force || (_equal ? !_equal(prev, newVal) : prev !== newVal);
const changed = force || (_equal ? !_equal(curr, newVal) : curr !== newVal);
if (changed) {
_value = newVal;
_previous = prev;
_previous = curr;
}
return {
@@ -496,24 +507,15 @@ const jsAPI = (name) => {
return result;
};
const resizeObserver = jsAPI('ResizeObserver');
const MutationObserverConstructor = jsAPI('MutationObserver');
const IntersectionObserverConstructor = jsAPI('IntersectionObserver');
const ResizeObserverConstructor = jsAPI('ResizeObserver');
const cAF = jsAPI('cancelAnimationFrame');
const rAF = jsAPI('requestAnimationFrame');
function createCommonjsModule(fn, basedir, module) {
return (
(module = {
path: basedir,
exports: {},
require: function (path, base) {
return commonjsRequire(path, base === undefined || base === null ? module.path : base);
},
}),
fn(module, module.exports),
module.exports
);
}
function commonjsRequire() {
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
function createCommonjsModule(fn) {
var module = { exports: {} };
return fn(module, module.exports), module.exports;
}
var _extends_1 = createCommonjsModule(function (module) {
@@ -644,11 +646,24 @@ function transformOptions(optionsWithOptionsTemplate) {
return result;
}
const classNameEnvironment = 'os-environment';
const classNameEnvironmentFlexboxGlue = `${classNameEnvironment}-flexbox-glue`;
const classNameEnvironmentFlexboxGlueMax = `${classNameEnvironmentFlexboxGlue}-max`;
const classNameHost = 'os-host';
const classNamePadding = 'os-padding';
const classNameViewport = 'os-viewport';
const classNameContent = 'os-content';
const classNameViewportScrollbarStyling = `${classNameViewport}-scrollbar-styled`;
const classNameSizeObserver = 'os-size-observer';
const classNameSizeObserverAppear = `${classNameSizeObserver}-appear`;
const classNameSizeObserverListener = `${classNameSizeObserver}-listener`;
const classNameSizeObserverListenerScroll = `${classNameSizeObserverListener}-scroll`;
const classNameSizeObserverListenerItem = `${classNameSizeObserverListener}-item`;
const classNameSizeObserverListenerItemFinal = `${classNameSizeObserverListenerItem}-final`;
const classNameTrinsicObserver = 'os-trinsic-observer';
let environmentInstance;
const { abs, round } = Math;
const environmentElmId = 'os-environment';
const classNameFlexboxGlue = 'flexbox-glue';
const classNameFlexboxGlueMax = `${classNameFlexboxGlue}-max`;
const getNativeScrollbarSize = (body, measureElm) => {
appendChildren(body, measureElm);
@@ -662,7 +677,7 @@ const getNativeScrollbarSize = (body, measureElm) => {
const getNativeScrollbarStyling = (testElm) => {
let result = false;
addClass(testElm, 'os-viewport-scrollbar-styled');
addClass(testElm, classNameViewportScrollbarStyling);
try {
result =
@@ -691,11 +706,11 @@ const getRtlScrollBehavior = (parentElm, childElm) => {
};
const getFlexboxGlue = (parentElm, childElm) => {
addClass(parentElm, classNameFlexboxGlue);
addClass(parentElm, classNameEnvironmentFlexboxGlue);
const minOffsetsizeParent = offsetSize(parentElm);
const minOffsetsize = offsetSize(childElm);
const supportsMin = equalWH(minOffsetsize, minOffsetsizeParent);
addClass(parentElm, classNameFlexboxGlueMax);
addClass(parentElm, classNameEnvironmentFlexboxGlueMax);
const maxOffsetsizeParent = offsetSize(parentElm);
const maxOffsetsize = offsetSize(childElm);
const supportsMax = equalWH(maxOffsetsize, maxOffsetsizeParent);
@@ -716,7 +731,7 @@ const diffBiggerThanOne = (valOne, valTwo) => {
const createEnvironment = () => {
const { body } = document;
const envDOM = createDOM(`<div id="${environmentElmId}"><div></div></div>`);
const envDOM = createDOM(`<div class="${classNameEnvironment}"><div></div></div>`);
const envElm = envDOM[0];
const envChildElm = envElm.firstChild;
const onChangedListener = new Set();
@@ -823,10 +838,13 @@ const createLifecycleBase = (defaultOptionsWithTemplate, initialOptions, updateF
_options(newOptions) {
if (newOptions) {
const { _validated: _changedOptions } = validateOptions(newOptions, optionsTemplate, options, true);
assignDeep(options, _changedOptions);
update({
_changedOptions,
});
if (!isEmptyObject(_changedOptions)) {
assignDeep(options, _changedOptions);
update({
_changedOptions,
});
}
}
return options;
@@ -861,6 +879,15 @@ const createStructureLifecycle = (target, initialOptions) => {
const updatePaddingCache = createCache(() => topRightBottomLeft(host, 'padding'), {
_equal: equalTRBL,
});
const updateOverflowAmountCache = createCache(
(ctx) => ({
x: Math.max(0, Math.round((ctx._contentScrollSize.w - ctx._viewportSize.w) * 100) / 100),
y: Math.max(0, Math.round((ctx._contentScrollSize.h - ctx._viewportSize.h) * 100) / 100),
}),
{
_equal: equalXY,
}
);
const { _options, _update } = createLifecycleBase(defaultOptionsWithTemplate, initialOptions, (force, checkOption) => {
const { _value: paddingAbsolute, _changed: paddingAbsoluteChanged } = checkOption('paddingAbsolute');
const { _value: padding, _changed: paddingChanged } = updatePaddingCache(force);
@@ -880,11 +907,6 @@ const createStructureLifecycle = (target, initialOptions) => {
paddingStyle.l = -padding.l;
}
if (!supportsScrollbarStyling) {
paddingStyle.r -= env._nativeScrollbarSize.y;
paddingStyle.b -= env._nativeScrollbarSize.x;
}
style(paddingElm, {
top: paddingStyle.t,
left: paddingStyle.l,
@@ -893,6 +915,20 @@ const createStructureLifecycle = (target, initialOptions) => {
'max-width': `calc(100% + ${paddingStyle.r * -1}px)`,
});
}
const viewportOffsetSize = offsetSize(paddingElm);
const contentClientSize = offsetSize(content);
const contentScrollSize = scrollSize(content);
const overflowAmuntCache = updateOverflowAmountCache(force, {
_contentScrollSize: contentScrollSize,
_viewportSize: {
w: viewportOffsetSize.w + Math.max(0, contentClientSize.w - contentScrollSize.w),
h: viewportOffsetSize.h + Math.max(0, contentClientSize.h - contentScrollSize.h),
},
});
const { _value: overflowAmount, _changed: overflowAmountChanged } = overflowAmuntCache;
console.log('overflowAmount', overflowAmount);
console.log('overflowAmountChanged', overflowAmountChanged);
});
const onSizeChanged = () => {
@@ -924,15 +960,6 @@ const createStructureLifecycle = (target, initialOptions) => {
const animationStartEventName = 'animationstart';
const scrollEventName = 'scroll';
const scrollAmount = 3333333;
const ResizeObserverConstructor = jsAPI('ResizeObserver');
const classNameSizeObserver = 'os-size-observer';
const classNameSizeObserverAppear = `${classNameSizeObserver}-appear`;
const classNameSizeObserverListener = `${classNameSizeObserver}-listener`;
const classNameSizeObserverListenerScroll = `${classNameSizeObserverListener}-scroll`;
const classNameSizeObserverListenerItem = `${classNameSizeObserverListener}-item`;
const classNameSizeObserverListenerItemFinal = `${classNameSizeObserverListenerItem}-final`;
const cAF = cancelAnimationFrame;
const rAF = requestAnimationFrame;
const getDirection = (elm) => style(elm, 'direction');
@@ -1066,8 +1093,6 @@ const createSizeObserver = (target, onSizeChangedCallback, options) => {
};
};
const classNameTrinsicObserver = 'os-trinsic-observer';
const IntersectionObserverConstructor = jsAPI('IntersectionObserver');
const createTrinsicObserver = (target, onTrinsicChangedCallback) => {
const trinsicObserver = createDOM(`<div class="${classNameTrinsicObserver}"></div>`)[0];
const offListeners = [];
@@ -1119,11 +1144,6 @@ const createTrinsicObserver = (target, onTrinsicChangedCallback) => {
};
};
const classNameHost = 'os-host';
const classNamePadding = 'os-padding';
const classNameViewport = 'os-viewport';
const classNameContent = 'os-content';
const normalizeTarget = (target) => {
if (isHTMLElement(target)) {
const isTextarea = is(target, 'textarea');
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+83 -60
View File
@@ -145,32 +145,33 @@
});
return result;
};
var runEach = function runEach(arr) {
var runEach = function runEach(arr, p1) {
if (arr instanceof Set) {
arr.forEach(function (fn) {
return fn && fn();
return fn && fn(p1);
});
} else {
each(arr, function (fn) {
return fn && fn();
return fn && fn(p1);
});
}
};
var matches = function matches(elm, selector) {
var elmPrototype = Element.prototype;
var is = function is(elm, selector) {
if (elm) {
var fn = Element.prototype.matches || Element.prototype.msMatchesSelector;
var fn = elmPrototype.matches || elmPrototype.msMatchesSelector;
return fn.call(elm, selector);
}
return false;
};
var is = function is(elm, selector) {
return matches(elm, selector);
};
var contents = function contents(elm) {
return elm ? from(elm.childNodes) : [];
};
var parent = function parent(elm) {
return elm ? elm.parentElement : null;
};
@@ -270,6 +271,14 @@
}
: zeroObj;
};
var scrollSize = function scrollSize(elm) {
return elm
? {
w: elm.scrollWidth,
h: elm.scrollHeight,
}
: zeroObj;
};
var getBoundingClientRect = function getBoundingClientRect(elm) {
return elm.getBoundingClientRect();
};
@@ -348,6 +357,9 @@
var equalWH = function equalWH(a, b) {
return equal(a, b, ['w', 'h']);
};
var equalXY = function equalXY(a, b) {
return equal(a, b, ['x', 'y']);
};
var equalTRBL = function equalTRBL(a, b) {
return equal(a, b, ['t', 'r', 'b', 'l']);
};
@@ -494,13 +506,13 @@
var _previous;
return function (force, context) {
var prev = _value;
var curr = _value;
var newVal = update(context, _value, _previous);
var changed = force || (_equal ? !_equal(prev, newVal) : prev !== newVal);
var changed = force || (_equal ? !_equal(curr, newVal) : curr !== newVal);
if (changed) {
_value = newVal;
_previous = prev;
_previous = curr;
}
return {
@@ -558,24 +570,15 @@
return result;
};
var resizeObserver = jsAPI('ResizeObserver');
var MutationObserverConstructor = jsAPI('MutationObserver');
var IntersectionObserverConstructor = jsAPI('IntersectionObserver');
var ResizeObserverConstructor = jsAPI('ResizeObserver');
var cAF = jsAPI('cancelAnimationFrame');
var rAF = jsAPI('requestAnimationFrame');
function createCommonjsModule(fn, basedir, module) {
return (
(module = {
path: basedir,
exports: {},
require: function (path, base) {
return commonjsRequire(path, base === undefined || base === null ? module.path : base);
},
}),
fn(module, module.exports),
module.exports
);
}
function commonjsRequire() {
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
function createCommonjsModule(fn) {
var module = { exports: {} };
return fn(module, module.exports), module.exports;
}
var _extends_1 = createCommonjsModule(function (module) {
@@ -717,12 +720,25 @@
return result;
}
var classNameEnvironment = 'os-environment';
var classNameEnvironmentFlexboxGlue = classNameEnvironment + '-flexbox-glue';
var classNameEnvironmentFlexboxGlueMax = classNameEnvironmentFlexboxGlue + '-max';
var classNameHost = 'os-host';
var classNamePadding = 'os-padding';
var classNameViewport = 'os-viewport';
var classNameContent = 'os-content';
var classNameViewportScrollbarStyling = classNameViewport + '-scrollbar-styled';
var classNameSizeObserver = 'os-size-observer';
var classNameSizeObserverAppear = classNameSizeObserver + '-appear';
var classNameSizeObserverListener = classNameSizeObserver + '-listener';
var classNameSizeObserverListenerScroll = classNameSizeObserverListener + '-scroll';
var classNameSizeObserverListenerItem = classNameSizeObserverListener + '-item';
var classNameSizeObserverListenerItemFinal = classNameSizeObserverListenerItem + '-final';
var classNameTrinsicObserver = 'os-trinsic-observer';
var environmentInstance;
var abs = Math.abs,
round = Math.round;
var environmentElmId = 'os-environment';
var classNameFlexboxGlue = 'flexbox-glue';
var classNameFlexboxGlueMax = classNameFlexboxGlue + '-max';
var getNativeScrollbarSize = function getNativeScrollbarSize(body, measureElm) {
appendChildren(body, measureElm);
@@ -736,7 +752,7 @@
var getNativeScrollbarStyling = function getNativeScrollbarStyling(testElm) {
var result = false;
addClass(testElm, 'os-viewport-scrollbar-styled');
addClass(testElm, classNameViewportScrollbarStyling);
try {
result =
@@ -766,11 +782,11 @@
};
var getFlexboxGlue = function getFlexboxGlue(parentElm, childElm) {
addClass(parentElm, classNameFlexboxGlue);
addClass(parentElm, classNameEnvironmentFlexboxGlue);
var minOffsetsizeParent = offsetSize(parentElm);
var minOffsetsize = offsetSize(childElm);
var supportsMin = equalWH(minOffsetsize, minOffsetsizeParent);
addClass(parentElm, classNameFlexboxGlueMax);
addClass(parentElm, classNameEnvironmentFlexboxGlueMax);
var maxOffsetsizeParent = offsetSize(parentElm);
var maxOffsetsize = offsetSize(childElm);
var supportsMax = equalWH(maxOffsetsize, maxOffsetsizeParent);
@@ -792,7 +808,7 @@
var createEnvironment = function createEnvironment() {
var _document = document,
body = _document.body;
var envDOM = createDOM('<div id="' + environmentElmId + '"><div></div></div>');
var envDOM = createDOM('<div class="' + classNameEnvironment + '"><div></div></div>');
var envElm = envDOM[0];
var envChildElm = envElm.firstChild;
var onChangedListener = new Set();
@@ -912,10 +928,12 @@
var _validateOptions = validateOptions(newOptions, optionsTemplate, options, true),
_changedOptions = _validateOptions._validated;
assignDeep(options, _changedOptions);
update({
_changedOptions: _changedOptions,
});
if (!isEmptyObject(_changedOptions)) {
assignDeep(options, _changedOptions);
update({
_changedOptions: _changedOptions,
});
}
}
return options;
@@ -957,6 +975,17 @@
_equal: equalTRBL,
}
);
var updateOverflowAmountCache = createCache(
function (ctx) {
return {
x: Math.max(0, Math.round((ctx._contentScrollSize.w - ctx._viewportSize.w) * 100) / 100),
y: Math.max(0, Math.round((ctx._contentScrollSize.h - ctx._viewportSize.h) * 100) / 100),
};
},
{
_equal: equalXY,
}
);
var _createLifecycleBase = createLifecycleBase(defaultOptionsWithTemplate, initialOptions, function (force, checkOption) {
var _checkOption = checkOption('paddingAbsolute'),
@@ -982,11 +1011,6 @@
paddingStyle.l = -padding.l;
}
if (!supportsScrollbarStyling) {
paddingStyle.r -= env._nativeScrollbarSize.y;
paddingStyle.b -= env._nativeScrollbarSize.x;
}
style(paddingElm, {
top: paddingStyle.t,
left: paddingStyle.l,
@@ -995,6 +1019,21 @@
'max-width': 'calc(100% + ' + paddingStyle.r * -1 + 'px)',
});
}
var viewportOffsetSize = offsetSize(paddingElm);
var contentClientSize = offsetSize(content);
var contentScrollSize = scrollSize(content);
var overflowAmuntCache = updateOverflowAmountCache(force, {
_contentScrollSize: contentScrollSize,
_viewportSize: {
w: viewportOffsetSize.w + Math.max(0, contentClientSize.w - contentScrollSize.w),
h: viewportOffsetSize.h + Math.max(0, contentClientSize.h - contentScrollSize.h),
},
});
var overflowAmount = overflowAmuntCache._value,
overflowAmountChanged = overflowAmuntCache._changed;
console.log('overflowAmount', overflowAmount);
console.log('overflowAmountChanged', overflowAmountChanged);
}),
_options = _createLifecycleBase._options,
_update = _createLifecycleBase._update;
@@ -1028,15 +1067,6 @@
var animationStartEventName = 'animationstart';
var scrollEventName = 'scroll';
var scrollAmount = 3333333;
var ResizeObserverConstructor = jsAPI('ResizeObserver');
var classNameSizeObserver = 'os-size-observer';
var classNameSizeObserverAppear = classNameSizeObserver + '-appear';
var classNameSizeObserverListener = classNameSizeObserver + '-listener';
var classNameSizeObserverListenerScroll = classNameSizeObserverListener + '-scroll';
var classNameSizeObserverListenerItem = classNameSizeObserverListener + '-item';
var classNameSizeObserverListenerItemFinal = classNameSizeObserverListenerItem + '-final';
var cAF = cancelAnimationFrame;
var rAF = requestAnimationFrame;
var getDirection = function getDirection(elm) {
return style(elm, 'direction');
@@ -1195,8 +1225,6 @@
};
};
var classNameTrinsicObserver = 'os-trinsic-observer';
var IntersectionObserverConstructor = jsAPI('IntersectionObserver');
var createTrinsicObserver = function createTrinsicObserver(target, onTrinsicChangedCallback) {
var trinsicObserver = createDOM('<div class="' + classNameTrinsicObserver + '"></div>')[0];
var offListeners = [];
@@ -1252,11 +1280,6 @@
};
};
var classNameHost = 'os-host';
var classNamePadding = 'os-padding';
var classNameViewport = 'os-viewport';
var classNameContent = 'os-content';
var normalizeTarget = function normalizeTarget(target) {
if (isHTMLElement(target)) {
var isTextarea = is(target, 'textarea');
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -7,7 +7,6 @@ import {
offsetSize,
scrollLeft,
scrollTop,
jsAPI,
runEach,
prependChildren,
removeElements,
@@ -19,6 +18,7 @@ import {
equalWH,
cAF,
rAF,
ResizeObserverConstructor,
} from 'support';
import { CSSDirection } from 'typings';
import { getEnvironment } from 'environment';
@@ -34,7 +34,6 @@ import {
const animationStartEventName = 'animationstart';
const scrollEventName = 'scroll';
const scrollAmount = 3333333;
const ResizeObserverConstructor = jsAPI('ResizeObserver');
const getDirection = (elm: HTMLElement): CSSDirection => style(elm, 'direction') as CSSDirection;
export type SizeObserverOptions = { _direction?: boolean; _appear?: boolean };
@@ -181,5 +181,5 @@ createSizeObserver(
},
{ _direction: true, _appear: true }
);
console.log('h1');
export { start };
@@ -0,0 +1,6 @@
export interface AutoUpdateLoop {
_add(fn: (delta: number) => any): () => void;
_interval(newInterval: number): () => void;
_interval(): number;
}
export declare const getAutoUpdateLoop: () => AutoUpdateLoop;
@@ -0,0 +1 @@
export * from 'autoUpdateLoop/autoUpdateLoop';
+15
View File
@@ -0,0 +1,15 @@
export declare const classNameEnvironment = "os-environment";
export declare const classNameEnvironmentFlexboxGlue: string;
export declare const classNameEnvironmentFlexboxGlueMax: string;
export declare const classNameHost = "os-host";
export declare const classNamePadding = "os-padding";
export declare const classNameViewport = "os-viewport";
export declare const classNameContent = "os-content";
export declare const classNameViewportScrollbarStyling: string;
export declare const classNameSizeObserver = "os-size-observer";
export declare const classNameSizeObserverAppear: string;
export declare const classNameSizeObserverListener: string;
export declare const classNameSizeObserverListenerScroll: string;
export declare const classNameSizeObserverListenerItem: string;
export declare const classNameSizeObserverListenerItemFinal: string;
export declare const classNameTrinsicObserver = "os-trinsic-observer";
@@ -0,0 +1,9 @@
export interface DOMObserverOptions {
_observeContent?: boolean;
_attributes?: string[];
}
export interface DOMObserver {
_disconnect: () => void;
_update: () => void;
}
export declare const createDOMObserver: (target: HTMLElement, callback: (changedTargetAttrs: string[], styleChanged: boolean, contentChanged: boolean) => any, options?: DOMObserverOptions | undefined) => DOMObserver;
+1 -1
View File
@@ -9,5 +9,5 @@ export interface CacheOptions<T> {
}
export declare type CacheUpdate<T, C> = (force?: boolean | 0, context?: C) => Cache<T>;
export declare type UpdateCachePropFunction<T, C> = (context?: C, current?: T, previous?: T) => T;
export declare type EqualCachePropFunction<T> = (a?: T, b?: T) => boolean;
export declare type EqualCachePropFunction<T> = (currentVal?: T, newVal?: T) => boolean;
export declare const createCache: <T, C = undefined>(update: UpdateCachePropFunction<T, C>, options?: CacheOptions<T> | undefined) => CacheUpdate<T, C>;
@@ -1 +1,11 @@
export declare const resizeObserver: any | undefined;
export declare const MutationObserverConstructor: {
new (callback: MutationCallback): MutationObserver;
prototype: MutationObserver;
} | undefined;
export declare const IntersectionObserverConstructor: {
new (callback: IntersectionObserverCallback, options?: IntersectionObserverInit | undefined): IntersectionObserver;
prototype: IntersectionObserver;
} | undefined;
export declare const ResizeObserverConstructor: any | undefined;
export declare const cAF: typeof cancelAnimationFrame | undefined;
export declare const rAF: typeof requestAnimationFrame | undefined;
@@ -5,5 +5,6 @@ export interface WH<T = number> {
export declare const windowSize: () => WH;
export declare const offsetSize: (elm: HTMLElement | null) => WH;
export declare const clientSize: (elm: HTMLElement | null) => WH;
export declare const scrollSize: (elm: HTMLElement | null) => WH;
export declare const getBoundingClientRect: (elm: HTMLElement) => DOMRect;
export declare const hasDimensions: (elm: HTMLElement | null) => boolean;
+10 -6
View File
@@ -1,6 +1,10 @@
export declare const find: (selector: string, elm?: Element | null | undefined) => ReadonlyArray<Element>;
export declare const findFirst: (selector: string, elm?: Element | null | undefined) => Element | null;
export declare const is: (elm: Element | null, selector: string) => boolean;
export declare const children: (elm: Element | null, selector?: string | undefined) => ReadonlyArray<Element>;
export declare const contents: (elm: Element | null) => ReadonlyArray<ChildNode>;
export declare const parent: (elm: Node | null) => Node | null;
declare type InputElementType = Element | null | undefined;
declare type OutputElementType = Element | null;
declare const find: (selector: string, elm?: InputElementType) => ReadonlyArray<Element>;
declare const findFirst: (selector: string, elm?: InputElementType) => OutputElementType;
declare const is: (elm: InputElementType, selector: string) => boolean;
declare const children: (elm: InputElementType, selector?: string | undefined) => ReadonlyArray<Element>;
declare const contents: (elm: InputElementType) => ReadonlyArray<ChildNode>;
declare const parent: (elm: InputElementType) => OutputElementType;
declare const liesBetween: (elm: InputElementType, highBoundarySelector: string, deepBoundarySelector: string) => boolean;
export { find, findFirst, is, children, contents, parent, liesBetween };
+5 -4
View File
@@ -1,12 +1,13 @@
import { PlainObject } from 'typings';
declare type RunEachItem = ((...args: any) => any | any[]) | null | undefined;
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, callback: (value: T, indexOrKey: number, source: Array<T>) => boolean | void): Array<T> | ReadonlyArray<T> | null;
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, callback: (value: T, indexOrKey: number, source: ArrayLike<T>) => boolean | void): ArrayLike<T> | null;
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, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject | null;
export declare function each(obj: PlainObject | null | undefined, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | void): PlainObject | null | undefined;
export declare const indexOf: <T = any>(arr: T[], item: T, fromIndex?: number | undefined) => number;
export declare const from: <T = any>(arr: ArrayLike<T>) => T[];
export declare const runEach: (arr: ArrayLike<RunEachItem> | Set<RunEachItem>) => void;
export declare const isEmptyArray: (array: Array<any> | null | undefined) => boolean | null | undefined;
export declare const runEach: (arr: ArrayLike<RunEachItem> | Set<RunEachItem>, p1?: unknown) => void;
export {};
@@ -1,4 +1,5 @@
export * from 'support/utils/array';
export * from 'support/utils/equal';
export * from 'support/utils/lexicon';
export * from 'support/utils/object';
export * from 'support/utils/types';
@@ -0,0 +1,15 @@
interface GenericLexicon<T extends boolean> {
_widthHeight: T extends true ? 'width' : 'height';
_WidthHeight: T extends true ? 'Width' : 'Height';
_leftTop: T extends true ? 'left' : 'top';
_LeftTop: T extends true ? 'Left' : 'Top';
_xy: T extends true ? 'x' : 'y';
_XY: T extends true ? 'X' : 'Y';
_wh: T extends true ? 'w' : 'h';
_lt: T extends true ? 'l' : 't';
}
export interface Lexicon<T extends boolean> extends GenericLexicon<T> {
_inverted: Lexicon<T extends true ? false : true>;
}
export declare const getLexicon: <T extends boolean = false>(horizontal?: T | undefined) => Lexicon<T>;
export {};
+1 -3
View File
@@ -175,9 +175,7 @@ const rollupConfig = (config = {}, { project = process.cwd(), overwrite = {}, si
mainFields: ['browser', 'umd:main', 'module', 'main'],
extensions: resolve.extensions,
rootDir: srcPath,
customResolveOptions: {
moduleDirectory: [...resolve.directories.map((dir) => path.resolve(projectPath, dir)), path.resolve(__dirname, 'node_modules')],
},
moduleDirectories: [...resolve.directories.map((dir) => path.resolve(projectPath, dir)), path.resolve(__dirname, 'node_modules')],
}),
inject: rollupInject({
...(typeof inject === 'object' ? inject : {}),
+43 -29
View File
@@ -1247,26 +1247,26 @@
"@nodelib/fs.scandir" "2.1.3"
fastq "^1.6.0"
"@rollup/plugin-babel@^5.1.0":
version "5.2.1"
resolved "https://registry.yarnpkg.com/@rollup/plugin-babel/-/plugin-babel-5.2.1.tgz#20fc8f8864dc0eaa1c5578408459606808f72924"
integrity sha512-Jd7oqFR2dzZJ3NWANDyBjwTtX/lYbZpVcmkHrfQcpvawHs9E4c0nYk5U2mfZ6I/DZcIvy506KZJi54XK/jxH7A==
"@rollup/plugin-babel@^5.2.2":
version "5.2.2"
resolved "https://registry.yarnpkg.com/@rollup/plugin-babel/-/plugin-babel-5.2.2.tgz#e5623a01dd8e37e004ba87f2de218c611727d9b2"
integrity sha512-MjmH7GvFT4TW8xFdIeFS3wqIX646y5tACdxkTO+khbHvS3ZcVJL6vkAHLw2wqPmkhwCfWHoNsp15VYNwW6JEJA==
dependencies:
"@babel/helper-module-imports" "^7.10.4"
"@rollup/pluginutils" "^3.1.0"
"@rollup/plugin-commonjs@^14.0.0":
version "14.0.0"
resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-14.0.0.tgz#4285f9ec2db686a31129e5a2b415c94aa1f836f0"
integrity sha512-+PSmD9ePwTAeU106i9FRdc+Zb3XUWyW26mo5Atr2mk82hor8+nPwkztEjFo8/B1fJKfaQDg9aM2bzQkjhi7zOw==
"@rollup/plugin-commonjs@^17.0.0":
version "17.0.0"
resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-17.0.0.tgz#2ae2228354cf0fbba6cf9f06f30b2c66a974324c"
integrity sha512-/omBIJG1nHQc+bgkYDuLpb/V08QyutP9amOrJRUSlYJZP+b/68gM//D8sxJe3Yry2QnYIr3QjR3x4AlxJEN3GA==
dependencies:
"@rollup/pluginutils" "^3.0.8"
"@rollup/pluginutils" "^3.1.0"
commondir "^1.0.1"
estree-walker "^1.0.1"
glob "^7.1.2"
is-reference "^1.1.2"
magic-string "^0.25.2"
resolve "^1.11.0"
estree-walker "^2.0.1"
glob "^7.1.6"
is-reference "^1.2.1"
magic-string "^0.25.7"
resolve "^1.17.0"
"@rollup/plugin-html@^0.2.0":
version "0.2.0"
@@ -1282,18 +1282,17 @@
estree-walker "^1.0.1"
magic-string "^0.25.5"
"@rollup/plugin-node-resolve@^8.4.0":
version "8.4.0"
resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-8.4.0.tgz#261d79a680e9dc3d86761c14462f24126ba83575"
integrity sha512-LFqKdRLn0ShtQyf6SBYO69bGE1upV6wUhBX0vFOUnLAyzx5cwp8svA0eHUnu8+YU57XOkrMtfG63QOpQx25pHQ==
"@rollup/plugin-node-resolve@^11.0.1":
version "11.0.1"
resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.0.1.tgz#d3765eec4bccf960801439a999382aed2dca959b"
integrity sha512-ltlsj/4Bhwwhb+Nb5xCz/6vieuEj2/BAkkqVIKmZwC7pIdl8srmgmglE4S0jFlZa32K4qvdQ6NHdmpRKD/LwoQ==
dependencies:
"@rollup/pluginutils" "^3.1.0"
"@types/resolve" "1.17.1"
builtin-modules "^3.1.0"
deep-freeze "^0.0.1"
deepmerge "^4.2.2"
is-module "^1.0.0"
resolve "^1.17.0"
resolve "^1.19.0"
"@rollup/plugin-typescript@^5.0.2":
version "5.0.2"
@@ -1303,7 +1302,7 @@
"@rollup/pluginutils" "^3.0.1"
resolve "^1.14.1"
"@rollup/pluginutils@^3.0.1", "@rollup/pluginutils@^3.0.4", "@rollup/pluginutils@^3.0.8", "@rollup/pluginutils@^3.1.0":
"@rollup/pluginutils@^3.0.1", "@rollup/pluginutils@^3.0.4", "@rollup/pluginutils@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b"
integrity sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==
@@ -2892,11 +2891,6 @@ deep-extend@^0.6.0:
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"
integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==
deep-freeze@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/deep-freeze/-/deep-freeze-0.0.1.tgz#3a0b0005de18672819dfd38cd31f91179c893e84"
integrity sha1-OgsABd4YZygZ39OM0x+RF5yJPoQ=
deep-is@^0.1.3, deep-is@~0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
@@ -3510,6 +3504,11 @@ estree-walker@^1.0.1:
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700"
integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==
estree-walker@^2.0.1:
version "2.0.2"
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac"
integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==
esutils@^2.0.2:
version "2.0.3"
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
@@ -4546,6 +4545,13 @@ is-color-stop@^1.0.0:
rgb-regex "^1.0.1"
rgba-regex "^1.0.0"
is-core-module@^2.1.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.2.0.tgz#97037ef3d52224d85163f5597b2b63d9afed981a"
integrity sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==
dependencies:
has "^1.0.3"
is-data-descriptor@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56"
@@ -4693,7 +4699,7 @@ is-potential-custom-element-name@^1.0.0:
resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.0.tgz#0c52e54bcca391bb2c494b21e8626d7336c6e397"
integrity sha1-DFLlS8yjkbssSUsh6GJtczbG45c=
is-reference@^1.1.2:
is-reference@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7"
integrity sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==
@@ -5740,7 +5746,7 @@ lz-string@^1.4.4:
resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26"
integrity sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY=
magic-string@0.25.7, magic-string@^0.25.2, magic-string@^0.25.5:
magic-string@0.25.7, magic-string@^0.25.5, magic-string@^0.25.7:
version "0.25.7"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051"
integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==
@@ -7476,13 +7482,21 @@ resolve-url@^0.2.1:
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=
resolve@1.17.0, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.13.1, resolve@^1.14.1, resolve@^1.17.0, resolve@^1.3.2, resolve@^1.8.1:
resolve@1.17.0, resolve@^1.10.0, resolve@^1.13.1, resolve@^1.14.1, resolve@^1.17.0, resolve@^1.3.2, resolve@^1.8.1:
version "1.17.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444"
integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==
dependencies:
path-parse "^1.0.6"
resolve@^1.19.0:
version "1.19.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c"
integrity sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==
dependencies:
is-core-module "^2.1.0"
path-parse "^1.0.6"
restore-cursor@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e"