Compare commits
No commits in common. "master" and "@advdominion/is@1.0.0" have entirely different histories.
master
...
@advdomini
13
README.md
13
README.md
|
@ -1,13 +0,0 @@
|
||||||
# helpers
|
|
||||||
|
|
||||||
## Добавление нового пакета
|
|
||||||
|
|
||||||
1. Скопировать один из существующих пакетов в папке `packages`
|
|
||||||
2. На его основе подготовить новый пакет
|
|
||||||
3. Запустить `yarn`
|
|
||||||
|
|
||||||
## Публикация новых версий
|
|
||||||
|
|
||||||
```
|
|
||||||
yarn lerna publish
|
|
||||||
```
|
|
|
@ -1,17 +0,0 @@
|
||||||
# get-scrollbar-width
|
|
||||||
|
|
||||||
Get window scrollbar width (if present):
|
|
||||||
|
|
||||||
```js
|
|
||||||
import { getScrollbarWidth } from '@advdominion/get-scrollbar-width';
|
|
||||||
|
|
||||||
console.log(getScrollbarWidth());
|
|
||||||
```
|
|
||||||
|
|
||||||
Get system scrollbar width:
|
|
||||||
|
|
||||||
```js
|
|
||||||
import { getScrollbarWidth } from '@advdominion/get-scrollbar-width';
|
|
||||||
|
|
||||||
console.log(getScrollbarWidth(false));
|
|
||||||
```
|
|
|
@ -1,24 +0,0 @@
|
||||||
const scrollbarWidth = () => {
|
|
||||||
const outer = document.createElement('div');
|
|
||||||
outer.style.visibility = 'hidden';
|
|
||||||
outer.style.width = '100px';
|
|
||||||
document.body.append(outer);
|
|
||||||
const widthNoScroll = outer.offsetWidth;
|
|
||||||
outer.style.overflow = 'scroll';
|
|
||||||
const inner = document.createElement('div');
|
|
||||||
inner.style.width = '100%';
|
|
||||||
outer.append(inner);
|
|
||||||
const widthWithScroll = inner.offsetWidth;
|
|
||||||
outer.remove();
|
|
||||||
return widthNoScroll - widthWithScroll;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getScrollbarWidth = (getWindowScrollbar = true) => {
|
|
||||||
if (getWindowScrollbar) {
|
|
||||||
if (document.body.clientHeight > window.innerHeight) {
|
|
||||||
return scrollbarWidth();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return scrollbarWidth();
|
|
||||||
};
|
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@advdominion/get-scrollbar-width",
|
|
||||||
"version": "2.0.0",
|
|
||||||
"type": "module",
|
|
||||||
"main": "index.js",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://gitea.optiweb.ru/public/helpers.git"
|
|
||||||
},
|
|
||||||
"license": "MIT",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +1,6 @@
|
||||||
# is
|
# is
|
||||||
|
|
||||||
Check variable type
|
Usage:
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import { is } from '@advdominion/is';
|
import { is } from '@advdominion/is';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@advdominion/is",
|
"name": "@advdominion/is",
|
||||||
"version": "1.0.1",
|
"version": "1.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
# pluralize
|
|
||||||
|
|
||||||
Склонение существительных в зависимости от чила
|
|
||||||
|
|
||||||
## Использование
|
|
||||||
|
|
||||||
```js
|
|
||||||
import { pluralize } from '@advdominion/pluralize';
|
|
||||||
|
|
||||||
console.log(pluralize(1, ['яблоко', 'яблока', 'яблок']));
|
|
||||||
```
|
|
|
@ -1,14 +0,0 @@
|
||||||
export const pluralize = (count, words) => {
|
|
||||||
count = Math.abs(count) % 100;
|
|
||||||
const count10 = count % 10;
|
|
||||||
if (count > 10 && count < 20) {
|
|
||||||
return words[2];
|
|
||||||
}
|
|
||||||
if (count10 > 1 && count10 < 5) {
|
|
||||||
return words[1];
|
|
||||||
}
|
|
||||||
if (count10 === 1) {
|
|
||||||
return words[0];
|
|
||||||
}
|
|
||||||
return words[2];
|
|
||||||
};
|
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@advdominion/pluralize",
|
|
||||||
"version": "1.0.1",
|
|
||||||
"type": "module",
|
|
||||||
"main": "index.js",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://gitea.optiweb.ru/public/helpers.git"
|
|
||||||
},
|
|
||||||
"license": "MIT",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
}
|
|
||||||
}
|
|
12
yarn.lock
12
yarn.lock
|
@ -5,24 +5,12 @@ __metadata:
|
||||||
version: 8
|
version: 8
|
||||||
cacheKey: 10c0
|
cacheKey: 10c0
|
||||||
|
|
||||||
"@advdominion/get-scrollbar-width@workspace:packages/get-scrollbar-width":
|
|
||||||
version: 0.0.0-use.local
|
|
||||||
resolution: "@advdominion/get-scrollbar-width@workspace:packages/get-scrollbar-width"
|
|
||||||
languageName: unknown
|
|
||||||
linkType: soft
|
|
||||||
|
|
||||||
"@advdominion/is@workspace:packages/is":
|
"@advdominion/is@workspace:packages/is":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@advdominion/is@workspace:packages/is"
|
resolution: "@advdominion/is@workspace:packages/is"
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
"@advdominion/pluralize@workspace:packages/pluralize":
|
|
||||||
version: 0.0.0-use.local
|
|
||||||
resolution: "@advdominion/pluralize@workspace:packages/pluralize"
|
|
||||||
languageName: unknown
|
|
||||||
linkType: soft
|
|
||||||
|
|
||||||
"@babel/code-frame@npm:^7.0.0":
|
"@babel/code-frame@npm:^7.0.0":
|
||||||
version: 7.24.2
|
version: 7.24.2
|
||||||
resolution: "@babel/code-frame@npm:7.24.2"
|
resolution: "@babel/code-frame@npm:7.24.2"
|
||||||
|
|
Loading…
Reference in New Issue