Compare commits

..

15 Commits

Author SHA1 Message Date
f30793af80 Publish
- @advdominion/scroll-to@1.0.0
2026-02-02 18:23:50 +04:00
3605551f16 @advdominion/scroll-to 2026-02-02 18:22:51 +04:00
f8d793195c Publish
- @advdominion/babel-plugin-nunjucks@3.1.0
2026-01-23 00:15:03 +04:00
a655e7b5e4 Move Nunjucks to peerDependencies 2026-01-23 00:14:36 +04:00
fc11cdfa48 Publish
- @advdominion/babel-plugin-nunjucks@3.0.3
 - @advdominion/eslint-config@1.1.3
 - @advdominion/lightningcss-loader@1.0.2
2026-01-23 00:08:50 +04:00
650008ad76 Revert "Publish"
This reverts commit 96ae522a8f.
2026-01-23 00:08:19 +04:00
96ae522a8f Publish
- @advdominion/babel-plugin-nunjucks@3.0.3
 - @advdominion/eslint-config@null
 - @advdominion/lightningcss-loader@null
2026-01-23 00:03:52 +04:00
9dc95dd47a Fix 2026-01-22 23:57:47 +04:00
bce960599a Обновлены зависимости 2026-01-21 15:36:32 +04:00
6f24952680 Remove @advdominion/is 2026-01-21 15:25:45 +04:00
e1756bd60f Publish
- @advdominion/babel-plugin-nunjucks@3.0.2
2026-01-21 15:20:43 +04:00
ea33198344 Publish
- @advdominion/babel-plugin-nunjucks@3.0.1
 - @advdominion/lightningcss-loader@1.0.1
2026-01-21 15:14:18 +04:00
ca88f622d1 @advdominion/lightningcss-loader 2026-01-21 15:13:48 +04:00
9131e220d2 Fix 2026-01-21 15:13:22 +04:00
4012b982a6 Fix README.md 2026-01-21 14:58:22 +04:00
15 changed files with 224 additions and 209 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "prettier", "name": "prettier",
"version": "3.7.4-sdk", "version": "3.8.0-sdk",
"main": "./index.cjs", "main": "./index.cjs",
"type": "commonjs", "type": "commonjs",
"bin": "./bin/prettier.cjs" "bin": "./bin/prettier.cjs"

View File

@@ -8,13 +8,13 @@
## Публикация новых версий ## Публикация новых версий
``` ```bash
yarn lerna publish yarn lerna publish
``` ```
## Обновление зависимостей ## Обновление зависимостей
```shell ```bash
yarn set version stable yarn set version stable
yarn install yarn install

View File

@@ -9,6 +9,6 @@
"@advdominion/eslint-config": "workspace:*", "@advdominion/eslint-config": "workspace:*",
"eslint": "^9.39.2", "eslint": "^9.39.2",
"lerna": "^9.0.3", "lerna": "^9.0.3",
"prettier": "^3.7.4" "prettier": "^3.8.0"
} }
} }

View File

@@ -1,129 +1,25 @@
/* eslint-disable unicorn/no-useless-spread */ import nunjucks from 'nunjucks';
import js from '@eslint/js'; const babelPluginNunjucks = ({types: t}) => {
import eslintConfigPrettier from 'eslint-config-prettier'; return {
import simpleImportSort from 'eslint-plugin-simple-import-sort'; pre(state) {
import eslintPluginUnicorn from 'eslint-plugin-unicorn'; const options = state.opts.plugins[0].options;
import pluginVue from 'eslint-plugin-vue'; this.njkenv = new nunjucks.Environment(new nunjucks.FileSystemLoader(options.templatesFolder));
import globals from 'globals'; if (options.globals) {
for (const {name, value} of options.globals) {
this.njkenv.addGlobal(name, value);
}
}
},
visitor: {
TaggedTemplateExpression(path) {
if (path.get('tag').isIdentifier({name: 'njk'})) {
const render = this.njkenv.renderString(path.node.quasi.quasis[0].value.raw);
path.replaceWith(t.stringLiteral(render));
}
},
},
};
};
const config = [ export default babelPluginNunjucks;
{
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
...globals.nodeBuiltin,
},
},
},
js.configs.recommended,
{
rules: {
...{
'array-callback-return': 'error',
'no-await-in-loop': 'warn',
'no-duplicate-imports': 'warn',
'no-promise-executor-return': 'error',
'no-self-compare': 'error',
'no-template-curly-in-string': 'warn',
'no-unassigned-vars': 'warn',
'no-unmodified-loop-condition': 'error',
'no-unreachable-loop': 'error',
'no-use-before-define': 'error',
'no-useless-assignment': 'warn',
},
...{
'dot-notation': 'warn',
'eqeqeq': 'error',
'no-implicit-coercion': 'warn',
'no-negated-condition': 'warn',
'no-useless-concat': 'warn',
'object-shorthand': 'warn',
'func-style': 'error',
'no-console': ['warn', { allow: ['warn', 'error'] }],
'no-param-reassign': 'error',
'no-var': 'error',
'one-var': ['warn', 'never'],
'prefer-const': 'warn',
'prefer-template': 'warn',
},
},
},
{
plugins: {
'simple-import-sort': simpleImportSort,
},
rules: {
'simple-import-sort/imports': 'warn',
},
},
{
plugins: {
unicorn: eslintPluginUnicorn,
},
rules: {
...Object.fromEntries(
Object.entries(eslintPluginUnicorn.configs.recommended.rules).map(([rule, level]) => [
rule,
level === 'off' ? 'off' : 'warn',
]),
),
'unicorn/better-regex': 'warn',
'unicorn/filename-case': ['warn', { cases: { kebabCase: true, pascalCase: true } }],
'unicorn/prefer-global-this': 'off',
'unicorn/prefer-import-meta-properties': 'warn',
'unicorn/prefer-top-level-await': 'off',
'unicorn/prevent-abbreviations': 'off',
},
},
...pluginVue.configs['flat/recommended'],
{
rules: {
...{
'vue/no-v-html': 'off',
'vue/one-component-per-file': 'off',
},
...{
'vue/component-name-in-template-casing': 'warn',
'vue/component-options-name-casing': 'warn',
'vue/custom-event-name-casing': 'warn',
'vue/match-component-file-name': ['warn', { extensions: ['vue'], shouldMatchCase: true }],
'vue/match-component-import-name': 'warn',
'vue/no-boolean-default': 'warn',
'vue/no-potential-component-option-typo': 'warn',
'vue/no-useless-mustaches': 'warn',
'vue/no-useless-v-bind': 'warn',
'vue/require-direct-export': 'warn',
'vue/require-name-property': 'warn',
'vue/v-for-delimiter-style': 'warn',
'vue/v-on-handler-style': ['warn', 'inline'],
},
...{
'vue/dot-notation': 'warn',
'vue/eqeqeq': 'error',
'vue/no-console': ['warn', { allow: ['warn', 'error'] }],
'vue/no-constant-condition': 'error',
'vue/no-empty-pattern': 'error',
'vue/no-implicit-coercion': 'warn',
'vue/no-irregular-whitespace': 'error',
'vue/no-loss-of-precision': 'error',
'vue/no-negated-condition': 'warn',
'vue/no-sparse-arrays': 'error',
'vue/no-useless-concat': 'warn',
'vue/object-shorthand': 'warn',
'vue/prefer-template': 'warn',
},
},
},
{
files: ['**/*.vue'],
rules: {
'no-useless-assignment': 'off', // ESLint не умеет работать с этим правилом внутри <template>
},
},
eslintConfigPrettier,
];
export default config;

View File

@@ -1,6 +1,6 @@
{ {
"name": "@advdominion/babel-plugin-nunjucks", "name": "@advdominion/babel-plugin-nunjucks",
"version": "3.0.1", "version": "3.1.0",
"type": "module", "type": "module",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
@@ -11,10 +11,8 @@
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },
"dependencies": {
"nunjucks": "^3.0.0"
},
"peerDependencies": { "peerDependencies": {
"@babel/core": "^7.0.0" "@babel/core": "^7.0.0",
"nunjucks": "^3.0.0"
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@advdominion/eslint-config", "name": "@advdominion/eslint-config",
"version": "1.1.2", "version": "1.1.3",
"type": "module", "type": "module",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
@@ -16,8 +16,8 @@
"eslint-config-prettier": "^10.1.8", "eslint-config-prettier": "^10.1.8",
"eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unicorn": "^62.0.0", "eslint-plugin-unicorn": "^62.0.0",
"eslint-plugin-vue": "^10.6.2", "eslint-plugin-vue": "^10.7.0",
"globals": "^16.5.0", "globals": "^17.0.0",
"vue-eslint-parser": "^10.2.0" "vue-eslint-parser": "^10.2.0"
}, },
"peerDependencies": { "peerDependencies": {

View File

@@ -1,11 +0,0 @@
# is
Check variable type
## Usage
```js
import { is } from '@advdominion/is';
console.log(is('Hello, world!', 'String'));
```

View File

@@ -1,3 +0,0 @@
export const is = (obj, type) => {
return Object.prototype.toString.call(obj).slice(8, -1) === type && obj !== undefined && obj !== null;
};

View File

@@ -0,0 +1,53 @@
# lightningcss-loader
[Lightning CSS](https://lightningcss.dev) loader for [Webpack](https://webpack.js.org)
## Usage
```js
import { transform } from 'lightningcss';
return {
...,
rules: [
{
test: /\.css$/,
use: [
{
loader: '@advdominion/lightningcss-loader',
options: {
implementation: transform,
},
},
],
},
],
};
```
### Passing options to Lightning CSS
```js
import { transform } from 'lightningcss';
return {
...,
rules: [
{
test: /\.css$/,
use: [
{
loader: '@advdominion/lightningcss-loader',
options: {
implementation: transform,
drafts: {
customMedia: true,
},
minify: false,
},
},
],
},
],
};
```

View File

@@ -0,0 +1,22 @@
const lightningcssLoader = function (source, sourceMap) {
const { implementation, ...options } = this.getOptions();
const callback = this.async();
if (typeof implementation !== 'function') {
throw new TypeError(
`[lightningcss-loader]: The "implementation" option is required and must provide "transform" function of the LightningCSS`,
);
}
const { code, map } = implementation({
filename: this.resourcePath,
code: Buffer.from(source),
sourceMap: this.sourceMap,
inputSourceMap: this.sourceMap && sourceMap ? JSON.stringify(sourceMap) : undefined,
...options,
});
callback(undefined, code.toString(), map && JSON.parse(map.toString()));
};
export default lightningcssLoader;

View File

@@ -1,5 +1,5 @@
{ {
"name": "@advdominion/is", "name": "@advdominion/lightningcss-loader",
"version": "1.0.2", "version": "1.0.2",
"type": "module", "type": "module",
"main": "index.js", "main": "index.js",

View File

@@ -0,0 +1,33 @@
# scroll-to
Плавный скролл до элемента с поддержкой нативного события `scrollend` и гибкой настройкой отступов.
## Использование
```js
import { scrollTo } from '@advdominion/scroll-to';
// Базовый скролл до элемента
await scrollTo(document.querySelector('#example'));
// Скролл с отступом 100px (например, для фиксированной шапки)
await scrollTo(document.querySelector('#example'), 100, true);
// Скролл с отступом в 10% от высоты экрана
await scrollTo(document.querySelector('#example'), 10);
```
## Параметры
| Параметр | Тип | По умолчанию | Описание |
| :--- | :--- | :--- | :--- |
| **$el** | `HTMLElement` | — | DOM-элемент, к которому нужно прокрутить страницу |
| **offset** | `number` | `0` | Величина отступа сверху от целевого элемента |
| **offsetInPx** | `boolean` | `false` | Тип отступа: `true` — в пикселях, `false` — в процентах от высоты вьюпорта |
## Как это работает
1. **Точность:** Использует нативное событие `scrollend`, которое срабатывает строго после завершения анимации прокрутки.
2. **Безопасность:** Если браузер не поддерживает `scrollend` или анимация прервана, сработает автоматический fallback через 1500 мс.
3. **Плавность:** Использует нативный `behavior: 'smooth'`.
4. **Очистка данных:** Автоматически удаляет слушатели событий и таймеры после завершения или отмены скролла.

View File

@@ -0,0 +1,40 @@
export const scrollTo = ($el, offset = 0, offsetInPx = false) => {
return new Promise((resolve) => {
if (!$el) {
console.warn('Элемент не найден');
resolve();
return;
}
const elementPosition = $el.getBoundingClientRect().top + window.scrollY;
const topOffset = offsetInPx ? offset : (window.innerHeight * offset) / 100;
const targetScrollTop = elementPosition - topOffset;
// Если элемент уже в нужной позиции
if (Math.abs(window.scrollY - targetScrollTop) < 1) {
resolve();
return;
}
let resolved = false; // На случай, если scrollend и fallback запустятся одновременно
let fallbackTimeout; // eslint-disable-line prefer-const
const done = () => {
if (resolved) return;
resolved = true;
window.removeEventListener('scrollend', done);
clearTimeout(fallbackTimeout);
resolve();
};
window.addEventListener('scrollend', done, { once: true });
fallbackTimeout = setTimeout(done, 1500);
window.scrollTo({
top: targetScrollTop,
behavior: 'smooth',
});
});
};

View File

@@ -0,0 +1,14 @@
{
"name": "@advdominion/scroll-to",
"version": "1.0.0",
"type": "module",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://gitea.optiweb.ru/public/frontend.git"
},
"license": "MIT",
"publishConfig": {
"access": "public"
}
}

View File

@@ -8,10 +8,9 @@ __metadata:
"@advdominion/babel-plugin-nunjucks@workspace:packages/babel-plugin-nunjucks": "@advdominion/babel-plugin-nunjucks@workspace:packages/babel-plugin-nunjucks":
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@advdominion/babel-plugin-nunjucks@workspace:packages/babel-plugin-nunjucks" resolution: "@advdominion/babel-plugin-nunjucks@workspace:packages/babel-plugin-nunjucks"
dependencies:
nunjucks: "npm:^3.0.0"
peerDependencies: peerDependencies:
"@babel/core": ^7.0.0 "@babel/core": ^7.0.0
nunjucks: ^3.0.0
languageName: unknown languageName: unknown
linkType: soft linkType: soft
@@ -23,8 +22,8 @@ __metadata:
eslint-config-prettier: "npm:^10.1.8" eslint-config-prettier: "npm:^10.1.8"
eslint-plugin-simple-import-sort: "npm:^12.1.1" eslint-plugin-simple-import-sort: "npm:^12.1.1"
eslint-plugin-unicorn: "npm:^62.0.0" eslint-plugin-unicorn: "npm:^62.0.0"
eslint-plugin-vue: "npm:^10.6.2" eslint-plugin-vue: "npm:^10.7.0"
globals: "npm:^16.5.0" globals: "npm:^17.0.0"
vue-eslint-parser: "npm:^10.2.0" vue-eslint-parser: "npm:^10.2.0"
peerDependencies: peerDependencies:
eslint: ^9.39.0 eslint: ^9.39.0
@@ -37,9 +36,9 @@ __metadata:
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@advdominion/is@workspace:packages/is": "@advdominion/lightningcss-loader@workspace:packages/lightningcss-loader":
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@advdominion/is@workspace:packages/is" resolution: "@advdominion/lightningcss-loader@workspace:packages/lightningcss-loader"
languageName: unknown languageName: unknown
linkType: soft linkType: soft
@@ -49,6 +48,12 @@ __metadata:
languageName: unknown languageName: unknown
linkType: soft linkType: soft
"@advdominion/scroll-to@workspace:packages/scroll-to":
version: 0.0.0-use.local
resolution: "@advdominion/scroll-to@workspace:packages/scroll-to"
languageName: unknown
linkType: soft
"@babel/code-frame@npm:^7.0.0": "@babel/code-frame@npm:^7.0.0":
version: 7.27.1 version: 7.27.1
resolution: "@babel/code-frame@npm:7.27.1" resolution: "@babel/code-frame@npm:7.27.1"
@@ -1310,13 +1315,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"a-sync-waterfall@npm:^1.0.0":
version: 1.0.1
resolution: "a-sync-waterfall@npm:1.0.1"
checksum: 10c0/1c7b258da2c77eb1447dcc683afb10ca3dc8880de990562ccbb7b282538aba01e910345ce9e8500c1458272c7866b85fcfa5ca8159e33550b011ab5c586ec5a4
languageName: node
linkType: hard
"abbrev@npm:^3.0.0": "abbrev@npm:^3.0.0":
version: 3.0.1 version: 3.0.1
resolution: "abbrev@npm:3.0.1" resolution: "abbrev@npm:3.0.1"
@@ -1487,13 +1485,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"asap@npm:^2.0.3":
version: 2.0.6
resolution: "asap@npm:2.0.6"
checksum: 10c0/c6d5e39fe1f15e4b87677460bd66b66050cd14c772269cee6688824c1410a08ab20254bb6784f9afb75af9144a9f9a7692d49547f4d19d715aeb7c0318f3136d
languageName: node
linkType: hard
"async-function@npm:^1.0.0": "async-function@npm:^1.0.0":
version: 1.0.0 version: 1.0.0
resolution: "async-function@npm:1.0.0" resolution: "async-function@npm:1.0.0"
@@ -1935,13 +1926,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"commander@npm:^5.1.0":
version: 5.1.0
resolution: "commander@npm:5.1.0"
checksum: 10c0/da9d71dbe4ce039faf1fe9eac3771dca8c11d66963341f62602f7b66e36d2a3f8883407af4f9a37b1db1a55c59c0c1325f186425764c2e963dc1d67aec2a4b6d
languageName: node
linkType: hard
"common-ancestor-path@npm:^1.0.1": "common-ancestor-path@npm:^1.0.1":
version: 1.0.1 version: 1.0.1
resolution: "common-ancestor-path@npm:1.0.1" resolution: "common-ancestor-path@npm:1.0.1"
@@ -2475,9 +2459,9 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"eslint-plugin-vue@npm:^10.6.2": "eslint-plugin-vue@npm:^10.7.0":
version: 10.6.2 version: 10.7.0
resolution: "eslint-plugin-vue@npm:10.6.2" resolution: "eslint-plugin-vue@npm:10.7.0"
dependencies: dependencies:
"@eslint-community/eslint-utils": "npm:^4.4.0" "@eslint-community/eslint-utils": "npm:^4.4.0"
natural-compare: "npm:^1.4.0" natural-compare: "npm:^1.4.0"
@@ -2495,7 +2479,7 @@ __metadata:
optional: true optional: true
"@typescript-eslint/parser": "@typescript-eslint/parser":
optional: true optional: true
checksum: 10c0/3d3705e6906f6a55529ba99d1ab4e952f2178e109bdab21cc486ef8fee6cd4d4434a4bcb9e77b4d4a8d511dbb2f99deeaeaf22d2847ab3c2ab3d130358a4f8a0 checksum: 10c0/52ae339373a4fc032e1a45871050b91b7eab75903edaf1ea044032e1039acef62304ef8fc2965075c821a26adf44ee323d37e274d252b7f1b122b3520735709c
languageName: node languageName: node
linkType: hard linkType: hard
@@ -3084,13 +3068,20 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"globals@npm:^16.4.0, globals@npm:^16.5.0": "globals@npm:^16.4.0":
version: 16.5.0 version: 16.5.0
resolution: "globals@npm:16.5.0" resolution: "globals@npm:16.5.0"
checksum: 10c0/615241dae7851c8012f5aa0223005b1ed6607713d6813de0741768bd4ddc39353117648f1a7086b4b0fa45eae733f1c0a0fe369aa4e543bb63f8de8990178ea9 checksum: 10c0/615241dae7851c8012f5aa0223005b1ed6607713d6813de0741768bd4ddc39353117648f1a7086b4b0fa45eae733f1c0a0fe369aa4e543bb63f8de8990178ea9
languageName: node languageName: node
linkType: hard linkType: hard
"globals@npm:^17.0.0":
version: 17.0.0
resolution: "globals@npm:17.0.0"
checksum: 10c0/e3c169fdcb0fc6755707b697afb367bea483eb29992cfc0de1637382eb893146e17f8f96db6d7453e3696b478a7863ae2000e6c71cd2f4061410285106d3847a
languageName: node
linkType: hard
"gopd@npm:^1.2.0": "gopd@npm:^1.2.0":
version: 1.2.0 version: 1.2.0
resolution: "gopd@npm:1.2.0" resolution: "gopd@npm:1.2.0"
@@ -4690,24 +4681,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"nunjucks@npm:^3.0.0":
version: 3.2.4
resolution: "nunjucks@npm:3.2.4"
dependencies:
a-sync-waterfall: "npm:^1.0.0"
asap: "npm:^2.0.3"
commander: "npm:^5.1.0"
peerDependencies:
chokidar: ^3.3.0
peerDependenciesMeta:
chokidar:
optional: true
bin:
nunjucks-precompile: bin/precompile
checksum: 10c0/7fe5197559b7c09972c79e2a86f9c093459b9075bc9b41134cd2bc599ae93567b53bd09d472a748edc736192d9ccd2998aa8c20cfcbe6a3fffd281f91897c888
languageName: node
linkType: hard
"nx@npm:>=21.5.3 < 23.0.0": "nx@npm:>=21.5.3 < 23.0.0":
version: 22.3.3 version: 22.3.3
resolution: "nx@npm:22.3.3" resolution: "nx@npm:22.3.3"
@@ -5245,12 +5218,12 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"prettier@npm:^3.7.4": "prettier@npm:^3.8.0":
version: 3.7.4 version: 3.8.0
resolution: "prettier@npm:3.7.4" resolution: "prettier@npm:3.8.0"
bin: bin:
prettier: bin/prettier.cjs prettier: bin/prettier.cjs
checksum: 10c0/9675d2cd08eacb1faf1d1a2dbfe24bfab6a912b059fc9defdb380a408893d88213e794a40a2700bd29b140eb3172e0b07c852853f6e22f16f3374659a1a13389 checksum: 10c0/8926e9c9941a293b76c2d799089d038e9f6d84fb37702fc370bedd03b3c70d7fcf507e2e3c4f151f222d81820a3b74cac5e692c955cfafe34dd0d02616ce8327
languageName: node languageName: node
linkType: hard linkType: hard
@@ -5582,7 +5555,7 @@ __metadata:
"@advdominion/eslint-config": "workspace:*" "@advdominion/eslint-config": "workspace:*"
eslint: "npm:^9.39.2" eslint: "npm:^9.39.2"
lerna: "npm:^9.0.3" lerna: "npm:^9.0.3"
prettier: "npm:^3.7.4" prettier: "npm:^3.8.0"
languageName: unknown languageName: unknown
linkType: soft linkType: soft