Compare commits

..

50 Commits

Author SHA1 Message Date
36f0b0753e Publish
- @advdominion/lightbox-gallery@5.0.0
2026-08-14 09:36:47 +04:00
3ff0b19a49 lightbox-gallery: Обновление Swiper 2026-08-14 09:36:24 +04:00
bc22ebdc22 Перенесён lightbox-gallery 2026-08-14 09:35:00 +04:00
fad67c3603 Publish
- @advdominion/babel-plugin-nunjucks@4.0.0
2026-08-14 09:13:23 +04:00
1f3e4f0a6e Обновлены зависимости 2026-08-14 09:12:35 +04:00
70b66b7ec0 Обновлены зависимости, ESLint/Prettier заменены на Oxlint/Oxfmt, удалены настройки для VS Code 2026-06-21 00:46:00 +04:00
034b93a2d6 Publish
- @advdominion/eslint-config@2.1.0
2026-04-06 21:56:00 +04:00
f2170575fb Update @eslint-config dependencies 2026-04-06 21:55:21 +04:00
1c32452e60 Publish
- @advdominion/babel-plugin-nunjucks@3.1.1
 - @advdominion/css-var@1.0.1
 - @advdominion/eslint-config@2.0.0
 - @advdominion/scroll-to@1.0.1
 - @advdominion/stylelint-config@1.1.0
2026-02-19 22:02:57 +04:00
2e18f11fcf Убраны предупреждения Yarn 2026-02-19 21:56:19 +04:00
17378965fd Доработки по Styelint 2026-02-19 21:51:05 +04:00
14d13915c9 Обновлены зависимости для ESLint 2026-02-19 21:49:52 +04:00
369595c2de Remove pinst 2026-02-12 23:03:18 +04:00
49ce40cd7f @advdominion/stylelint-config 2026-02-12 23:01:06 +04:00
1a8f77622b Prettier 2026-02-12 20:30:06 +04:00
8cf1ddbaf5 Проверяем код ESLint/Prettier перед коммитом 2026-02-12 20:28:25 +04:00
8f2cae3401 @advdominion/css-var 2026-02-12 14:55:23 +04:00
a0074442ae Обновлены зависимости 2026-02-12 14:26:11 +04:00
791c160125 Доработки по конфигу ESLint 2026-02-12 14:22:55 +04:00
095724c175 ESLint обновнён до 10-й версии 2026-02-12 14:07:01 +04:00
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
d6aec9ed14 Publish
- @advdominion/babel-plugin-nunjucks@3.0.1
 - @advdominion/eslint-config@1.1.2
2026-01-21 14:57:22 +04:00
e8a3ea043f @advdominion/babel-plugin-nunjucks 2026-01-21 14:56:24 +04:00
cc8d0b7ab3 Fix yarn.lock 2026-01-21 14:55:04 +04:00
dfb04760f1 Исправлено название папки eslint-config 2025-12-26 11:55:33 +04:00
db9022c00b Настройка prettier.config.js 2025-12-26 11:54:25 +04:00
00c079c029 Publish
- @advdominion/eslint-config@1.1.1
 - @advdominion/get-scrollbar-width@2.0.1
 - @advdominion/is@1.0.2
 - @advdominion/pluralize@1.0.2
2025-12-26 11:39:46 +04:00
53dc2d3092 Репозитоий переименован во frontend, обновлены зависимости, добавлен eslint-config 2025-12-26 11:39:12 +04:00
Valentin Silytuin
9ac5f6bd28 Publish
- @advdominion/pluralize@1.0.1
2024-05-03 19:43:45 +04:00
Valentin Silytuin
09f069b727 Fix README.md in @advdominion/pluralize 2024-05-03 19:43:22 +04:00
Valentin Silytuin
f9dc305aae Update README.md 2024-05-03 19:39:02 +04:00
Valentin Silytuin
7d56c06702 Publish
- @advdominion/pluralize@1.0.0
2024-05-03 19:34:44 +04:00
Valentin Silytuin
0bb60a0e0a @advdominion/pluralize 2024-05-03 19:34:19 +04:00
Valentin Silytuin
205ea19086 Add README.md 2024-05-03 19:25:40 +04:00
Valentin Silytuin
1eff119186 Publish
- @advdominion/is@1.0.1
2024-05-03 19:24:09 +04:00
Valentin Silytuin
78e4fa36c0 Обновлён README.md в @advdominion/is 2024-05-03 19:23:51 +04:00
58 changed files with 6169 additions and 4058 deletions

View File

@@ -6,3 +6,6 @@ indent_size = 4
end_of_line = lf end_of_line = lf
trim_trailing_whitespace = true trim_trailing_whitespace = true
insert_final_newline = true insert_final_newline = true
[*.{json,yml,yaml}]
indent_size = 2

9
.gitignore vendored
View File

@@ -14,17 +14,14 @@ node_modules
!.yarn/sdks !.yarn/sdks
!.yarn/versions !.yarn/versions
# ESLint
.eslintcache
# Stylelint # Stylelint
.stylelintcache .stylelintcache
# Composer # https://github.com/github/gitignore/blob/main/Composer.gitignore
vendor composer.phar
/vendor/
# https://github.com/github/gitignore/blob/master/Global/Linux.gitignore # https://github.com/github/gitignore/blob/master/Global/Linux.gitignore

1
.husky/pre-commit Executable file
View File

@@ -0,0 +1 @@
yarn lint-staged

2
.nvmrc
View File

@@ -1 +1 @@
20.12 22.20

8
.oxfmtrc.json Normal file
View File

@@ -0,0 +1,8 @@
{
"printWidth": 120,
"singleQuote": true,
"quoteProps": "consistent",
"sortImports": true,
"sortPackageJson": false,
"ignorePatterns": [".docker", ".yarn", "html"]
}

97
.oxlintrc.json Normal file
View File

@@ -0,0 +1,97 @@
{
"plugins": ["eslint", "unicorn", "oxc", "vue"],
"categories": {
"correctness": "error",
"suspicious": "warn",
"pedantic": "warn",
"perf": "warn",
"style": "warn",
"restriction": "warn",
"nursery": "off"
},
"env": {
"browser": true,
"builtin": true
},
"rules": {
"eslint/capitalized-comments": "off",
"eslint/complexity": "off",
"eslint/id-length": "off",
"eslint/init-declarations": "off",
"eslint/max-depth": "off",
"eslint/max-lines": "off",
"eslint/max-lines-per-function": "off",
"eslint/max-statements": "off",
"eslint/no-console": ["warn", { "allow": ["info", "warn", "error"] }],
"eslint/no-inline-comments": "off",
"eslint/no-irregular-whitespace": ["error", { "skipTemplates": true }],
"eslint/no-magic-numbers": "off",
"eslint/no-new": "off",
"eslint/no-shadow": "off",
"eslint/no-ternary": "off",
"eslint/no-throw-literal": "off",
"eslint/no-undefined": "off",
"eslint/no-underscore-dangle": "off",
"eslint/no-unexpected-multiline": "off",
"eslint/prefer-destructuring": [
"warn",
{
"AssignmentExpression": {
"array": false,
"object": false
},
"VariableDeclarator": {
"array": false,
"object": true
}
}
],
"eslint/prefer-named-capture-group": "off",
"eslint/radix": "off",
"eslint/require-unicode-regexp": "off",
"eslint/sort-imports": "off",
"eslint/sort-keys": "off",
"oxc/no-async-await": "off",
"oxc/no-map-spread": "off",
"oxc/no-optional-chaining": "off",
"oxc/no-rest-spread-properties": "off",
"unicorn/filename-case": ["warn", { "cases": { "kebabCase": true, "pascalCase": true } }],
"unicorn/no-empty-file": "warn",
"unicorn/no-nested-ternary": "off",
"unicorn/no-useless-switch-case": "off",
"unicorn/prefer-global-this": "off",
"vue/define-props-destructuring": "off",
"vue/max-props": "off"
},
"overrides": [
{
"files": ["build-scripts/*.js"],
"rules": {
"eslint/no-console": "off"
}
},
{
"files": ["src/scripts/mocks/**/*.js"],
"rules": {
"eslint/no-console": "off",
"unicorn/prefer-ternary": "off"
}
},
{
"files": ["src/scripts/blocks/**/*.js"],
"rules": {
"unicorn/prefer-top-level-await": "off"
}
},
{
"files": ["src/scripts/composables/*.js"],
"rules": {
"unicorn/filename-case": ["warn", { "cases": { "camelCase": true } }]
}
}
],
"ignorePatterns": [".yarn"],
"options": {
"maxWarnings": 10
}
}

View File

@@ -1,2 +0,0 @@
.vscode
.yarn

View File

@@ -1,6 +0,0 @@
{
"recommendations": [
"arcanis.vscode-zipfs",
"esbenp.prettier-vscode"
]
}

View File

@@ -1,7 +0,0 @@
{
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs"
}

File diff suppressed because one or more lines are too long

1000
.yarn/releases/yarn-4.18.0.cjs vendored Executable file

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,3 @@
# This file is automatically generated by @yarnpkg/sdks. # This file is automatically generated by @yarnpkg/sdks.
# Manual changes might be lost! # Manual changes might be lost!
integrations:
- vscode

51
.yarn/sdks/oxfmt/bin/oxfmt vendored Executable file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, register} = require(`module`);
const {resolve} = require(`path`);
const {pathToFileURL} = require(`url`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
const absRequire = createRequire(absPnpApiPath);
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require oxfmt
require(absPnpApiPath).setup();
if (isPnpLoaderEnabled && register) {
register(pathToFileURL(absPnpLoaderPath));
}
}
if (typeof global[`__yarnpkg_sdk_has_setup_env__`] === `undefined`) {
Object.defineProperty(global, `__yarnpkg_sdk_has_setup_env__`, {configurable: true, value: true});
process.env.NODE_OPTIONS = process.env.NODE_OPTIONS || ``;
process.env.NODE_OPTIONS += ` -r ${absPnpApiPath}`;
if (isPnpLoaderEnabled && register) {
process.env.NODE_OPTIONS += ` --experimental-loader ${pathToFileURL(absPnpLoaderPath)}`;
}
}
}
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
? exports => absRequire(absUserWrapperPath)(exports)
: exports => exports;
const moduleWrapper = exports => {
return wrapWithUserWrapper(moduleWrapperFn(exports));
};
const moduleWrapperFn = module => module;
const binPath = resolve(absRequire.resolve(`oxfmt/package.json`), `..`, `bin/oxfmt`);
absRequire(binPath);
// Defer to the real oxfmt your application uses
module.exports = moduleWrapper(absRequire(`oxfmt`));

32
.yarn/sdks/oxfmt/dist/index.d.ts vendored Normal file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, register} = require(`module`);
const {resolve} = require(`path`);
const {pathToFileURL} = require(`url`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
const absRequire = createRequire(absPnpApiPath);
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require oxfmt
require(absPnpApiPath).setup();
if (isPnpLoaderEnabled && register) {
register(pathToFileURL(absPnpLoaderPath));
}
}
}
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
? exports => absRequire(absUserWrapperPath)(exports)
: exports => exports;
// Defer to the real oxfmt your application uses
module.exports = wrapWithUserWrapper(absRequire(`oxfmt`));

32
.yarn/sdks/oxfmt/dist/index.js vendored Normal file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, register} = require(`module`);
const {resolve} = require(`path`);
const {pathToFileURL} = require(`url`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
const absRequire = createRequire(absPnpApiPath);
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require oxfmt
require(absPnpApiPath).setup();
if (isPnpLoaderEnabled && register) {
register(pathToFileURL(absPnpLoaderPath));
}
}
}
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
? exports => absRequire(absUserWrapperPath)(exports)
: exports => exports;
// Defer to the real oxfmt your application uses
module.exports = wrapWithUserWrapper(absRequire(`oxfmt`));

16
.yarn/sdks/oxfmt/package.json vendored Normal file
View File

@@ -0,0 +1,16 @@
{
"name": "oxfmt",
"version": "0.55.0-sdk",
"main": "dist/index.js",
"type": "commonjs",
"bin": {
"oxfmt": "bin/oxfmt"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
}
}

43
.yarn/sdks/oxlint/bin/oxlint vendored Executable file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, register} = require(`module`);
const {resolve} = require(`path`);
const {pathToFileURL} = require(`url`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
const absRequire = createRequire(absPnpApiPath);
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require oxlint
require(absPnpApiPath).setup();
if (isPnpLoaderEnabled && register) {
register(pathToFileURL(absPnpLoaderPath));
}
}
}
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
? exports => absRequire(absUserWrapperPath)(exports)
: exports => exports;
const moduleWrapper = exports => {
return wrapWithUserWrapper(moduleWrapperFn(exports));
};
const moduleWrapperFn = module => module;
process.env.PATH += `;${resolve(__dirname, `../../oxlint-tsgolint/bin`)}`;
const binPath = resolve(absRequire.resolve(`oxlint/package.json`), `..`, `bin/oxlint`);
import(pathToFileURL(binPath));
// Defer to the real oxlint your application uses
module.exports = moduleWrapper(absRequire(`oxlint`));

32
.yarn/sdks/oxlint/dist/index.d.ts vendored Normal file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, register} = require(`module`);
const {resolve} = require(`path`);
const {pathToFileURL} = require(`url`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
const absRequire = createRequire(absPnpApiPath);
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require oxlint
require(absPnpApiPath).setup();
if (isPnpLoaderEnabled && register) {
register(pathToFileURL(absPnpLoaderPath));
}
}
}
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
? exports => absRequire(absUserWrapperPath)(exports)
: exports => exports;
// Defer to the real oxlint your application uses
module.exports = wrapWithUserWrapper(absRequire(`oxlint`));

32
.yarn/sdks/oxlint/dist/index.js vendored Normal file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, register} = require(`module`);
const {resolve} = require(`path`);
const {pathToFileURL} = require(`url`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
const absRequire = createRequire(absPnpApiPath);
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require oxlint
require(absPnpApiPath).setup();
if (isPnpLoaderEnabled && register) {
register(pathToFileURL(absPnpLoaderPath));
}
}
}
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
? exports => absRequire(absUserWrapperPath)(exports)
: exports => exports;
// Defer to the real oxlint your application uses
module.exports = wrapWithUserWrapper(absRequire(`oxlint`));

32
.yarn/sdks/oxlint/dist/plugins-dev.d.ts vendored Normal file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, register} = require(`module`);
const {resolve} = require(`path`);
const {pathToFileURL} = require(`url`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
const absRequire = createRequire(absPnpApiPath);
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require oxlint/plugins-dev
require(absPnpApiPath).setup();
if (isPnpLoaderEnabled && register) {
register(pathToFileURL(absPnpLoaderPath));
}
}
}
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
? exports => absRequire(absUserWrapperPath)(exports)
: exports => exports;
// Defer to the real oxlint/plugins-dev your application uses
module.exports = wrapWithUserWrapper(absRequire(`oxlint/plugins-dev`));

32
.yarn/sdks/oxlint/dist/plugins-dev.js vendored Normal file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire, register} = require(`module`);
const {resolve} = require(`path`);
const {pathToFileURL} = require(`url`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
const absRequire = createRequire(absPnpApiPath);
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require oxlint/plugins-dev
require(absPnpApiPath).setup();
if (isPnpLoaderEnabled && register) {
register(pathToFileURL(absPnpLoaderPath));
}
}
}
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
? exports => absRequire(absUserWrapperPath)(exports)
: exports => exports;
// Defer to the real oxlint/plugins-dev your application uses
module.exports = wrapWithUserWrapper(absRequire(`oxlint/plugins-dev`));

20
.yarn/sdks/oxlint/package.json vendored Normal file
View File

@@ -0,0 +1,20 @@
{
"name": "oxlint",
"version": "1.70.0-sdk",
"main": "dist/index.js",
"type": "commonjs",
"bin": {
"oxlint": "bin/oxlint"
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./plugins-dev": {
"types": "./dist/plugins-dev.d.ts",
"default": "./dist/plugins-dev.js"
},
"./package.json": "./package.json"
}
}

View File

@@ -1,20 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require prettier/bin/prettier.cjs
require(absPnpApiPath).setup();
}
}
// Defer to the real prettier/bin/prettier.cjs your application uses
module.exports = absRequire(`prettier/bin/prettier.cjs`);

View File

@@ -1,20 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require prettier
require(absPnpApiPath).setup();
}
}
// Defer to the real prettier your application uses
module.exports = absRequire(`prettier`);

View File

@@ -1,7 +0,0 @@
{
"name": "prettier",
"version": "3.2.5-sdk",
"main": "./index.cjs",
"type": "commonjs",
"bin": "./bin/prettier.cjs"
}

View File

@@ -1 +1,11 @@
yarnPath: .yarn/releases/yarn-4.1.1.cjs enableGlobalCache: false
packageExtensions:
'@advdominion/stylelint-config@*':
dependencies:
stylelint: '*'
lerna@*:
dependencies:
ci-info: '*'
yarnPath: .yarn/releases/yarn-4.18.0.cjs

27
README.md Normal file
View File

@@ -0,0 +1,27 @@
# frontend
## Добавление нового пакета
1. Скопировать один из существующих пакетов в папке `packages`
2. На его основе подготовить новый пакет
3. Запустить `yarn`
## Публикация новых версий
```bash
yarn lerna publish
```
## Обновление зависимостей
```bash
yarn set version stable
yarn upgrade-interactive
yarn dedupe
yarn dlx @yarnpkg/sdks base
yarn install
```

View File

@@ -1,5 +1,4 @@
{ {
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "independent", "version": "independent",
"npmClient": "yarn" "npmClient": "yarn"
} }

7
lint-staged.config.js Normal file
View File

@@ -0,0 +1,7 @@
export default {
'*.js': (filenames) => [
`oxlint --max-warnings 10 --fix ${filenames.join(' ')}`,
`oxfmt --write ${filenames.join(' ')}`,
],
'*.{json,md,yml}': (filenames) => [`oxfmt --write ${filenames.join(' ')}`],
};

View File

@@ -1,13 +1,18 @@
{ {
"name": "root",
"private": true, "private": true,
"type": "module", "type": "module",
"packageManager": "yarn@4.18.0",
"workspaces": [ "workspaces": [
"packages/*" "packages/*"
], ],
"devDependencies": { "scripts": {
"lerna": "^8.1.2", "postinstall": "husky"
"prettier": "^3.2.5"
}, },
"packageManager": "yarn@4.1.1" "devDependencies": {
"husky": "^9.1.7",
"lerna": "^10.0.0",
"lint-staged": "^17.3.0",
"oxfmt": "^0.63.0",
"oxlint": "^1.78.0"
}
} }

View File

@@ -0,0 +1,70 @@
# babel-plugin-nunjucks
Плагин для [babel-loader](https://github.com/babel/babel-loader), позволяющий использовать шаблонизатор [Nunjucks](https://mozilla.github.io/nunjucks/) внутри JS-файлов.
## Установка
```bash
yarn add -D @advdominion/babel-plugin-nunjucks
```
## Использование
Используются [Tagged templates](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates) с тегом `njk`:
```js
njk`
{% from "./item.njk" import item as item %}
<div class="items">
{% for n in range(0, 10) %}
{{item()}}
{% endfor %}
</div>
`;
```
Пример конфигурации Webpack:
```js
[
{
test: /\.js$/,
exclude: [/mocks\.js$/],
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true,
},
},
],
},
{
test: /mocks\.js$/,
use: [
{
loader: 'babel-loader',
options: {
compact: false,
plugins: [
[
'@advdominion/babel-plugin-nunjucks',
{
templatesFolder: 'src/templates/',
},
],
],
},
},
],
},
];
```
## Опции
- `templatesFolder` - строка, обязательный параметр. Путь до папки с файлами шаблонов
- `globals` - массив, необязательный параметр. Глобальные переменные для Nunjucks (например, `[{name: "message", value: "Hello, world!"}]`)
**Важно:** Параметр `cacheDirectory` в опциях babel-loader должен быть отключён.

View File

@@ -0,0 +1,25 @@
import nunjucks from 'nunjucks';
const babelPluginNunjucks = ({ types: t }) => {
return {
pre(state) {
const options = state.opts.plugins[0].options;
this.njkenv = new nunjucks.Environment(new nunjucks.FileSystemLoader(options.templatesFolder));
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));
}
},
},
};
};
export default babelPluginNunjucks;

View File

@@ -0,0 +1,18 @@
{
"name": "@advdominion/babel-plugin-nunjucks",
"version": "4.0.0",
"type": "module",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://gitea.optiweb.ru/public/frontend.git"
},
"license": "MIT",
"publishConfig": {
"access": "public"
},
"peerDependencies": {
"@babel/core": "^8.0.0",
"nunjucks": "^3.0.0"
}
}

View File

@@ -0,0 +1,25 @@
# css-var
Получение значений CSS-переменных в JS
## Использование
```css
:root {
--z-index: 100;
--height: 100px;
--duration-ms: 100ms;
--duration-s: 100s;
--easing: cubic-bezier(0.4, 0, 0.2, 1);
}
```
```js
import { cssVar } from '@advdominion/css-var';
cssVar('--z-index'); // '1' (String)
cssVar('--height'); // '100px' (String)
cssVar('--duration-ms'); // 100 (Number)
cssVar('--duration-s'); // 100 (Number)
cssVar('--easing'); // cubic-bezier(0.4, 0, 0.2, 1) (String)
```

View File

@@ -0,0 +1,9 @@
export const cssVar = (name, element = document.documentElement) => {
const value = window.getComputedStyle(element).getPropertyValue(name);
const durationRegExp = /(^[\d.]+)(ms|s)$/;
if (durationRegExp.test(value)) {
const [, numericValue, unit] = durationRegExp.exec(value);
return unit === 's' ? numericValue * 1000 : Number(numericValue);
}
return value;
};

View File

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

View File

@@ -1,11 +1,11 @@
{ {
"name": "@advdominion/get-scrollbar-width", "name": "@advdominion/get-scrollbar-width",
"version": "2.0.0", "version": "2.0.1",
"type": "module", "type": "module",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://gitea.optiweb.ru/public/helpers.git" "url": "https://gitea.optiweb.ru/public/frontend.git"
}, },
"license": "MIT", "license": "MIT",
"publishConfig": { "publishConfig": {

View File

@@ -1,9 +0,0 @@
# is
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

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

View File

@@ -0,0 +1,98 @@
# lightbox-gallery
## Требования
- [Swiper](https://github.com/nolimits4web/swiper)
## Подключение и настройка
### HTML
```html
<div id="list">
<a href="/example.jpg">...</a>
<a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">...</a>
<a href="https://vkvideo.ru/video-101556650_456239825">...</a>
</div>
```
### Стили
```scss
@use '@advdominion/lightbox-gallery/styles.css';
```
### Минимальные настройки
```js
import { gallery } from '@advdominion/lightbox-gallery';
gallery(document.querySelector('#list'), {
icons: {
close: `/icons.svg#close`,
},
});
```
### Все настройки
```js
import { gallery } from '@advdominion/lightbox-gallery';
gallery(document.querySelector('#list'), {
single: false,
swiper: {
speed: 300,
pagination: {
el: '.swiper-pagination',
},
navigation: {
prevEl: '.swiper-button-prev',
nextEl: '.swiper-button-next',
},
},
pagination: `
<div class="swiper-pagination"></div>
`,
navigation: `
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
`,
animation: {
show: {
duration: 500,
easing: 'linear',
},
hide: {
duration: 500,
easing: 'linear',
},
},
icons: {
close: `/icons.svg#close`,
},
});
```
### Одиночный элемент
```js
import { gallery } from '@advdominion/lightbox-gallery';
gallery(document.querySelector('#list > a:first-child'), {
single: true,
animation: {
show: {
duration: 500,
easing: 'linear',
},
hide: {
duration: 500,
easing: 'linear',
},
},
icons: {
close: `/icons.svg#close`,
},
});
```

View File

@@ -0,0 +1,424 @@
/* globals GalleryYTPlayer, YT, GalleryVKPlayer, VK */
import { getScrollbarWidth } from '@advdominion/get-scrollbar-width';
const getYTPlayer = () => {
const script = document.createElement('script');
script.src = 'https://www.youtube.com/player_api';
script.async = true;
document.body.append(script);
},
getVKPlayer = () => {
const script = document.createElement('script');
script.src = 'https://vk.com/js/api/videoplayer.js';
script.async = true;
document.body.append(script);
},
playVideo = (slide) => {
const youtube = slide.querySelector('.advdominion-lg__video_youtube'),
vk = slide.querySelector('.advdominion-lg__video_vk'),
rt = slide.querySelector('.advdominion-lg__video_rt');
if (youtube) {
if (slide.YTPlayer) {
if (slide.classList.contains('swiper-slide-active')) {
slide.YTPlayer.playVideo();
}
} else if (window.YT) {
if (GalleryYTPlayer.state) {
slide.YTPlayer = new YT.Player(youtube, {
videoId: youtube.dataset.id,
events: {
onReady(event) {
if (slide.classList.contains('swiper-slide-active')) {
event.target.playVideo();
}
},
},
});
} else {
GalleryYTPlayer.addListener(() => {
playVideo(slide);
});
}
} else {
getYTPlayer();
GalleryYTPlayer.addListener(() => {
playVideo(slide);
});
}
} else if (vk) {
if (slide.VKPlayer) {
if (slide.classList.contains('swiper-slide-active')) {
slide.VKPlayer.play();
}
} else if (window.VK?.VideoPlayer) {
if (GalleryVKPlayer.state) {
slide.VKPlayer = VK.VideoPlayer(vk);
slide.VKPlayer.on('inited', () => {
if (slide.classList.contains('swiper-slide-active')) {
slide.VKPlayer.play();
}
});
} else {
GalleryVKPlayer.addListener(() => {
playVideo(slide);
});
}
} else {
getVKPlayer();
GalleryVKPlayer.addListener(() => {
playVideo(slide);
});
}
} else if (rt) {
const videoId = /embed\/(\w+)/.exec(rt.getAttribute('src'))?.[1],
checkInterval = setInterval(() => {
if (window.GalleryRTPlayer) {
if (window.GalleryRTPlayer.has(videoId)) {
clearInterval(checkInterval);
if (slide.classList.contains('swiper-slide-active')) {
rt.contentWindow.postMessage(
JSON.stringify({
type: 'player:play',
data: {},
}),
'*',
);
}
}
} else {
clearInterval(checkInterval);
}
}, 100);
slide.checkInterval = checkInterval;
}
},
pauseVideo = (slide) => {
const youtube = slide.querySelector('.advdominion-lg__video_youtube'),
vk = slide.querySelector('.advdominion-lg__video_vk'),
rt = slide.querySelector('.advdominion-lg__video_rt');
if (youtube && slide.YTPlayer) {
slide.YTPlayer.pauseVideo();
} else if (vk && slide.VKPlayer) {
slide.VKPlayer.pause();
} else if (rt) {
rt.contentWindow.postMessage(
JSON.stringify({
type: 'player:pause',
data: {},
}),
'*',
);
}
},
setVideoSize = (gallery) => {
const items = gallery.querySelectorAll('.advdominion-lg__video-wrapper');
items[0].style.cssText = '';
let height = (items[0].getBoundingClientRect().width * 9) / 16,
width = '';
if (height > items[0].getBoundingClientRect().height) {
height = items[0].getBoundingClientRect().height;
width = `${(height * 16) / 9}px`;
}
for (const item of items) {
item.style.cssText = `
height: ${height}px;
width: ${width};
`;
}
},
hide = async (duration = 500, easing = 'linear') => {
const gallery = document.body.querySelector('.advdominion-lg');
await gallery.animate([{ opacity: 1 }, { opacity: 0 }], {
duration,
easing,
}).finished;
// Очищаем интервалы проверки для видео
for (const slide of gallery.querySelectorAll('.advdominion-lg__item_video')) {
if (slide.checkInterval) {
clearInterval(slide.checkInterval);
}
}
gallery.remove();
delete window.GalleryRTPlayer;
document.body.style.cssText = `
overflow: '';
margin-right: '';
`;
},
show = async (duration = 500, easing = 'linear') => {
const gallery = document.body.querySelector('.advdominion-lg');
document.body.style.cssText = `
overflow: hidden;
margin-right: ${getScrollbarWidth()}px
`;
await gallery.animate([{ opacity: 0 }, { opacity: 1 }], {
duration,
easing,
}).finished;
},
init = async (items = [], options = {}, index = 0) => {
const [{ default: Swiper }, { Navigation, Pagination }] = await Promise.all([
import('swiper'),
import('swiper/modules'),
]),
isVideoInGallery = {
yt: false,
vk: false,
rt: false,
};
items = items.map(({ url: item, caption }) => {
if (/youtube\.com\/watch\?v=/.test(item)) {
isVideoInGallery.yt = true;
return `
<div class="advdominion-lg__item advdominion-lg__item_video swiper-slide">
<div class="advdominion-lg__video-wrapper">
<div
class="advdominion-lg__video advdominion-lg__video_youtube"
data-id="${/v=([\w-]+)/i.exec(item)[1]}">
Загрузка YouTube-плеера...
</div>
</div>
${caption ? `<div class="advdominion-lg__caption">${caption}</div>` : ''}
</div>
`;
} else if (/(?:vkvideo\.ru|vk\.com)\/video/.test(item)) {
isVideoInGallery.vk = true;
const videoId = /(?:vkvideo\.ru|vk\.com)\/video(-?\d+)_(\d+)/.exec(item);
if (videoId === null) {
return `
<div class="advdominion-lg__item advdominion-lg__item_video swiper-slide">
<div class="advdominion-lg__video-wrapper">
<div class="advdominion-lg__video advdominion-lg__video_vk">
Ошибка при загрузке VK-плеера
</div>
</div>
${caption ? `<div class="advdominion-lg__caption">${caption}</div>` : ''}
</div>
`;
}
return `
<div class="advdominion-lg__item advdominion-lg__item_video swiper-slide">
<div class="advdominion-lg__video-wrapper">
<iframe
class="advdominion-lg__video advdominion-lg__video_vk"
src="https://vkvideo.ru/video_ext.php?oid=${videoId[1]}&id=${videoId[2]}&hd=4&js_api=1"
allow="autoplay; encrypted-media; fullscreen; picture-in-picture; screen-wake-lock;">
</iframe>
</div>
${caption ? `<div class="advdominion-lg__caption">${caption}</div>` : ''}
</div>
`;
} else if (/rutube\.ru/.test(item)) {
isVideoInGallery.rt = true;
const videoId = /video\/(\w+)/.exec(item);
if (videoId === null) {
return `
<div class="advdominion-lg__item advdominion-lg__item_video swiper-slide">
<div class="advdominion-lg__video-wrapper">
<div class="advdominion-lg__video advdominion-lg__video_rt">
Ошибка при загрузке RuTube-плеера
</div>
</div>
${caption ? `<div class="advdominion-lg__caption">${caption}</div>` : ''}
</div>
`;
}
return `
<div class="advdominion-lg__item advdominion-lg__item_video swiper-slide">
<div class="advdominion-lg__video-wrapper">
<iframe
class="advdominion-lg__video advdominion-lg__video_rt"
src="https://rutube.ru/play/embed/${videoId[1]}"
allow="autoplay; encrypted-media; fullscreen; picture-in-picture; screen-wake-lock;">
</iframe>
</div>
${caption ? `<div class="advdominion-lg__caption">${caption}</div>` : ''}
</div>
`;
}
return `
<div class="advdominion-lg__item swiper-slide">
<img class="advdominion-lg__image" src="${item}" alt="" loading="lazy">
${caption ? `<div class="advdominion-lg__caption">${caption}</div>` : ''}
</div>
`;
});
if (isVideoInGallery.yt && !window.GalleryYTPlayer) {
window.GalleryYTPlayer = {
state: false,
get init() {
return this.state;
},
set init(val) {
this.state = val;
for (const i of this.callback) {
i(val);
}
},
callback: [],
addListener(callback) {
this.callback.push(callback);
},
};
window.onYouTubeIframeAPIReady = () => {
window.GalleryYTPlayer.init = true;
};
}
if (isVideoInGallery.vk && !window.GalleryVKPlayer) {
window.GalleryVKPlayer = {
state: false,
get init() {
return this.state;
},
set init(val) {
this.state = val;
for (const i of this.callback) {
i(val);
}
},
callback: [],
addListener(callback) {
this.callback.push(callback);
},
};
const checkInterval = setInterval(() => {
if (window.VK?.VideoPlayer) {
clearInterval(checkInterval);
window.GalleryVKPlayer.init = true;
}
}, 100);
}
if (isVideoInGallery.rt) {
window.GalleryRTPlayer = new Set();
window.addEventListener('message', (event) => {
if (event.origin.includes('rutube.ru') && typeof event.data === 'string') {
const message = JSON.parse(event.data);
if (message.type === 'player:ready') {
window.GalleryRTPlayer.add(message.data.videoId);
}
}
});
}
document.body.insertAdjacentHTML(
'beforeend',
`
<div class="advdominion-lg">
<button class="advdominion-lg__close" type="button">
<svg class="advdominion-lg__close-icon"><use href="${options.icons.close}" /></svg>
</button>
<div class="advdominion-lg__container swiper">
<div class="advdominion-lg__wrapper swiper-wrapper">
${items.join('')}
</div>
${options.pagination || ''}
${options.navigation || ''}
</div>
</div>
`,
);
const gallery = document.body.querySelector('.advdominion-lg');
gallery.querySelector('.advdominion-lg__container').style.cssText = `
visibility: hidden;
`;
await show(options?.animation?.show?.duration, options?.animation?.show?.easing);
const swiper = new Swiper(gallery.querySelector('.advdominion-lg__container'), {
init: false,
initialSlide: index,
...options.swiper,
modules: [...new Set([Navigation, Pagination, ...(options.swiper?.modules || [])])],
});
swiper.on('init', function init() {
gallery.querySelector('.advdominion-lg__container').style.cssText = `
visibility: '';
`;
if (this.slides[this.activeIndex].classList.contains('advdominion-lg__item_video')) {
playVideo(this.slides[this.activeIndex]);
}
if (isVideoInGallery.yt || isVideoInGallery.vk || isVideoInGallery.rt) {
setVideoSize(gallery);
}
});
swiper.on('slideChange', function init() {
setTimeout(() => {
for (const [index, slide] of Object.entries(this.slides)) {
if (slide.classList.contains('advdominion-lg__item_video')) {
if (Number(index) === this.activeIndex) {
playVideo(slide);
} else {
pauseVideo(slide);
}
}
}
}, 0);
});
swiper.on('resize', () => {
if (isVideoInGallery.yt || isVideoInGallery.vk || isVideoInGallery.rt) {
setVideoSize(gallery);
}
});
swiper.init();
const closeHandler = () => {
hide(options?.animation?.hide?.duration, options?.animation?.hide?.easing);
},
keydownHandler = (e) => {
if (e.key === 'Escape') {
closeHandler();
document.body.removeEventListener('keydown', keydownHandler);
}
};
gallery.querySelector('.advdominion-lg__close').addEventListener('click', closeHandler);
document.body.addEventListener('keydown', keydownHandler);
};
export const gallery = (container, options) => {
const items = [];
if (options.single) {
const element = container.children[0];
items.push({
url: element.href,
caption: document.querySelector(element.dataset.galleryCaption)?.textContent,
});
container.addEventListener('click', (event) => {
event.preventDefault();
init(items, options);
});
} else {
for (const [index, element] of [...container.children].entries()) {
items.push({
url: element.href,
caption: document.querySelector(element.dataset.galleryCaption)?.textContent,
});
element.addEventListener('click', (event) => {
event.preventDefault();
init(items, options, index);
});
}
}
};

View File

@@ -0,0 +1,20 @@
{
"name": "@advdominion/lightbox-gallery",
"version": "5.0.0",
"type": "module",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://gitea.optiweb.ru/public/lightbox-gallery.git"
},
"license": "MIT",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@advdominion/get-scrollbar-width": "^2.0.0"
},
"peerDependencies": {
"swiper": "^14.0.0"
}
}

View File

@@ -0,0 +1,75 @@
.advdominion-lg {
background-color: white;
height: 100%;
left: 0;
position: fixed;
top: 0;
width: 100%;
z-index: 999;
}
.advdominion-lg__close {
position: absolute;
right: 0;
top: 0;
z-index: 2;
}
.advdominion-lg__close-icon {
fill: currentcolor;
height: 25px;
width: 25px;
}
.advdominion-lg__container.swiper {
height: 100%;
}
.advdominion-lg__wrapper.swiper-wrapper {
}
.advdominion-lg__item.swiper-slide {
align-items: center;
display: flex;
flex-direction: column;
gap: 25px;
justify-content: center;
}
.advdominion-lg__item_video.swiper-slide {
}
.advdominion-lg__image {
max-height: 100%;
max-width: 100%;
}
.advdominion-lg__video-wrapper {
height: 100%;
position: relative;
width: 100%;
}
.advdominion-lg__video {
border: none;
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
}
div.advdominion-lg__video {
align-items: center;
display: flex;
justify-content: center;
}
.advdominion-lg__video_youtube {
}
.advdominion-lg__video_vk {
}
.advdominion-lg__caption {
}

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

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

View File

@@ -0,0 +1,11 @@
# pluralize
Склонение существительных в зависимости от числа
## Использование
```js
import { pluralize } from '@advdominion/pluralize';
console.log(pluralize(1, ['яблоко', 'яблока', 'яблок']));
```

View File

@@ -0,0 +1,14 @@
export const pluralize = (count, words) => {
const normalizedCount = Math.abs(count) % 100;
const count10 = normalizedCount % 10;
if (normalizedCount > 10 && normalizedCount < 20) {
return words[2];
}
if (count10 > 1 && count10 < 5) {
return words[1];
}
if (count10 === 1) {
return words[0];
}
return words[2];
};

View File

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

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.1",
"type": "module",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://gitea.optiweb.ru/public/frontend.git"
},
"license": "MIT",
"publishConfig": {
"access": "public"
}
}

View File

@@ -0,0 +1,22 @@
# Конфигурация для Stylelint
Включает в себя:
- [stylelint-config-standard-scss](https://github.com/stylelint-scss/stylelint-config-standard-scss)
- [stylelint-order](https://github.com/hudochenkov/stylelint-order)
- Проверку кода тега `<style>` в файлах `.vue`
## Использование
### Требования
- [Stylelint](https://stylelint.io/) ^10.0.0
### Подключание
```js
export default {
extends: ['@advdominion/stylelint-config'],
// Дополнительная конфигурация проекта
};
```

View File

@@ -0,0 +1,55 @@
/* eslint-disable unicorn/no-null */
export default {
extends: ['stylelint-config-standard-scss'],
overrides: [
{
files: ['**/*.vue'],
customSyntax: 'postcss-html',
},
],
plugins: ['stylelint-order'],
rules: {
'block-no-empty': null,
'no-invalid-double-slash-comments': null,
'no-invalid-position-declaration': [true, { ignoreAtRules: ['media'] }],
'property-disallowed-list': [
'animation',
'background',
'border',
'flex',
'font',
'grid',
'margin',
'padding',
'transition',
],
'color-hex-length': 'long',
'font-weight-notation': 'named-where-possible',
'container-name-pattern': null,
'custom-media-pattern': null,
'custom-property-pattern': null,
'keyframes-name-pattern': null,
'layer-name-pattern': null,
'selector-class-pattern': null,
'selector-id-pattern': null,
'declaration-block-no-redundant-longhand-properties': null,
'scss/double-slash-comment-empty-line-before': null,
'order/order': [
{
type: 'at-rule',
name: 'use',
},
'dollar-variables',
'custom-properties',
'declarations',
{
type: 'at-rule',
name: 'include',
},
'at-rules',
'rules',
],
'order/properties-alphabetical-order': true,
},
};

View File

@@ -0,0 +1,23 @@
{
"name": "@advdominion/stylelint-config",
"version": "1.1.0",
"type": "module",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://gitea.optiweb.ru/public/frontend.git"
},
"license": "MIT",
"publishConfig": {
"access": "public"
},
"dependencies": {
"postcss": "^8.5.6",
"postcss-html": "^1.8.1",
"stylelint-config-standard-scss": "^17.0.0",
"stylelint-order": "^7.0.1"
},
"peerDependencies": {
"stylelint": "^17.0.0"
}
}

View File

@@ -1,5 +0,0 @@
export default {
printWidth: 120,
tabWidth: 4,
singleQuote: true,
};

6602
yarn.lock

File diff suppressed because it is too large Load Diff