updated gitignore

This commit is contained in:
Rene Haas
2022-08-11 11:19:50 +02:00
parent 8a62dbf622
commit aa9dd009be
76 changed files with 422 additions and 13503 deletions
+7 -1
View File
@@ -3,11 +3,17 @@
# dependencies
node_modules/
# generated
# generated by tools
.build/
.coverage/
.nyc_output/
# generated by build
packages/**/dist/
packages/**/styles/
packages/**/types/
local/**/dist/
# local env files
.env.local
.env.*.local
+414 -1
View File
@@ -1 +1,414 @@
[README](./packages/overlayscrollbars/README.md);
<p align="center">
<a href="https://kingsora.github.io/OverlayScrollbars">
<a href="https://kingsora.github.io/OverlayScrollbars"><img src="https://kingsora.github.io/OverlayScrollbars/design/logo.svg" width="200" height="133" alt="OverlayScrollbars"></a>
</a>
</p>
<h6 align="center">
<a href="https://www.npmjs.com/package/overlayscrollbars"><img src="https://img.shields.io/npm/dm/overlayscrollbars.svg?style=flat-square" alt="Downloads"></a>
<a href="https://www.npmjs.com/package/overlayscrollbars"><img src="https://img.shields.io/npm/v/overlayscrollbars.svg?style=flat-square" alt="Version"></a>
<a href="https://github.com/KingSora/OverlayScrollbars/blob/master/LICENSE"><img src="https://img.shields.io/github/license/kingsora/overlayscrollbars.svg?style=flat-square" alt="License"></a>
</h6>
> OverlayScrollbars is a javascript scrollbar plugin that hides native scrollbars, provides custom styleable overlay scrollbars and keeps the native functionality and feeling.
## Why
I've created this plugin because I hate ugly and space consuming scrollbars. Similar plugins haven't met my requirements in terms of features, quality, simplicity, license or browser support.
## Goals & Features
- Simple, powerful and good documented API
- High browser compatibility - <b>Firefox</b>, <b>Chrome</b>, <b>Opera</b>, <b>Edge</b>, <b>Safari 10+</b> and <b>IE 11</b>
- Tested on various devices - <b>Mobile</b>, <b>Desktop</b> and <b>Tablet</b>
- Tested with various (and mixed) inputs - <b>Mouse</b>, <b>touch</b> and <b>pen</b>
- <b>Treeshaking</b> - bundle only what you really need
- Automatic update detection - <b>no polling</b>
- Usage of latest browser features - best <b>performance</b> in new browsers
- Bidirectional - LTR or RTL direction support
- Simple and effective scrollbar styling
- TypeScript support - fully written in TypeScript
## Getting started
#### npm & Node
OverlayScrollbars can be downloaded from [npm](https://www.npmjs.com/package/overlayscrollbars) or the package manager of your choice:
```sh
npm install overlayscrollbars
```
After installation it can be imported:
```js
import 'overlayscrollbars/overlayscrollbars.css';
import { OverlayScrollbars } from 'overlayscrollbars';
```
<details><summary><h6>Manual download & embedding</h6></summary>
You can use OverlayScrollbars without any bundler or package manager.
Simply download it from the [Releases](https://github.com/KingSora/OverlayScrollbars/releases) or use a [CDN](https://cdnjs.com/libraries/overlayscrollbars).
- Use the javascript files with the `.browser` extension.
- If you target old browsers use the `.es5` javascript file, for new browsers `.es6`.
- For production use the javascript / stylesheet files with the `.min` extension.
Embedd OverlayScrollbars manually in your HTML:
```html
<link type="text/css" href="path/to/overlayscrollbars.css" rel="stylesheet" />
<script type="text/javascript" src="path/to/overlayscrollbars.js" defer></script>
```
</details>
## Initialization
> __Note__ During initialization its expected that the <b>CSS file is loaded and parsed</b> by the browser.
You can initialize either directly with an `Element` or with an `Object` where you have more control over the initialization process.
```js
// simple initialization with an element
const osInstance = OverlayScrollbars(document.querySelector('#myElement'), {});
```
<details><summary><h6>Initialization with an Object</h6></summary>
> __Note__ For now please refer to the <b>TypeScript definitions</b> for a more detailed description of all possibilities.
The only required field is the `target` field. This is the field to which the plugin is applied to.
If you use the object initialization only with the `target` field, the outcome is equivalent to the element initialization:
```js
// Both initializations have the same outcome
OverlayScrollbars(document.querySelector('#myElement'), {});
OverlayScrollbars({ target: document.querySelector('#myElement') }, {});
```
In the initialization object you can specify how the library is handling generated elements.
For example you can appoint an existing element as the `viewport` element. Like this the library won't generate it but take the specified element instead:
```js
OverlayScrollbars({
target: document.querySelector('#target'),
elements: {
viewport: document.querySelector('#viewport'),
},
}, {});
```
This is very useful if you have a fixed DOM structure and don't want OverlayScrollbars to generate its own elements. Those cases arise very often when you want an other library to work together with OverlayScrollbars.
---
You can also decide to which element the scrollbars should be applied to:
```js
OverlayScrollbars({
target: document.querySelector('#target'),
scrollbars: {
slot: document.querySelector('#target').parentElement,
},
}, {});
```
---
And last but not least you can decide when the initialization should be canceled:
```js
OverlayScrollbars({
target: document.querySelector('#target'),
cancel: {
nativeScrollbarsOverlaid: true,
body: null,
}
}, {});
```
In the above example the initialization is canceled when the native scrollbars are overlaid or when your target is a `body` element and the plugin determined that a initialization to the `body` element would affect native functionality like `window.scrollTo`.
</details>
## Options
You can initialize OverlayScrollbars with an initial set of options, which can be changed at any time with the `options` method:
```js
OverlayScrollbars(document.querySelector('#myElement'), {
overflow: {
x: 'hidden',
},
});
```
<details><summary><h6>Options in depth</h6></summary>
The default options are:
```js
const defaultOptions = {
paddingAbsolute: false,
showNativeOverlaidScrollbars: false,
update: {
elementEvents: [['img', 'load']],
debounce: [0, 33],
attributes: null,
ignoreMutation: null,
},
overflow: {
x: 'scroll',
y: 'scroll',
},
scrollbars: {
theme: 'os-theme-dark',
visibility: 'auto',
autoHide: 'never',
autoHideDelay: 1300,
dragScroll: true,
clickScroll: false,
pointers: ['mouse', 'touch', 'pen'],
},
};
```
### `paddingAbsolute`
| type | default |
| :--- | :--- |
| `boolean` | `false` |
Indicates whether the padding for the content shall be absolute.
### `showNativeOverlaidScrollbars`
| type | default |
| :--- | :--- |
| `boolean` | `false` |
Indicates whether the native overlaid scrollbars shall be visible.
### `update.elementEvents`
| type | default |
| :--- | :--- |
| `Array<[string, string]> \| null` | `[['img', 'load']]` |
An array of tuples. The first value in the tuple is an `selector` and the second value are `event names`. The plugin will update itself if any of the elements with the specified selector will emit any specified event. The default value can be interpreted as "The plugin will update itself if any `img` element emits an `load` event."
### `update.debounce`
| type | default |
| :--- | :--- |
| `[number, number] \| number \| null` | `[0, 33]` |
> __Note__ If 0 is used for the timeout, `requestAnimationFrame` instead of `setTimeout` is used for the debounce.
Debounces the `MutationObserver` which tracks changes to the content. If a **tuple** is passed, the first value is the timeout and second is the max wait. If only a **number** is passed you specify only the timeout and there is no max wait. With **null** there is no debounce. **Usefull to fine-tune performance.**
### `update.attributes`
| type | default |
| :--- | :--- |
| `string[] \| null` | `null` |
> __Note__ There is a base array of attributes that the `MutationObserver` always observes, even if this option is `null`.
An array of additional attributes that the `MutationObserver` should observe for the content.
### `update.ignoreMutation`
| type | default |
| :--- | :--- |
| `((mutation) => any) \| null` | `null` |
A function which receives a [`MutationRecord`](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord) as an argument. If the function returns a truthy value the mutation will be ignored and the plugin won't update. **Usefull to fine-tune performance.**
### `overflow.x`
| type | default |
| :--- | :--- |
| `string` | `'scroll'` |
> __Note__ Valid values are: `'hidden'`, `'scroll'`, `'visible'`, `'visible-hidden'` and `'visible-scroll'`.
The overflow behavior for the horizontal (x) axis.
### `overflow.y`
| type | default |
| :--- | :--- |
| `string` | `'scroll'` |
> __Note__ Valid values are: `'hidden'`, `'scroll'`, `'visible'`, `'visible-hidden'` and `'visible-scroll'`.
The overflow behavior for the vertical (y) axis.
### `scrollbars.theme`
| type | default |
| :--- | :--- |
| `string \| null` | `'os-theme-dark'` |
Applies the specified theme (classname) to the scrollbars.
### `scrollbars.visibility`
| type | default |
| :--- | :--- |
| `string` | `'auto'` |
> __Note__ Valid values are: `'visible'`, `'hidden'`, and `'auto'`.
The base visibility of the scrollbars.
### `scrollbars.autoHide`
| type | default |
| :--- | :--- |
| `string` | `'never'` |
> __Note__ Valid values are: `'never'`, `'scroll'`, `'leave'` and `'move'`.
The possibility to hide visible scrollbars automatically after a certain user action.
### `scrollbars.autoHideDelay`
| type | default |
| :--- | :--- |
| `number` | `1300` |
The delay in milliseconds before the scrollbars are hidden automatically.
### `scrollbars.dragScroll`
| type | default |
| :--- | :--- |
| `boolean` | `true` |
Indicates whether you can drag the scrollbar handles for scrolling.
### `scrollbars.clickScroll`
| type | default |
| :--- | :--- |
| `boolean` | `false` |
Indicates whether you can click on the scrollbar track for scrolling.
### `scrollbars.pointers`
| type | default |
| :--- | :--- |
| `string[] \| null` | `['mouse', 'touch', 'pen']` |
The [`PointerTypes`](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType) the plugin should react to.
</details>
## Events
You can initialize OverlayScrollbars with an initial set of events, which can be managed at any time with the `on` and `off` methods:
```js
OverlayScrollbars(document.querySelector('#myElement'), {}, {
updated(osInstance, onUpdatedArgs) {
// ...
}
});
```
<details><summary><h6>Events in depth</h6></summary>
> __Note__ Every event receives the `instance` from which it was fired as the first argument. Always.
### `initialized`
| arguments | description |
| :--- | :--- |
| `instance` | The instance which fired the event. |
Is fired after all generated elements, observers and events were appended to the DOM.
### `updated`
| arguments | description |
| :--- | :--- |
| `instance` | The instance which fired the event. |
| `onUpdatedArgs` | An `object` which describes the update in detail. |
> __Note__ If an update was triggered but nothing changed, the event won't be fired.
Is fired after the instace was updated.
### `destroyed`
| arguments | description |
| :--- | :--- |
| `instance` | The instance which fired the event. |
| `canceled` | An `boolean` which indicates whether the initialization was canceled and thus destroyed. |
Is fired after all generated elements, observers and events were removed from the DOM.
</details>
## Instance Methods
> __Note__ For now please refer to the <b>TypeScript definitions</b> for a more detailed description.
```ts
interface OverlayScrollbars {
options(): Options;
options(newOptions: DeepPartial<Options>): Options;
update(force?: boolean): OverlayScrollbars;
destroy(): void;
state(): State;
elements(): Elements;
on<N extends keyof EventListenerMap>(name: N, listener: EventListener<N>): () => void;
on<N extends keyof EventListenerMap>(name: N, listener: EventListener<N>[]): () => void;
off<N extends keyof EventListenerMap>(name: N, listener: EventListener<N>): void;
off<N extends keyof EventListenerMap>(name: N, listener: EventListener<N>[]): void;
}
```
## Static Methods
> __Note__ For now please refer to the <b>TypeScript definitions</b> for a more detailed description.
```ts
interface OverlayScrollbarsStatic {
(target: InitializationTarget): OverlayScrollbars | undefined;
(
target: InitializationTarget,
options: DeepPartial<Options>,
eventListeners?: InitialEventListeners
): OverlayScrollbars;
plugin(plugin: Plugin | Plugin[]): void;
valid(osInstance: any): boolean;
env(): Environment;
}
```
## Sponsors
<table>
<tr>
<td>
<a href="https://www.browserstack.com" target="_blank">
<img align="center" src="https://kingsora.github.io/OverlayScrollbars/img/browserstack.png" width="250">
</a>
</td>
<td>
Thanks to <a href="https://www.browserstack.com" target="_blank">BrowserStack</a> for sponsoring open source projects and letting me test OverlayScrollbars for free.
</td>
</tr>
</table>
## Future Plans
- Provide plugin based support for missing features. (treeshakeable)
- Frequent updates in terms of bug-fixes and enhancements. (always use latest browser features)
- Improve tests. (unit & browser tests)
## License
MIT
-5
View File
@@ -1,5 +0,0 @@
declare type ResizeListener = (width: number, height: number) => void;
export declare const resize: (element: HTMLElement) => {
addResizeListener(listener: ResizeListener): void;
};
export {};
-73
View File
@@ -1,73 +0,0 @@
// @ts-ignore
import { createDiv, appendChildren, parent, style, on, off, addClass, clientSize, each, } from './support';
export const resize = (element) => {
const resizeListeners = [];
const strMouseTouchDownEvent = 'mousedown touchstart';
const strMouseTouchUpEvent = 'mouseup touchend';
const strMouseTouchMoveEvent = 'mousemove touchmove';
const strSelectStartEvent = 'selectstart';
const dragStartSize = { w: 0, h: 0 };
const dragStartPosition = { x: 0, y: 0 };
const resizeBtn = createDiv('resizeBtn');
appendChildren(element, resizeBtn);
addClass(element, 'resizer');
// eslint-disable-next-line @typescript-eslint/no-unused-vars
let dragResizeBtn;
let dragResizer;
const onSelectStart = (event) => {
event.preventDefault();
return false;
};
const resizerResize = (event) => {
const isTouchEvent = event.touches !== undefined;
const mouseOffsetHolder = isTouchEvent
? event.touches[0]
: event;
const sizeStyle = {
width: dragStartSize.w + mouseOffsetHolder.pageX - dragStartPosition.x,
height: dragStartSize.h + mouseOffsetHolder.pageY - dragStartPosition.y,
};
style(dragResizer, sizeStyle);
each(resizeListeners, (listener) => {
if (listener) {
listener(sizeStyle.width, sizeStyle.height);
}
});
event.stopPropagation();
};
const resizerResized = () => {
off(document, strSelectStartEvent, onSelectStart);
off(document, strMouseTouchMoveEvent, resizerResize);
off(document, strMouseTouchUpEvent, resizerResized);
dragResizer = undefined;
dragResizeBtn = undefined;
};
on(resizeBtn, strMouseTouchDownEvent, (event) => {
const { currentTarget } = event;
const correctButton = event.buttons === 1 || event.which === 1;
const isTouchEvent = event.touches !== undefined;
const mouseOffsetHolder = isTouchEvent
? event.touches[0]
: event;
if (correctButton || isTouchEvent) {
dragStartPosition.x = mouseOffsetHolder.pageX;
dragStartPosition.y = mouseOffsetHolder.pageY;
dragResizeBtn = currentTarget;
dragResizer = parent(currentTarget);
const cSize = clientSize(element);
dragStartSize.w = cSize.w;
dragStartSize.h = cSize.h;
on(document, strSelectStartEvent, onSelectStart, { _passive: false });
on(document, strMouseTouchMoveEvent, resizerResize, { _passive: false });
on(document, strMouseTouchUpEvent, resizerResized, { _passive: false });
event.preventDefault();
event.stopPropagation();
}
}, { _passive: false });
return {
addResizeListener(listener) {
resizeListeners.push(listener);
},
};
};
//# sourceMappingURL=resize.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"resize.js","sourceRoot":"","sources":["../src/resize.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,OAAO,EACL,SAAS,EACT,cAAc,EACd,MAAM,EACN,KAAK,EACL,EAAE,EACF,GAAG,EACH,QAAQ,EAGR,UAAU,EACV,IAAI,GACL,MAAM,WAAW,CAAC;AAInB,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAoB,EAAE,EAAE;IAC7C,MAAM,eAAe,GAAqB,EAAE,CAAC;IAC7C,MAAM,sBAAsB,GAAG,sBAAsB,CAAC;IACtD,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;IAChD,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;IACrD,MAAM,mBAAmB,GAAG,aAAa,CAAC;IAC1C,MAAM,aAAa,GAAe,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IACjD,MAAM,iBAAiB,GAAe,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IACrD,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC;IACz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E,CAAC;YACvB,KAAK,CAAC,eAAe,EAAE,CAAC;SACzB;IACH,CAAC,EACD,EAAE,QAAQ,EAAE,KAAK,EAAE,CACpB,CAAC;IAEF,OAAO;QACL,iBAAiB,CAAC,QAAwB;YACxC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjC,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
-9
View File
@@ -1,9 +0,0 @@
export declare const generateSelectCallback: (targetElms: HTMLElement[] | HTMLElement | null, callback: (targetAffectedElm: HTMLElement, possibleValues: string[], selectedValue: string) => any) => (event: Event | HTMLSelectElement | null) => void;
export declare const generateClassChangeSelectCallback: (targetElms: HTMLElement[] | HTMLElement | null) => (event: Event | HTMLSelectElement | null) => void;
export declare const selectOption: (select: HTMLSelectElement | null, selectedOption: string | number) => boolean;
export declare const iterateSelect: <T>(select: HTMLSelectElement | null, options?: {
filter?: ((value: string, index: number, array: string[]) => boolean) | undefined;
beforeEach?: (() => T | Promise<T>) | undefined;
check?: ((input: T, selectedOptions: string) => void | Promise<void>) | undefined;
afterEach?: (() => void | Promise<void>) | undefined;
} | undefined) => Promise<void>;
-75
View File
@@ -1,75 +0,0 @@
function isEvent(obj) {
return obj instanceof Event || !!obj.target;
}
// eslint-disable-next-line
const noop = () => {
return {};
};
const getSelectOptions = (selectElement) => Array.from(selectElement.options).map((option) => option.value);
export const generateSelectCallback = (targetElms, callback) => (event) => {
const target = isEvent(event)
? event.target
: event;
if (target) {
const selectedOption = target.value;
const selectOptions = getSelectOptions(target);
const elmsArr = Array.isArray(targetElms) ? targetElms : [targetElms];
elmsArr.forEach((elm) => {
if (elm) {
callback(elm, selectOptions, selectedOption);
}
});
}
};
export const generateClassChangeSelectCallback = (targetElms) => generateSelectCallback(targetElms, (targetAffectedElm, possibleValues, selectedValue) => {
possibleValues.forEach((clazz) => targetAffectedElm.classList.remove(clazz));
targetAffectedElm.classList.add(selectedValue);
});
export const selectOption = (select, selectedOption) => {
if (!select) {
return false;
}
const options = getSelectOptions(select);
const currValue = select.value;
if (selectedOption === currValue) {
return false;
}
if (typeof selectedOption === 'string' && options.includes(selectedOption)) {
select.value = selectedOption;
}
else if (typeof selectedOption === 'number' &&
options.length < selectedOption &&
selectedOption > -1) {
select.selectedIndex = selectedOption;
}
let event;
if (typeof Event === 'function') {
event = new Event('change');
}
else {
event = document.createEvent('Event');
event.initEvent('change', true, true);
}
select.dispatchEvent(event);
return true;
};
export const iterateSelect = async (select, options) => {
if (select) {
const { beforeEach = noop, check = noop, afterEach = noop, filter } = options || {};
const selectOptions = getSelectOptions(select);
const selectOptionsReversed = getSelectOptions(select).reverse();
const iterateOptions = [...selectOptions, ...selectOptionsReversed].filter(filter || (() => true));
for (let i = 0; i < iterateOptions.length; i++) {
const option = iterateOptions[i];
// eslint-disable-next-line
const beforeEachObj = await beforeEach();
if (selectOption(select, option)) {
// eslint-disable-next-line
await check(beforeEachObj, option);
// eslint-disable-next-line
await afterEach();
}
}
}
};
//# sourceMappingURL=select.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"select.js","sourceRoot":"","sources":["../src/select.ts"],"names":[],"mappings":"AAAA,SAAS,OAAO,CAAC,GAAQ;IACvB,OAAO,GAAG,YAAY,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;AAC9C,CAAC;AAED,2BAA2B;AAC3B,MAAM,IAAI,GAAG,GAAS,EAAE;IACtB,OAAO,EAAO,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,aAAgC,EAAE,EAAE,CAC5D,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,sBAAsB,GACjC,CACE,UAA8C,EAC9C,QAIQ,EACR,EAAE,CACJ,CAAC,KAAuC,EAAE,EAAE;IAC1C,MAAM,MAAM,GAA6B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YAC9C,MAAM,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;YACjC,2BAA2B;YAC3B,MAAM,aAAa,GAAM,MAAM,UAAU,EAAE,CAAC;YAC5C,IAAI,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE;gBAChC,2BAA2B;gBAC3B,MAAM,KAAK,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;gBACnC,2BAA2B;gBAC3B,MAAM,SAAS,EAAE,CAAC;aACnB;SACF;KACF;AACH,CAAC,CAAC"}
-4
View File
@@ -1,4 +0,0 @@
import { waitForOptions } from '@testing-library/dom';
export declare const setTestResult: (result: boolean | null) => void;
export declare const testPassed: () => boolean;
export declare const waitForOrFailTest: <T>(callback: () => T | Promise<T>, options?: waitForOptions) => Promise<T>;
-30
View File
@@ -1,30 +0,0 @@
import { waitFor } from '@testing-library/dom';
const getTestResultElm = () => document.getElementById('testResult');
export const setTestResult = (result) => {
const elm = getTestResultElm();
if (elm) {
if (typeof result === 'boolean') {
if (result) {
if (elm.getAttribute('class') === 'failed') {
return;
}
}
elm.setAttribute('class', result ? 'passed' : 'failed');
}
else {
elm.removeAttribute('class');
}
}
};
export const testPassed = () => {
const elm = getTestResultElm();
return elm ? elm.getAttribute('class') === 'passed' : false;
};
export const waitForOrFailTest = (callback, options) => waitFor(callback, {
...options,
onTimeout(error) {
setTestResult(false);
return error;
},
});
//# sourceMappingURL=testResult.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"testResult.js","sourceRoot":"","sources":["../src/testResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,sBAAsB,CAAC;AAE/D,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;AAErE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAsB,EAAE,EAAE;IACtD,MAAM,GAAG,GAAG,gBAAgB,EAAE,CAAC;IAC/B,IAAI,GAAG,EAAE;QACP,IAAI,OAAO,MAAM,KAAK,SAAS,EAAE;YAC/B,IAAI,MAAM,EAAE;gBACV,IAAI,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE;oBAC1C,OAAO;iBACR;aACF;YACD,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;SACzD;aAAM;YACL,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;SAC9B;KACF;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,GAAY,EAAE;IACtC,MAAM,GAAG,GAAG,gBAAgB,EAAE,CAAC;IAC/B,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;AAC9D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAI,QAA8B,EAAE,OAAwB,EAAE,EAAE,CAC/F,OAAO,CAAC,QAAQ,EAAE;IAChB,GAAG,OAAO;IACV,SAAS,CAAC,KAAY;QACpB,aAAa,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC,CAAC"}
-1
View File
@@ -1 +0,0 @@
export declare const timeout: (ms: number) => Promise<unknown>;
-4
View File
@@ -1,4 +0,0 @@
export const timeout = (ms) => new Promise((resolve) => {
setTimeout(resolve, ms);
});
//# sourceMappingURL=timeout.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"timeout.js","sourceRoot":"","sources":["../src/timeout.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAU,EAAE,EAAE,CACpC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;IACtB,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC,CAAC,CAAC"}
-4
View File
@@ -1,4 +0,0 @@
export * from './select';
export * from './testResult';
export * from './timeout';
export * from './resize';
-5
View File
@@ -1,5 +0,0 @@
export * from './select';
export * from './testResult';
export * from './timeout';
export * from './resize';
//# sourceMappingURL=index.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
-28
View File
@@ -1,28 +0,0 @@
declare type ClassContainingElement = Node | Element | false | null | undefined;
declare type ClassName = string | false | null | undefined;
/**
* 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: ClassContainingElement, className: ClassName) => boolean;
/**
* 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: ClassContainingElement, className: ClassName) => void;
/**
* 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)
* @returns A function which removes the added class name(s).
*/
export declare const addClass: (elm: ClassContainingElement, className: ClassName) => (() => 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: ClassName, classNameB: ClassName) => string[];
export {};
-65
View File
@@ -1,65 +0,0 @@
import { isString } from '../utils/types';
import { each } from '../utils/array';
import { keys } from '../utils/object';
const rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
const classListAction = (elm, className, action) => {
const classList = elm && elm.classList;
let clazz;
let i = 0;
let result = false;
if (classList && className && isString(className)) {
const classes = className.match(rnothtmlwhite) || [];
result = classes.length > 0;
while ((clazz = classes[i++])) {
result = !!action(classList, clazz) && result;
}
}
return result;
};
/**
* Check whether the given element has the given class name(s).
* @param elm The element.
* @param className The class name(s).
*/
export const hasClass = (elm, className) => classListAction(elm, className, (classList, clazz) => classList.contains(clazz));
/**
* 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 const removeClass = (elm, className) => {
classListAction(elm, className, (classList, clazz) => classList.remove(clazz));
};
/**
* 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)
* @returns A function which removes the added class name(s).
*/
export const addClass = (elm, className) => {
classListAction(elm, className, (classList, clazz) => classList.add(clazz));
return removeClass.bind(0, elm, className);
};
/**
* Takes two className strings, compares them and returns the difference as array.
* @param classNameA ClassName A.
* @param classNameB ClassName B.
*/
export const diffClass = (classNameA, classNameB) => {
const classNameASplit = classNameA && classNameA.split(' ');
const classNameBSplit = classNameB && classNameB.split(' ');
const tempObj = {};
each(classNameASplit, (className) => {
tempObj[className] = 1;
});
each(classNameBSplit, (className) => {
if (tempObj[className]) {
delete tempObj[className];
}
else {
tempObj[className] = 1;
}
});
return keys(tempObj);
};
//# sourceMappingURL=class.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"class.js","sourceRoot":"","sources":["../../../src/support/dom/class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAKvC,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAC1C,MAAM,eAAe,GAAG,CACtB,GAA2B,EAC3B,SAAoB,EACpB,MAAqE,EAC5D,EAAE;IACX,MAAM,SAAS,GAAG,GAAG,IAAK,GAAe,CAAC,SAAS,CAAC;IACpD,IAAI,KAAa,CAAC;IAClB,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,IAAI,MAAM,GAAG,KAAK,CAAC;IAEnB,IAAI,SAAS,IAAI,SAAS,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE;QACjD,MA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e,GAAG,UAAU,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5D,MAAM,eAAe,GAAG,UAAU,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,EAAE,CAAC;IAEnB,IAAI,CAAC,eAAe,EAAE,CAAC,SAAS,EAAE,EAAE;QAClC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,eAAe,EAAE,CAAC,SAAS,EAAE,EAAE;QAClC,IAAI,OAAO,CAAC,SAAS,CAAC,EAAE;YACtB,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;SAC3B;aAAM;YACL,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;SACxB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC,CAAC"}
-9
View File
@@ -1,9 +0,0 @@
/**
* Creates a div DOM node.
*/
export declare const createDiv: (classNames?: string) => 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>;
-23
View File
@@ -1,23 +0,0 @@
import { each } from '../utils/array';
import { contents } from './traversal';
import { removeElements } from './manipulation';
/**
* Creates a div DOM node.
*/
export const createDiv = (classNames) => {
const div = document.createElement('div');
if (classNames) {
div.setAttribute('class', classNames);
}
return div;
};
/**
* 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 const createDOM = (html) => {
const createdDiv = createDiv();
createdDiv.innerHTML = html.trim();
return each(contents(createdDiv), (elm) => removeElements(elm));
};
//# sourceMappingURL=create.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/support/dom/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,UAAmB,EAAkB,EAAE;IAC/D,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,UAAU,EAAE;QACd,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;KACvC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAuB,EAAE;IAC7D,MAAM,UAAU,GAAG,SAAS,EAAE,CAAC;IAC/B,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAEnC,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;AAClE,CAAC,CAAC"}
-33
View File
@@ -1,33 +0,0 @@
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 | false | 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 | false | 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 | false | null | undefined) => boolean;
-53
View File
@@ -1,53 +0,0 @@
const elementHasDimensions = (elm) => !!(elm.offsetWidth || elm.offsetHeight || elm.getClientRects().length);
const zeroObj = {
w: 0,
h: 0,
};
/**
* Returns the window inner- width and height.
*/
export const windowSize = () => ({
w: window.innerWidth,
h: window.innerHeight,
});
/**
* 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 const offsetSize = (elm) => elm
? {
w: elm.offsetWidth,
h: elm.offsetHeight,
}
: zeroObj;
/**
* 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 const clientSize = (elm) => elm
? {
w: elm.clientWidth,
h: elm.clientHeight,
}
: zeroObj;
/**
* 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 const scrollSize = (elm) => elm
? {
w: elm.scrollWidth,
h: elm.scrollHeight,
}
: zeroObj;
/**
* Returns the BoundingClientRect of the passed element.
* @param elm The element of which the BoundingClientRect shall be returned.
*/
export const getBoundingClientRect = (elm) => elm.getBoundingClientRect();
/**
* Determines whether the passed element has any dimensions.
* @param elm The element.
*/
export const hasDimensions = (elm) => elm ? elementHasDimensions(elm) : false;
//# sourceMappingURL=dimensions.js.map
@@ -1 +0,0 @@
{"version":3,"file":"dimensions.js","sourceRoot":"","sources":["../../../src/support/dom/dimensions.ts"],"names":[],"mappings":"AAKA,MAAM,oBAAoB,GAAG,CAAC,GAAgB,EAAW,EAAE,CACzD,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC,CAAC;AACzE,MAAM,OAAO,GAAO;IAClB,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;CACL,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAO,EAAE,CAAC,CAAC;IACnC,CAAC,EAAE,MAAM,CAAC,UAAU;IACpB,CAAC,EAAE,MAAM,CAAC,WAAW;CACtB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAmC,EAAM,EAAE,CACpE,GAAG;IACD,CAAC,CAAC;QACE,CAAC,EAAE,GAAG,CAAC,WAAW;QAClB,CAAC,EAAE,GAAG,CAAC,YAAY;KACpB;IACH,CAAC,CAAC,OAAO,CAAC;AAEd;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAA2C,EAAM,EAAE,CAC5E,GAAG;IACD,CAAC,CAAC;QACE,CAAC,EAAE,GAAG,CAAC,WAAW;QAClB,CAAC,EAAE,GAAG,CAAC,YAAY;KACpB;IACH,CAAC,CAAC,OAAO,CAAC;AAEd;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAA2C,EAAM,EAAE,CAC5E,GAAG;IACD,CAAC,CAAC;QACE,CAAC,EAAE,GAAG,CAAC,WAAW;QAClB,CAAC,EAAE,GAAG,CAAC,YAAY;KACpB;IACH,CAAC,CAAC,OAAO,CAAC;AAEd;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,GAAgB,EAAW,EAAE,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;AAEhG;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAA2C,EAAW,EAAE,CACpF,GAAG,CAAC,CAAC,CAAC,oBAAoB,CAAC,GAAkB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC"}
-36
View File
@@ -1,36 +0,0 @@
export interface OnOptions {
_capture?: boolean;
_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: <T extends Event = Event>(target: EventTarget, eventNames: string, listener: (event: T) => any, capture?: boolean) => 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: <T extends Event = Event>(target: EventTarget, eventNames: string, listener: (event: T) => any, options?: OnOptions) => (() => 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;
/**
* Shorthand for the stopPropagation and preventDefault event Method.
* @param evt The event of which the stopPropagation and preventDefault methods shall be called.
*/
export declare const stopAndPrevent: (evt: Event) => void;
-80
View File
@@ -1,80 +0,0 @@
import { isUndefined } from '../utils/types';
import { each, push, runEachAndClear } from '../utils/array';
let passiveEventsSupport;
const supportPassiveEvents = () => {
if (isUndefined(passiveEventsSupport)) {
passiveEventsSupport = false;
try {
/* eslint-disable */
// @ts-ignore
window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
get() {
passiveEventsSupport = true;
},
}));
/* eslint-enable */
}
catch (e) { }
}
return passiveEventsSupport;
};
const splitEventNames = (eventNames) => eventNames.split(' ');
/**
* 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 const off = (target, eventNames, listener, capture) => {
each(splitEventNames(eventNames), (eventName) => {
target.removeEventListener(eventName, listener, capture);
});
};
/**
* 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 const on = (target, eventNames, listener, options) => {
const doSupportPassiveEvents = supportPassiveEvents();
const passive = (doSupportPassiveEvents && options && options._passive) ?? doSupportPassiveEvents;
const capture = (options && options._capture) || false;
const once = (options && options._once) || false;
const offListeners = [];
const nativeOptions = doSupportPassiveEvents
? {
passive,
capture,
}
: capture;
each(splitEventNames(eventNames), (eventName) => {
const finalListener = (once
? (evt) => {
target.removeEventListener(eventName, finalListener, capture);
listener && listener(evt);
}
: listener);
push(offListeners, off.bind(null, target, eventName, finalListener, capture));
target.addEventListener(eventName, finalListener, nativeOptions);
});
return runEachAndClear.bind(0, offListeners);
};
/**
* Shorthand for the stopPropagation event Method.
* @param evt The event of which the stopPropagation method shall be called.
*/
export const stopPropagation = (evt) => evt.stopPropagation();
/**
* Shorthand for the preventDefault event Method.
* @param evt The event of which the preventDefault method shall be called.
*/
export const preventDefault = (evt) => evt.preventDefault();
/**
* Shorthand for the stopPropagation and preventDefault event Method.
* @param evt The event of which the stopPropagation and preventDefault methods shall be called.
*/
export const stopAndPrevent = (evt) => stopPropagation(evt) || preventDefault(evt);
//# sourceMappingURL=events.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/support/dom/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE7D,IAAI,oBAA6B,CAAC;AAClC,MAAM,oBAAoB,GAAG,GAAY,EAAE;IACzC,IAAI,WAAW,CAAC,oBAAoB,CAAC,EAAE;QACrC,oBAAoB,GAAG,KAAK,CAAC;QAC7B,IAAI;YACF,oBAAoB;YACpB,aAAa;YACb,MAAM,CAAC,gBAAgB,CACrB,MAAM,EACN,IAAI,EACJ,MAAM,CAAC,cAAc,CAAC,EAAE,EAAE,SAAS,EAAE;gBACnC,GAAG;oBACD,oBAAoB,G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GAAG,CACpB,IAAI;YACF,CAAC,CAAC,CAAC,GAAM,EAAE,EAAE;gBACT,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;gBAC9D,QAAQ,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC;YAC5B,CAAC;YACH,CAAC,CAAC,QAAQ,CACI,CAAC;QAEnB,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;QAC9E,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAU,EAAQ,EAAE,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC;AAE3E;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAU,EAAQ,EAAE,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC;AAEzE;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAU,EAAQ,EAAE,CAChD,eAAe,CAAC,GAAG,CAAe,IAAK,cAAc,CAAC,GAAG,CAAe,CAAC"}
-8
View File
@@ -1,8 +0,0 @@
export * from './class';
export * from './create';
export * from './dimensions';
export * from './events';
export * from './style';
export * from './manipulation';
export * from './offset';
export * from './traversal';
-9
View File
@@ -1,9 +0,0 @@
export * from './class';
export * from './create';
export * from './dimensions';
export * from './events';
export * from './style';
export * from './manipulation';
export * from './offset';
export * from './traversal';
//# sourceMappingURL=index.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/support/dom/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
@@ -1,31 +0,0 @@
declare type NodeCollection = ArrayLike<Node> | Node | false | 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 | false | 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 | false | 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 | false | 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 | false | 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 {};
-86
View File
@@ -1,86 +0,0 @@
import { isArrayLike } from '../utils/types';
import { each, from } from '../utils/array';
import { parent } from './traversal';
/**
* Inserts Nodes before the given preferredAnchor element.
* @param parentElm The parent of the preferredAnchor element or the element which shall be the parent of the inserted Nodes.
* @param preferredAnchor The element before which the Nodes shall be inserted or null if the elements shall be appended at the end.
* @param insertedElms The Nodes which shall be inserted.
*/
const before = (parentElm, preferredAnchor, insertedElms) => {
if (insertedElms && parentElm) {
let anchor = preferredAnchor;
let fragment;
if (isArrayLike(insertedElms)) {
fragment = document.createDocumentFragment();
// append all insertedElms to the fragment and if one of these is the anchor, change the anchor
each(insertedElms, (insertedElm) => {
if (insertedElm === anchor) {
anchor = insertedElm.previousSibling;
}
fragment.appendChild(insertedElm);
});
}
else {
fragment = insertedElms;
}
// if the preferred anchor isn't null set it to a valid anchor
if (preferredAnchor) {
if (!anchor) {
anchor = parentElm.firstChild;
}
else if (anchor !== preferredAnchor) {
anchor = anchor.nextSibling;
}
}
parentElm.insertBefore(fragment, anchor || null);
}
};
/**
* 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 const appendChildren = (node, children) => {
before(node, null, children);
};
/**
* 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 const prependChildren = (node, children) => {
before(node, node && node.firstChild, children);
};
/**
* 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 const insertBefore = (node, insertedNodes) => {
before(parent(node), node, insertedNodes);
};
/**
* 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 const insertAfter = (node, insertedNodes) => {
before(parent(node), node && node.nextSibling, insertedNodes);
};
/**
* Removes the given Nodes from their parent.
* @param nodes The Nodes which shall be removed.
*/
export const removeElements = (nodes) => {
if (isArrayLike(nodes)) {
each(from(nodes), (e) => removeElements(e));
}
else if (nodes) {
const parentElm = parent(nodes);
if (parentElm) {
parentElm.removeChild(nodes);
}
}
};
//# sourceMappingURL=manipulation.js.map
@@ -1 +0,0 @@
{"version":3,"file":"manipulation.js","sourceRoot":"","sources":["../../../src/support/dom/manipulation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC;;;;;GAKG;AACH,MAAM,M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M,CAAC,MAAM,YAAY,GAAG,CAC1B,IAAqC,EACrC,aAA6B,EACvB,EAAE;IACR,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,IAAqC,EACrC,aAA6B,EACvB,EAAE;IACR,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAqB,EAAQ,EAAE;IAC5D,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE;QACtB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;KAC7C;SAAM,IAAI,KAAK,EAAE;QAChB,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,SAAS,EAAE;YACb,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;SAC9B;KACF;AACH,CAAC,CAAC"}
-14
View File
@@ -1,14 +0,0 @@
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;
-29
View File
@@ -1,29 +0,0 @@
import { getBoundingClientRect } from './dimensions';
const zeroObj = {
x: 0,
y: 0,
};
/**
* 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 const absoluteCoordinates = (elm) => {
const rect = elm ? getBoundingClientRect(elm) : 0;
return rect
? {
x: rect.left + window.pageYOffset,
y: rect.top + window.pageXOffset,
}
: zeroObj;
};
/**
* 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 const offsetCoordinates = (elm) => elm
? {
x: elm.offsetLeft,
y: elm.offsetTop,
}
: zeroObj;
//# sourceMappingURL=offset.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"offset.js","sourceRoot":"","sources":["../../../src/support/dom/offset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAOrD,MAAM,OAAO,GAAO;IAClB,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;CACL,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAmC,EAAM,EAAE;IAC7E,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD,OAAO,IAAI;QACT,CAAC,CAAC;YACE,CAAC,EAAE,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,WAAW;YACjC,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,WAAW;SACjC;QACH,CAAC,CAAC,OAAO,CAAC;AACd,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAmC,EAAM,EAAE,CAC3E,GAAG;IACD,CAAC,CAAC;QACE,CAAC,EAAE,GAAG,CAAC,UAAU;QACjB,CAAC,EAAE,GAAG,CAAC,SAAS;KACjB;IACH,CAAC,CAAC,OAAO,CAAC"}
-37
View File
@@ -1,37 +0,0 @@
export interface TRBL {
t: number;
r: number;
b: number;
l: number;
}
declare type StyleObject<CustomCssProps = ''> = {
[Key in keyof CSSStyleDeclaration | (CustomCssProps extends string ? CustomCssProps : '')]?: 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<CustomCssProps>(elm: HTMLElement | false | null | undefined, styles: StyleObject<CustomCssProps>): void;
export declare function style(elm: HTMLElement | false | null | undefined, styles: string): string;
export declare function style(elm: HTMLElement | false | 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 | false | null | undefined) => void;
/**
* Shows the passed element (display: block).
* @param elm The element which shall be shown.
*/
export declare const show: (elm: HTMLElement | false | null | undefined) => void;
/**
* Returns the top right bottom left values of the passed css property.
* @param elm The element of which the values shall be returned.
* @param propertyPrefix The css property prefix. (e.g. "border")
* @param propertySuffix The css property suffix. (e.g. "width")
*/
export declare const topRightBottomLeft: (elm?: HTMLElement | false | null | undefined, propertyPrefix?: string, propertySuffix?: string) => TRBL;
export {};
-96
View File
@@ -1,96 +0,0 @@
import { each, keys } from '../utils';
import { isString, isNumber, isArray, isUndefined } from '../utils/types';
const cssNumber = {
// animationiterationcount: 1,
// columncount: 1,
// fillopacity: 1,
// flexgrow: 1,
// flexshrink: 1,
// fontweight: 1,
// lineheight: 1,
// order: 1,
// orphans: 1,
// widows: 1,
// zoom: 1,
opacity: 1,
zindex: 1,
};
const parseToZeroOrNumber = (value, toFloat) => {
/* istanbul ignore next */
const num = toFloat ? parseFloat(value) : parseInt(value, 10);
// num === num means num is not NaN
/* istanbul ignore next */
return num === num ? num : 0; // eslint-disable-line no-self-compare
};
const adaptCSSVal = (prop, val) => !cssNumber[prop.toLowerCase()] && isNumber(val) ? `${val}px` : val;
const getCSSVal = (elm, computedStyle, prop) =>
/* istanbul ignore next */
computedStyle != null
? computedStyle[prop] || computedStyle.getPropertyValue(prop)
: elm.style[prop];
const setCSSVal = (elm, prop, val) => {
try {
const { style: elmStyle } = elm;
if (!isUndefined(elmStyle[prop])) {
elmStyle[prop] = adaptCSSVal(prop, val);
}
else {
elmStyle.setProperty(prop, val);
}
}
catch (e) { }
};
export function style(elm, styles) {
const getSingleStyle = isString(styles);
const getStyles = isArray(styles) || getSingleStyle;
if (getStyles) {
let getStylesResult = getSingleStyle ? '' : {};
if (elm) {
const computedStyle = window.getComputedStyle(elm, null);
getStylesResult = getSingleStyle
? getCSSVal(elm, computedStyle, styles)
: styles.reduce((result, key) => {
result[key] = getCSSVal(elm, computedStyle, key);
return result;
}, getStylesResult);
}
return getStylesResult;
}
elm && each(keys(styles), (key) => setCSSVal(elm, key, styles[key]));
}
/**
* Hides the passed element (display: none).
* @param elm The element which shall be hidden.
*/
export const hide = (elm) => {
style(elm, { display: 'none' });
};
/**
* Shows the passed element (display: block).
* @param elm The element which shall be shown.
*/
export const show = (elm) => {
style(elm, { display: 'block' });
};
/**
* Returns the top right bottom left values of the passed css property.
* @param elm The element of which the values shall be returned.
* @param propertyPrefix The css property prefix. (e.g. "border")
* @param propertySuffix The css property suffix. (e.g. "width")
*/
export const topRightBottomLeft = (elm, propertyPrefix, propertySuffix) => {
const finalPrefix = propertyPrefix ? `${propertyPrefix}-` : '';
const finalSuffix = propertySuffix ? `-${propertySuffix}` : '';
const top = `${finalPrefix}top${finalSuffix}`;
const right = `${finalPrefix}right${finalSuffix}`;
const bottom = `${finalPrefix}bottom${finalSuffix}`;
const left = `${finalPrefix}left${finalSuffix}`;
const result = style(elm, [top, right, bottom, left]);
return {
t: parseToZeroOrNumber(result[top]),
r: parseToZeroOrNumber(result[right]),
b: parseToZeroOrNumber(result[bottom]),
l: parseToZeroOrNumber(result[left]),
};
};
//# sourceMappingURL=style.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/support/dom/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,U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CAAC,MAAM,CAAC,CAAC;QACtC,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KACrC,CAAC;AACJ,CAAC,CAAC"}
-45
View File
@@ -1,45 +0,0 @@
declare type InputElementType = Node | Element | Node | false | null | undefined;
declare type OutputElementType = Node | 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) => 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;
declare const closest: (elm: InputElementType, selector: string) => 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, closest };
-93
View File
@@ -1,93 +0,0 @@
import { isElement } from '../utils/types';
import { push, from } from '../utils/array';
const elmPrototype = Element.prototype;
/**
* 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.
*/
const find = (selector, elm) => {
const arr = [];
const rootElm = elm ? (isElement(elm) ? elm : null) : document;
return rootElm ? push(arr, rootElm.querySelectorAll(selector)) : arr;
};
/**
* 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.
*/
const findFirst = (selector, elm) => {
const rootElm = elm ? (isElement(elm) ? elm : null) : document;
return rootElm ? rootElm.querySelector(selector) : null;
};
/**
* 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'.
*/
const is = (elm, selector) => {
if (isElement(elm)) {
/* istanbul ignore next */
// eslint-disable-next-line
// @ts-ignore
const fn = elmPrototype.matches || elmPrototype.msMatchesSelector;
return fn.call(elm, selector);
}
return false;
};
/**
* 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.
*/
const children = (elm, selector) => {
const childs = [];
return isElement(elm)
? push(childs, from(elm.children).filter((child) => (selector ? is(child, selector) : child)))
: childs;
};
/**
* 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.
*/
const contents = (elm) => elm ? from(elm.childNodes) : [];
/**
* 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.
*/
const parent = (elm) => (elm ? elm.parentElement : null);
const closest = (elm, selector) => {
if (isElement(elm)) {
const closestFn = elmPrototype.closest;
if (closestFn) {
return closestFn.call(elm, selector);
}
do {
if (is(elm, selector)) {
return elm;
}
elm = parent(elm);
} while (elm);
}
return null;
};
/**
* 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.
*/
const liesBetween = (elm, highBoundarySelector, deepBoundarySelector) => {
const closestHighBoundaryElm = elm && closest(elm, highBoundarySelector);
const closestDeepBoundaryElm = elm && findFirst(deepBoundarySelector, closestHighBoundaryElm);
const deepBoundaryIsValid = closest(closestDeepBoundaryElm, highBoundarySelector) === closestHighBoundaryElm;
return closestHighBoundaryElm && closestDeepBoundaryElm
? closestHighBoundaryElm === elm ||
closestDeepBoundaryElm === elm ||
(deepBoundaryIsValid &&
closest(closest(elm, deepBoundarySelector), highBoundarySelector) !==
closestHighBoundaryElm)
: false;
};
export { find, findFirst, is, children, contents, parent, liesBetween, closest };
//# sourceMappingURL=traversal.js.map
@@ -1 +0,0 @@
{"version":3,"file":"traversal.js","sourceRoot":"","sources":["../../../src/support/dom/traversal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAK5C,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC;AAEvC;;;;GAIG;AACH,MAAM,IAAI,GAAG,CAAC,QAAgB,EAAE,GAAsB,EAAa,EAAE;IACnE,MAAM,GAAG,GAAmB,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAE/D,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACvE,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,SAAS,GAAG,CAAC,QAAgB,EAAE,GAA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CAAC,KAAK,CAAC;AACZ,CAAC,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC"}
-2
View File
@@ -1,2 +0,0 @@
export * from './dom';
export * from './utils';
-3
View File
@@ -1,3 +0,0 @@
export * from './dom';
export * from './utils';
//# sourceMappingURL=index.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/support/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC"}
-46
View File
@@ -1,46 +0,0 @@
declare type PlainObject = Record<string, any>;
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 | unknown): Array<T> | ReadonlyArray<T>;
export declare function each<T>(array: Array<T> | ReadonlyArray<T> | false | null | undefined, callback: (value: T, indexOrKey: number, source: Array<T>) => boolean | unknown): Array<T> | ReadonlyArray<T> | false | null | undefined;
export declare function each<T>(arrayLikeObject: ArrayLike<T>, callback: (value: T, indexOrKey: number, source: ArrayLike<T>) => boolean | unknown): ArrayLike<T>;
export declare function each<T>(arrayLikeObject: ArrayLike<T> | false | null | undefined, callback: (value: T, indexOrKey: number, source: ArrayLike<T>) => boolean | unknown): ArrayLike<T> | false | null | undefined;
export declare function each(obj: PlainObject, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | unknown): PlainObject;
export declare function each(obj: PlainObject | false | null | undefined, callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | unknown): PlainObject | false | 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) => 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) => 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> | Set<T> | undefined) => T[];
/**
* Check whether the passed array is empty.
* @param array The array which shall be checked.
*/
export declare const isEmptyArray: (array: any[] | null | undefined) => boolean;
/**
* Calls all functions in the passed array/set of functions.
* @param arr The array filled with function which shall be called.
* @param args The args with which each function is called.
* @param keep True when the Set / array should not be cleared afterwards, false otherwise.
*/
export declare const runEachAndClear: (arr: RunEachItem[], args?: any[], keep?: boolean) => void;
export {};
-73
View File
@@ -1,73 +0,0 @@
import { isArrayLike, isString } from './types';
export function each(source, callback) {
if (isArrayLike(source)) {
for (let i = 0; i < source.length; i++) {
if (callback(source[i], i, source) === false) {
break;
}
}
}
else if (source) {
// cant use support func keys here due to circular dep
each(Object.keys(source), (key) => callback(source[key], key, source));
}
return source;
}
/**
* 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 const indexOf = (arr, item, fromIndex) => arr.indexOf(item, fromIndex);
/**
* 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 const push = (array, items, arrayIsSingleItem) => {
!arrayIsSingleItem && !isString(items) && isArrayLike(items)
? Array.prototype.push.apply(array, items)
: array.push(items);
return array;
};
/**
* 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 const from = (arr) => {
const original = Array.from;
const result = [];
if (original && arr) {
return original(arr);
}
if (arr instanceof Set) {
arr.forEach((value) => {
push(result, value);
});
}
else {
each(arr, (elm) => {
push(result, elm);
});
}
return result;
};
/**
* Check whether the passed array is empty.
* @param array The array which shall be checked.
*/
export const isEmptyArray = (array) => !!array && array.length === 0;
/**
* Calls all functions in the passed array/set of functions.
* @param arr The array filled with function which shall be called.
* @param args The args with which each function is called.
* @param keep True when the Set / array should not be cleared afterwards, false otherwise.
*/
export const runEachAndClear = (arr, args, keep) => {
// eslint-disable-next-line prefer-spread
const runFn = (fn) => fn && fn.apply(undefined, args || []);
each(arr, runFn);
!keep && (arr.length = 0);
};
//# sourceMappingURL=array.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/support/utils/array.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAqChD,MAAM,UAAU,IAAI,CAClB,MAA2F,EAC3F,QAAuE;IAEvE,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;QACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,KAAK,KAAK,EAAE;gBAC5C,MAAM;aACP;SACF;KACF;SAAM,IAAI,MAAM,EAAE;QACjB,sDAAsD;QACtD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;KACxE;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAU,GAAQ,EAAE,IAAO,EAAE,SAAkB,EAAU,EAAE,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AAG,CAAC,GAAkB,EAAE,IAAY,EAAE,IAAc,EAAQ,EAAE;IACxF,yCAAyC;IACzC,MAAM,KAAK,GAAG,CAAC,EAAe,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;IACzE,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACjB,CAAC,IAAI,IAAI,CAAE,GAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACvC,CAAC,CAAC"}
-3
View File
@@ -1,3 +0,0 @@
export * from './array';
export * from './object';
export * from './types';
-4
View File
@@ -1,4 +0,0 @@
export * from './array';
export * from './object';
export * from './types';
//# sourceMappingURL=index.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/support/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
-26
View File
@@ -1,26 +0,0 @@
/**
* 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>;
declare type AssignDeep = {
<T, U>(target: T, object1: U): T & U;
<T, U, V>(target: T, object1: U, object2: V): T & U & V;
<T, U, V, W>(target: T, object1: U, object2: V, object3: W): T & U & V & W;
<T, U, V, W, X>(target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X;
<T, U, V, W, X, Y>(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y;
<T, U, V, W, X, Y, Z>(target: T, object1?: U, object2?: V, object3?: W, object4?: X, object5?: Y, object6?: Z): T & U & V & W & X & Y & Z;
};
export declare const assignDeep: AssignDeep;
/**
* Returns true if the given object is empty, false otherwise.
* @param obj The Object.
*/
export declare const isEmptyObject: (obj: any) => boolean;
export {};
-65
View File
@@ -1,65 +0,0 @@
import { isArray, isFunction, isPlainObject, isNull } from './types';
import { each } from './array';
/**
* Determines whether the passed object has a property with the passed name.
* @param obj The object.
* @param prop The name of the property.
*/
export const hasOwnProperty = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
/**
* 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 const keys = (obj) => (obj ? Object.keys(obj) : []);
// https://github.com/jquery/jquery/blob/master/src/core.js#L116
export const assignDeep = (target, object1, object2, object3, object4, object5, object6) => {
const sources = [object1, object2, object3, object4, object5, object6];
// Handle case when target is a string or something (possible in deep copy)
if ((typeof target !== 'object' || isNull(target)) && !isFunction(target)) {
target = {};
}
each(sources, (source) => {
// Extend the base object
each(keys(source), (key) => {
const copy = source[key];
// Prevent Object.prototype pollution
// Prevent never-ending loop
if (target === copy) {
return true;
}
const copyIsArray = isArray(copy);
// Recurse if we're merging plain objects or arrays
if (copy && (isPlainObject(copy) || copyIsArray)) {
const src = target[key];
let clone = src;
// Ensure proper type for the source value
if (copyIsArray && !isArray(src)) {
clone = [];
}
else if (!copyIsArray && !isPlainObject(src)) {
clone = {};
}
// Never move original objects, clone them
target[key] = assignDeep(clone, copy);
}
else {
target[key] = copy;
}
});
});
// Return the modified object
return target;
};
/**
* Returns true if the given object is empty, false otherwise.
* @param obj The Object.
*/
export const isEmptyObject = (obj) => {
/* eslint-disable no-restricted-syntax, guard-for-in */
// eslint-disable-next-line no-unreachable-loop
for (const name in obj)
return false;
return true;
/* eslint-enable */
};
//# sourceMappingURL=object.js.map
@@ -1 +0,0 @@
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../../src/support/utils/object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,SA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gBAChD,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;gBACxB,IAAI,KAAK,GAAQ,GAAG,CAAC;gBAErB,0CAA0C;gBAC1C,IAAI,WAAW,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;oBAChC,KAAK,GAAG,EAAE,CAAC;iBACZ;qBAAM,IAAI,CAAC,WAAW,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE;oBAC9C,KAAK,GAAG,EAAE,CAAC;iBACZ;gBAED,0CAA0C;gBAC1C,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,IAAI,CAAQ,CAAC;aAC9C;iBAAM;gBACL,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;aACpB;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,6BAA6B;IAC7B,OAAO,MAAa,CAAC;AACvB,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAQ,EAAW,EAAE;IACjD,uDAAuD;IACvD,+CAA+C;IAC/C,KAAK,MAAM,IAAI,IAAI,GAAG;QAAE,OAAO,KAAK,CAAC;IACrC,OAAO,IAAI,CAAC;IACZ,mBAAmB;AACrB,CAAC,CAAC"}
-31
View File
@@ -1,31 +0,0 @@
declare type PlainObject<T = any> = Record<string, T>;
export declare const isUndefined: (obj: any) => obj is undefined;
export declare const isNull: (obj: any) => obj is null;
export declare const type: (obj: any) => string;
export declare const isNumber: (obj: any) => obj is number;
export declare const isString: (obj: any) => obj is string;
export declare const isBoolean: (obj: any) => obj is boolean;
export declare const isFunction: (obj: any) => obj is (...args: any[]) => any;
export declare const isArray: <T = any>(obj: any) => obj is T[];
export declare const isObject: (obj: any) => boolean;
/**
* Returns true if the given object is array like, false otherwise.
* @param obj The Object
*/
export declare const isArrayLike: <T extends PlainObject<any> = 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 const 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 const isHTMLElement: (obj: any) => obj is HTMLElement;
/**
* Checks whether the given object is a Element.
* @param obj The object which shall be checked.
*/
export declare const isElement: (obj: any) => obj is Element;
export {};
-77
View File
@@ -1,77 +0,0 @@
const ElementNodeType = Node.ELEMENT_NODE;
const { toString, hasOwnProperty } = Object.prototype;
export const isUndefined = (obj) => obj === undefined;
export const isNull = (obj) => obj === null;
export const type = (obj) => isUndefined(obj) || isNull(obj)
? `${obj}`
: toString
.call(obj)
.replace(/^\[object (.+)\]$/, '$1')
.toLowerCase();
export const isNumber = (obj) => typeof obj === 'number';
export const isString = (obj) => typeof obj === 'string';
export const isBoolean = (obj) => typeof obj === 'boolean';
export const isFunction = (obj) => typeof obj === 'function';
export const isArray = (obj) => Array.isArray(obj);
export const isObject = (obj) => typeof obj === 'object' && !isArray(obj) && !isNull(obj);
/**
* Returns true if the given object is array like, false otherwise.
* @param obj The Object
*/
export const isArrayLike = (obj) => {
const length = !!obj && obj.length;
const lengthCorrectFormat = isNumber(length) && length > -1 && length % 1 == 0; // eslint-disable-line eqeqeq
return isArray(obj) || (!isFunction(obj) && lengthCorrectFormat)
? length > 0 && isObject(obj)
? length - 1 in obj
: true
: false;
};
/**
* Returns true if the given object is a "plain" (e.g. { key: value }) object, false otherwise.
* @param obj The Object.
*/
export const isPlainObject = (obj) => {
if (!obj || !isObject(obj) || type(obj) !== 'object')
return false;
let key;
const cstr = 'constructor';
const ctor = obj[cstr];
const ctorProto = ctor && ctor.prototype;
const hasOwnConstructor = hasOwnProperty.call(obj, cstr);
const hasIsPrototypeOf = ctorProto && hasOwnProperty.call(ctorProto, 'isPrototypeOf');
if (ctor && !hasOwnConstructor && !hasIsPrototypeOf) {
return false;
}
/* eslint-disable no-restricted-syntax */
for (key in obj) {
/**/
}
/* eslint-enable */
return isUndefined(key) || hasOwnProperty.call(obj, key);
};
/**
* Checks whether the given object is a HTMLElement.
* @param obj The object which shall be checked.
*/
export const isHTMLElement = (obj) => {
const instanceofObj = HTMLElement;
return obj
? instanceofObj
? obj instanceof instanceofObj
: obj.nodeType === ElementNodeType
: false;
};
/**
* Checks whether the given object is a Element.
* @param obj The object which shall be checked.
*/
export const isElement = (obj) => {
const instanceofObj = Element;
return obj
? instanceofObj
? obj instanceof instanceofObj
: obj.nodeType === ElementNodeType
: false;
};
//# sourceMappingURL=types.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/support/utils/types.ts"],"names":[],"mappings":"AAEA,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,CAAC;AAC1C,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC;AAEtD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAQ,EAAoB,EAAE,CAAC,GAAG,KAAK,SAAS,CAAC;AAE7E,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,GAAQ,EAAe,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC;AAE9D,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,GAAQ,EAAU,EAAE,CACvC,WAAW,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC;IAC7B,CAAC,CAAC,GAAG,GAAG,EAAE;IACV,CAAC,CAAC,QAAQ;SACL,IAAI,CAAC,GAAG,CAAC;SACT,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC;SAClC,WAAW,EAAE,CAAC;AAEvB,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAQ,EAAiB,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC;AAE7E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAQ,EAAiB,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC;AAE7E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AC,CAAC"}
+1 -2
View File
@@ -86,9 +86,8 @@ const mergeAndResolveOptions = (userOptions) => {
},
},
};
const { src, dist, types, styles } = mergedOptions.paths;
const { dist, types, styles } = mergedOptions.paths;
mergedOptions.paths.src = resolvePath(projectPath, src);
mergedOptions.paths.dist = resolvePath(projectPath, dist);
mergedOptions.paths.types = resolvePath(projectPath, types);
mergedOptions.paths.styles = resolvePath(projectPath, styles);
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,528 +0,0 @@
/*!
* OverlayScrollbars
* Version: 2.0.0-beta.0
*
* Copyright (c) Rene Haas | KingSora.
* https://github.com/KingSora
*
* Released under the MIT license.
*/
.os-size-observer,
.os-size-observer-listener {
direction: inherit;
pointer-events: none;
overflow: hidden;
visibility: hidden;
box-sizing: border-box;
}
.os-size-observer,
.os-size-observer-listener,
.os-size-observer-listener-item,
.os-size-observer-listener-item-final {
writing-mode: horizontal-tb;
position: absolute;
left: 0;
top: 0;
}
.os-size-observer {
z-index: -1;
contain: strict;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
padding: inherit;
border: inherit;
box-sizing: inherit;
margin: -133px;
top: 0;
right: 0;
bottom: 0;
left: 0;
transform: scale(0.1);
}
.os-size-observer::before {
content: "";
flex: none;
box-sizing: inherit;
padding: 10px;
width: 10px;
height: 10px;
}
.os-size-observer-appear {
-webkit-animation: os-size-observer-appear-animation 1ms forwards;
animation: os-size-observer-appear-animation 1ms forwards;
}
.os-size-observer-listener {
box-sizing: border-box;
position: relative;
flex: auto;
padding: inherit;
border: inherit;
margin: -133px;
transform: scale(10);
}
.os-size-observer-listener.ltr {
margin-right: -266px;
margin-left: 0;
}
.os-size-observer-listener.rtl {
margin-left: -266px;
margin-right: 0;
}
.os-size-observer-listener:empty::before {
content: "";
width: 100%;
height: 100%;
}
.os-size-observer-listener:empty::before, .os-size-observer-listener > .os-size-observer-listener-item {
display: block;
position: relative;
padding: inherit;
border: inherit;
box-sizing: content-box;
flex: auto;
}
.os-size-observer-listener-scroll {
box-sizing: border-box;
display: flex;
}
.os-size-observer-listener-item {
right: 0;
bottom: 0;
overflow: hidden;
direction: ltr;
flex: none;
}
.os-size-observer-listener-item-final {
transition: none;
}
@-webkit-keyframes os-size-observer-appear-animation {
from {
cursor: auto;
}
to {
cursor: none;
}
}
@keyframes os-size-observer-appear-animation {
from {
cursor: auto;
}
to {
cursor: none;
}
}
.os-trinsic-observer {
flex: none;
box-sizing: border-box;
position: relative;
max-width: 0px;
max-height: 1px;
padding: 0;
margin: 0;
border: none;
overflow: hidden;
z-index: -1;
height: 0;
top: calc(100% + 1px);
contain: strict;
}
.os-trinsic-observer:not(:empty) {
height: calc(100% + 1px);
top: -1px;
}
.os-trinsic-observer:not(:empty) > .os-size-observer {
width: 1000%;
height: 1000%;
min-height: 1px;
min-width: 1px;
}
.os-environment {
--os-custom-prop: -1;
position: fixed;
opacity: 0;
visibility: hidden;
overflow: scroll;
height: 200px;
width: 200px;
z-index: var(--os-custom-prop);
}
.os-environment div {
width: 200%;
height: 200%;
margin: 10px 0;
}
.os-environment.os-environment-flexbox-glue {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
height: auto;
width: auto;
min-height: 200px;
min-width: 200px;
}
.os-environment.os-environment-flexbox-glue div {
flex: auto;
width: auto;
height: auto;
max-height: 100%;
max-width: 100%;
margin: 0;
}
.os-environment.os-environment-flexbox-glue-max {
max-height: 200px;
}
.os-environment.os-environment-flexbox-glue-max div {
overflow: visible;
}
.os-environment.os-environment-flexbox-glue-max div::before {
content: "";
display: block;
height: 999px;
width: 999px;
}
.os-environment,
.os-viewport {
-ms-overflow-style: scrollbar !important;
}
[data-overlayscrollbars=""],
[data-overlayscrollbars~=scrollbarHidden],
html.os-viewport-scrollbar-hidden,
.os-viewport-scrollbar-hidden.os-environment,
.os-viewport-scrollbar-hidden.os-viewport {
scrollbar-width: none !important;
}
[data-overlayscrollbars=""]::-webkit-scrollbar,
[data-overlayscrollbars=""]::-webkit-scrollbar-corner,
[data-overlayscrollbars~=scrollbarHidden]::-webkit-scrollbar,
[data-overlayscrollbars~=scrollbarHidden]::-webkit-scrollbar-corner,
html.os-viewport-scrollbar-hidden::-webkit-scrollbar,
html.os-viewport-scrollbar-hidden::-webkit-scrollbar-corner,
.os-viewport-scrollbar-hidden.os-environment::-webkit-scrollbar,
.os-viewport-scrollbar-hidden.os-environment::-webkit-scrollbar-corner,
.os-viewport-scrollbar-hidden.os-viewport::-webkit-scrollbar,
.os-viewport-scrollbar-hidden.os-viewport::-webkit-scrollbar-corner {
display: none !important;
width: 0px !important;
height: 0px !important;
visibility: hidden !important;
background: transparent !important;
}
html.os-viewport-scrollbar-hidden,
html.os-viewport-scrollbar-hidden > body[data-overlayscrollbars] {
box-sizing: border-box;
margin: 0;
width: 100%;
height: 100%;
}
[data-overlayscrollbars~=host],
.os-padding {
position: relative;
}
[data-overlayscrollbars~=host],
.os-padding {
display: flex;
flex-direction: row !important;
flex-wrap: nowrap !important;
}
.os-padding,
.os-viewport {
box-sizing: inherit;
position: relative;
flex: auto !important;
height: auto;
width: 100%;
padding: 0;
margin: 0;
border: none;
z-index: 0;
}
.os-viewport {
--os-vaw: 0;
--os-vah: 0;
}
.os-viewport.os-viewport-arrange::before {
content: "";
position: absolute;
pointer-events: none;
z-index: -1;
min-width: 1px;
min-height: 1px;
width: var(--os-vaw);
height: var(--os-vah);
}
[data-overlayscrollbars~=host],
[data-overlayscrollbars~=viewport] {
overflow: hidden !important;
}
[data-overlayscrollbars~=overflowVisible] {
overflow: visible !important;
}
[data-overlayscrollbars-overflow-x=hidden] {
overflow-x: hidden !important;
}
[data-overlayscrollbars-overflow-x=scroll] {
overflow-x: scroll !important;
}
[data-overlayscrollbars-overflow-x=hidden] {
overflow-y: hidden !important;
}
[data-overlayscrollbars-overflow-y=scroll] {
overflow-y: scroll !important;
}
.os-padding,
.os-viewport {
overflow: hidden;
}
.os-overflow-visible {
overflow: visible;
}
.os-content {
box-sizing: inherit;
}
.os-scrollbar {
contain: strict;
transition: opacity 0.3s, visibility 0.3s, top 0.3s, right 0.3s, bottom 0.3s, left 0.3s;
pointer-events: none;
position: absolute;
z-index: 99999;
opacity: 0;
visibility: hidden;
}
body > .os-scrollbar {
position: fixed;
}
.os-scrollbar-transitionless {
transition: none;
}
.os-scrollbar-track {
position: relative;
direction: ltr !important;
padding: 0 !important;
border: none !important;
}
.os-scrollbar-handle {
position: absolute;
}
.os-scrollbar-track,
.os-scrollbar-handle {
pointer-events: none;
width: 100%;
height: 100%;
}
.os-scrollbar.os-scrollbar-track-interactive .os-scrollbar-track,
.os-scrollbar.os-scrollbar-handle-interactive .os-scrollbar-handle {
pointer-events: auto;
touch-action: none;
}
.os-scrollbar-horizontal {
bottom: 0;
left: 0;
}
.os-scrollbar-vertical {
top: 0;
right: 0;
}
.os-scrollbar-rtl.os-scrollbar-horizontal {
right: 0;
}
.os-scrollbar-rtl.os-scrollbar-vertical {
right: auto;
left: 0;
}
.os-scrollbar-visible,
.os-scrollbar-interaction.os-scrollbar-visible {
opacity: 1;
visibility: visible;
}
.os-scrollbar-auto-hidden {
opacity: 0;
visibility: hidden;
}
.os-scrollbar-unusable,
.os-scrollbar-unusable *,
.os-scrollbar-wheel,
.os-scrollbar-wheel * {
pointer-events: none !important;
}
.os-scrollbar-unusable .os-scrollbar-handle {
opacity: 0 !important;
}
.os-scrollbar.os-scrollbar-horizontal.os-scrollbar-cornerless,
.os-scrollbar.os-scrollbar-horizontal.os-scrollbar-cornerless.os-scrollbar-rtl {
left: 0;
right: 0;
}
.os-scrollbar.os-scrollbar-vertical.os-scrollbar-cornerless,
.os-scrollbar.os-scrollbar-vertical.os-scrollbar-cornerless.os-scrollbar-rtl {
top: 0;
bottom: 0;
}
/* NONE THEME: */
[data-overlayscrollbars~=updating] > .os-scrollbar,
.os-theme-none.os-scrollbar {
display: none !important;
}
/* DARK & LIGHT THEME: */
.os-theme-dark.os-scrollbar-horizontal,
.os-theme-light.os-scrollbar-horizontal {
right: 10px;
height: 10px;
}
.os-theme-dark.os-scrollbar-vertical,
.os-theme-light.os-scrollbar-vertical {
bottom: 10px;
width: 10px;
}
.os-theme-dark.os-scrollbar-rtl.os-scrollbar-horizontal,
.os-theme-light.os-scrollbar-rtl.os-scrollbar-horizontal {
left: 10px;
right: 0;
}
.os-theme-dark.os-scrollbar,
.os-theme-light.os-scrollbar {
padding: 2px;
box-sizing: border-box;
background: transparent;
}
.os-theme-dark.os-scrollbar-unusable,
.os-theme-light.os-scrollbar-unusable {
background: transparent;
}
.os-theme-dark.os-scrollbar > .os-scrollbar-track,
.os-theme-light.os-scrollbar > .os-scrollbar-track {
background: transparent;
}
.os-theme-dark.os-scrollbar-horizontal > .os-scrollbar-track > .os-scrollbar-handle,
.os-theme-light.os-scrollbar-horizontal > .os-scrollbar-track > .os-scrollbar-handle {
min-width: 30px;
}
.os-theme-dark.os-scrollbar-vertical > .os-scrollbar-track > .os-scrollbar-handle,
.os-theme-light.os-scrollbar-vertical > .os-scrollbar-track > .os-scrollbar-handle {
min-height: 30px;
}
.os-theme-dark.os-scrollbar-transition > .os-scrollbar-track > .os-scrollbar-handle,
.os-theme-light.os-scrollbar-transition > .os-scrollbar-track > .os-scrollbar-handle {
transition: background-color 0.3s;
}
.os-theme-dark.os-scrollbar > .os-scrollbar-track > .os-scrollbar-handle,
.os-theme-light.os-scrollbar > .os-scrollbar-track > .os-scrollbar-handle,
.os-theme-dark.os-scrollbar > .os-scrollbar-track,
.os-theme-light.os-scrollbar > .os-scrollbar-track {
border-radius: 10px;
}
.os-theme-dark.os-scrollbar > .os-scrollbar-track > .os-scrollbar-handle {
background: rgba(0, 0, 0, 0.4);
}
.os-theme-light.os-scrollbar > .os-scrollbar-track > .os-scrollbar-handle {
background: rgba(255, 255, 255, 0.4);
}
.os-theme-dark.os-scrollbar:hover > .os-scrollbar-track > .os-scrollbar-handle {
background: rgba(0, 0, 0, 0.55);
}
.os-theme-light.os-scrollbar:hover > .os-scrollbar-track > .os-scrollbar-handle {
background: rgba(255, 255, 255, 0.55);
}
.os-theme-dark.os-scrollbar > .os-scrollbar-track > .os-scrollbar-handle.active {
background: rgba(0, 0, 0, 0.7);
}
.os-theme-light.os-scrollbar > .os-scrollbar-track > .os-scrollbar-handle.active {
background: rgba(255, 255, 255, 0.7);
}
.os-theme-dark.os-scrollbar-horizontal .os-scrollbar-handle:before,
.os-theme-dark.os-scrollbar-vertical .os-scrollbar-handle:before,
.os-theme-light.os-scrollbar-horizontal .os-scrollbar-handle:before,
.os-theme-light.os-scrollbar-vertical .os-scrollbar-handle:before {
content: "";
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: block;
}
.os-theme-dark.os-host-scrollbar-hidden > .os-scrollbar-handle:before {
display: none;
}
.os-theme-dark.os-scrollbar-horizontal .os-scrollbar-handle:before,
.os-theme-light.os-scrollbar-horizontal .os-scrollbar-handle:before {
top: -6px;
bottom: -2px;
}
.os-theme-dark.os-scrollbar-vertical .os-scrollbar-handle:before,
.os-theme-light.os-scrollbar-vertical .os-scrollbar-handle:before {
left: -6px;
right: -2px;
}
.os-theme-dark.os-scrollbar-rtl.os-scrollbar-vertical .os-scrollbar-handle:before,
.os-theme-light.os-scrollbar-rtl.os-scrollbar-vertical .os-scrollbar-handle:before {
right: -6px;
left: -2px;
}
/*# sourceMappingURL=overlayscrollbars.css.map */
@@ -1 +0,0 @@
{"version":3,"sources":["../stdin","../../src/styles/sizeobserver.scss","../overlayscrollbars.css","../../src/styles/trinsicobserver.scss","../../src/styles/structure.scss","../../src/styles/scrollbars.scss"],"names":[],"mappings":"AAAA;;;;;;;;EAAA;ACKA;;EAEE,kBAAA;EACA,oBAAA;EACA,gB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3UA;;;;EAIE,WAAA;EACA,kBAAA;EACA,OAAA;EACA,QAAA;EACA,MAAA;EACA,SAAA;EACA,cAAA;AH8UF;;AG5UA;EACE,aAAA;AH+UF;;AG7UA;;EAEE,SAAA;EACA,YAAA;AHgVF;;AG9UA;;EAEE,UAAA;EACA,WAAA;AHiVF;;AG/UA;;EAEE,WAAA;EACA,UAAA;AHkVF","file":"overlayscrollbars.css"}
File diff suppressed because one or more lines are too long
-264
View File
@@ -1,264 +0,0 @@
declare type CacheValues<T> = [value: T, changed: boolean, previous?: T];
declare type UpdateCache<Value> = (force?: boolean) => CacheValues<Value>;
interface WH<T = number> {
w: T;
h: T;
}
declare type DeepPartial<T> = {
[P in keyof T]?: T[P] extends Record<string, unknown> ? DeepPartial<T[P]> : T[P];
};
declare type StyleObject<CustomCssProps = ''> = {
[Key in keyof CSSStyleDeclaration | (CustomCssProps extends string ? CustomCssProps : '')]?: string | number;
};
declare type OverflowStyle = 'scroll' | 'hidden' | 'visible';
interface TRBL {
t: number;
r: number;
b: number;
l: number;
}
interface XY<T = number> {
x: T;
y: T;
}
declare type EventListener$1<EventMap extends Record<string, any[]>, N extends keyof EventMap = keyof EventMap> = (...args: EventMap[N]) => void;
declare type InitialEventListeners$1<EventMap extends Record<string, any[]>> = {
[K in keyof EventMap]?: EventListener$1<EventMap> | EventListener$1<EventMap>[];
};
declare type OverflowBehavior = 'hidden' | 'scroll' | 'visible' | 'visible-hidden' | 'visible-scroll';
declare type ScrollbarVisibilityBehavior = 'visible' | 'hidden' | 'auto';
declare type ScrollbarAutoHideBehavior = 'never' | 'scroll' | 'leave' | 'move';
interface Options {
paddingAbsolute: boolean;
showNativeOverlaidScrollbars: boolean;
update: {
elementEvents: Array<[elementSelector: string, eventNames: string]> | null;
debounce: [timeout: number, maxWait: number] | number | null;
attributes: string[] | null;
ignoreMutation: ((mutation: MutationRecord) => any) | null;
};
overflow: {
x: OverflowBehavior;
y: OverflowBehavior;
};
scrollbars: {
theme: string | null;
visibility: ScrollbarVisibilityBehavior;
autoHide: ScrollbarAutoHideBehavior;
autoHideDelay: number;
dragScroll: boolean;
clickScroll: boolean;
pointers: string[] | null;
};
}
declare type PluginInstance = Record<string, unknown> | ((staticObj: OverlayScrollbarsStatic, instanceObj: OverlayScrollbars) => void);
declare type Plugin<T extends PluginInstance = PluginInstance> = {
[pluginName: string]: T;
};
declare type SizeObserverPluginInstance = {
_: (listenerElement: HTMLElement, onSizeChangedCallback: (appear: boolean) => any, observeAppearChange: boolean) => [appearCallback: () => any, offFns: (() => any)[]];
};
declare const sizeObserverPlugin: Plugin<SizeObserverPluginInstance>;
declare type StaticInitialization = HTMLElement | false | null;
declare type DynamicInitialization = HTMLElement | boolean | null;
/**
* Static elements are elements which MUST be present in the final DOM.
* With false, null or undefined the element will be generated, otherwise the specified element is taken.
*/
declare type StaticInitializationElement<Args extends any[]> = ((...args: Args) => StaticInitialization) | StaticInitialization;
/**
* Dynamic element are elements which CAN be present in the final DOM.
* If its a element the element will be taken as the repsective element.
* With true the element will be generated.
* With false, null or undefined the element won't be generated and wont be in the DOM.
*/
declare type DynamicInitializationElement<Args extends any[]> = ((...args: Args) => DynamicInitialization) | DynamicInitialization;
declare type Initialization = {
elements: {
host: StaticInitializationElement<[target: InitializationTargetElement]>;
viewport: StaticInitializationElement<[target: InitializationTargetElement]>;
padding: DynamicInitializationElement<[target: InitializationTargetElement]>;
content: DynamicInitializationElement<[target: InitializationTargetElement]>;
};
scrollbars: {
slot: DynamicInitializationElement<[
target: InitializationTargetElement,
host: HTMLElement,
viewport: HTMLElement
]>;
};
cancel: {
nativeScrollbarsOverlaid: boolean;
body: boolean | null;
};
};
declare type InitializationTargetElement = HTMLElement | HTMLTextAreaElement;
declare type InitializationTargetObject = DeepPartial<Initialization> & {
target: InitializationTargetElement;
};
declare type InitializationTarget = InitializationTargetElement | InitializationTargetObject;
interface StructureSetupState {
_padding: TRBL;
_paddingAbsolute: boolean;
_viewportPaddingStyle: StyleObject;
_overflowEdge: XY<number>;
_overflowAmount: XY<number>;
_overflowStyle: XY<OverflowStyle>;
_hasOverflow: XY<boolean>;
_heightIntrinsic: boolean;
_directionIsRTL: boolean;
}
interface ViewportOverflowState {
_scrollbarsHideOffset: XY<number>;
_scrollbarsHideOffsetArrange: XY<boolean>;
_overflowScroll: XY<boolean>;
_overflowStyle: XY<OverflowStyle>;
}
declare type GetViewportOverflowState = (showNativeOverlaidScrollbars: boolean, viewportStyleObj?: StyleObject) => ViewportOverflowState;
declare type HideNativeScrollbars = (viewportOverflowState: ViewportOverflowState, directionIsRTL: boolean, viewportArrange: boolean, viewportStyleObj: StyleObject) => void;
declare type EnvironmentEventMap = {
_: [];
};
interface InternalEnvironment {
readonly _nativeScrollbarsSize: XY;
readonly _nativeScrollbarsOverlaid: XY<boolean>;
readonly _nativeScrollbarsHiding: boolean;
readonly _rtlScrollBehavior: {
n: boolean;
i: boolean;
};
readonly _flexboxGlue: boolean;
readonly _cssCustomProperties: boolean;
readonly _staticDefaultInitialization: Initialization;
readonly _staticDefaultOptions: Options;
_addListener(listener: EventListener$1<EnvironmentEventMap, '_'>): () => void;
_getDefaultInitialization(): Initialization;
_setDefaultInitialization(newInitialization: DeepPartial<Initialization>): void;
_getDefaultOptions(): Options;
_setDefaultOptions(newDefaultOptions: DeepPartial<Options>): void;
}
declare type ArrangeViewport = (viewportOverflowState: ViewportOverflowState, viewportScrollSize: WH<number>, sizeFraction: WH<number>, directionIsRTL: boolean) => boolean;
declare type UndoViewportArrangeResult = [
redoViewportArrange: () => void,
overflowState?: ViewportOverflowState
];
declare type UndoArrangeViewport = (showNativeOverlaidScrollbars: boolean, directionIsRTL: boolean, viewportOverflowState?: ViewportOverflowState) => UndoViewportArrangeResult;
declare type ScrollbarsHidingPluginInstance = {
_createUniqueViewportArrangeElement(env: InternalEnvironment): HTMLStyleElement | false;
_overflowUpdateSegment(doViewportArrange: boolean, flexboxGlue: boolean, viewport: HTMLElement, viewportArrange: HTMLStyleElement | false | null | undefined, getState: () => StructureSetupState, getViewportOverflowState: GetViewportOverflowState, hideNativeScrollbars: HideNativeScrollbars): [ArrangeViewport, UndoArrangeViewport];
_envWindowZoom(): (envInstance: InternalEnvironment, updateNativeScrollbarSizeCache: UpdateCache<XY<number>>, triggerEvent: () => void) => void;
};
declare const scrollbarsHidingPlugin: Plugin<ScrollbarsHidingPluginInstance>;
interface OnUpdatedEventListenerArgs {
updateHints: {
sizeChanged: boolean;
directionChanged: boolean;
heightIntrinsicChanged: boolean;
overflowEdgeChanged: boolean;
overflowAmountChanged: boolean;
overflowStyleChanged: boolean;
hostMutation: boolean;
contentMutation: boolean;
};
changedOptions: DeepPartial<Options>;
force: boolean;
}
declare type EventListenerMap = {
/**
* Triggered after all elements are initialized and appended.
*/
initialized: [instance: OverlayScrollbars];
/**
* Triggered after an update.
*/
updated: [instance: OverlayScrollbars, onUpdatedArgs: OnUpdatedEventListenerArgs];
/**
* Triggered after all elements, observers and events are destroyed.
*/
destroyed: [instance: OverlayScrollbars, canceled: boolean];
};
declare type InitialEventListeners = InitialEventListeners$1<EventListenerMap>;
declare type EventListener<N extends keyof EventListenerMap> = EventListener$1<EventListenerMap, N>;
interface OverlayScrollbarsStatic {
(target: InitializationTarget): OverlayScrollbars | undefined;
(target: InitializationTarget, options: DeepPartial<Options>, eventListeners?: InitialEventListeners): OverlayScrollbars;
plugin(plugin: Plugin | Plugin[]): void;
valid(osInstance: any): boolean;
env(): Environment;
}
interface Environment {
scrollbarsSize: XY<number>;
scrollbarsOverlaid: XY<boolean>;
scrollbarsHiding: boolean;
rtlScrollBehavior: {
n: boolean;
i: boolean;
};
flexboxGlue: boolean;
cssCustomProperties: boolean;
staticDefaultInitialization: Initialization;
staticDefaultOptions: Options;
getDefaultInitialization(): Initialization;
setDefaultInitialization(newDefaultInitialization: DeepPartial<Initialization>): void;
getDefaultOptions(): Options;
setDefaultOptions(newDefaultOptions: DeepPartial<Options>): void;
}
interface State {
padding: TRBL;
paddingAbsolute: boolean;
overflowEdge: XY<number>;
overflowAmount: XY<number>;
overflowStyle: XY<OverflowStyle>;
hasOverflow: XY<boolean>;
directionRTL: boolean;
destroyed: boolean;
}
interface ScrollbarElements {
scrollbar: HTMLElement;
track: HTMLElement;
handle: HTMLElement;
}
interface CloneableScrollbarElements extends ScrollbarElements {
clone(): ScrollbarElements;
}
interface Elements {
target: HTMLElement;
host: HTMLElement;
padding: HTMLElement;
viewport: HTMLElement;
content: HTMLElement;
scrollOffsetElement: HTMLElement;
scrollEventElement: HTMLElement | Document;
scrollbarHorizontal: CloneableScrollbarElements;
scrollbarVertical: CloneableScrollbarElements;
}
interface OverlayScrollbars {
options(): Options;
options(newOptions: DeepPartial<Options>): Options;
update(force?: boolean): OverlayScrollbars;
destroy(): void;
state(): State;
elements(): Elements;
on<N extends keyof EventListenerMap>(name: N, listener: EventListener<N>): () => void;
on<N extends keyof EventListenerMap>(name: N, listener: EventListener<N>[]): () => void;
off<N extends keyof EventListenerMap>(name: N, listener: EventListener<N>): void;
off<N extends keyof EventListenerMap>(name: N, listener: EventListener<N>[]): void;
}
declare const OverlayScrollbars: OverlayScrollbarsStatic;
export { DynamicInitializationElement, EventListener, EventListenerMap, InitialEventListeners, Initialization, InitializationTarget, InitializationTargetElement, InitializationTargetObject, OnUpdatedEventListenerArgs, Options, OverflowBehavior, OverlayScrollbars, Plugin, PluginInstance, ScrollbarAutoHideBehavior, ScrollbarVisibilityBehavior, StaticInitializationElement, scrollbarsHidingPlugin, sizeObserverPlugin };