change resolution algo, update eslint, lint and prettier commands

This commit is contained in:
Rene Haas
2022-10-01 02:31:32 +02:00
parent eb99eba55e
commit 64a0d873f4
117 changed files with 900 additions and 508 deletions
+58 -46
View File
@@ -1,13 +1,48 @@
const resolve = require('@~local/config/resolve');
const defaultRules = {
'func-names': 'off',
'no-plusplus': 'off',
'no-continue': 'off',
'no-param-reassign': 'off',
'no-nested-ternary': 'off',
'no-underscore-dangle': 'off',
'no-multi-assign': 'off',
'no-unused-expressions': ['error', { allowShortCircuit: true, allowTernary: true }],
'no-console': ['error', { allow: ['warn', 'error'] }],
'no-empty': ['error', { allowEmptyCatch: true }],
'no-cond-assign': ['error', 'except-parens'],
camelcase: ['error', { allow: ['^__', '^UNSAFE_'] }],
'prefer-destructuring': 'off',
'consistent-return': 'off',
'import/prefer-default-export': 'off',
'import/no-extraneous-dependencies': 'off',
'import/extensions': [
'off',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
'import/order': [
'error',
{
groups: ['builtin', 'external', 'index', 'internal', 'unknown', 'type'],
pathGroups: [
{
pattern: '**/*.{css,scss,sass}',
group: 'unknown',
position: 'after',
},
],
},
],
};
module.exports = {
extends: ['airbnb', 'prettier'],
env: {
browser: true,
es2020: true,
node: true,
jest: true,
},
plugins: ['prettier', 'json', '@typescript-eslint', 'import'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
@@ -16,59 +51,35 @@ module.exports = {
ecmaVersion: 11,
sourceType: 'module',
},
env: {
browser: true,
es2020: true,
node: true,
jest: true,
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
node: {
extensions: resolve.extensions,
moduleDirectory: resolve.directories,
typescript: {
alwaysTryTypes: true,
project: ['./packages/**/tsconfig.json', './local/**/tsconfig.json'],
},
},
},
plugins: ['prettier', 'json', 'react', 'jest', 'import', '@typescript-eslint'],
rules: {
'func-names': 'off',
'no-plusplus': 'off',
'no-continue': 'off',
'no-param-reassign': 'off',
'no-nested-ternary': 'off',
'no-underscore-dangle': 'off',
'no-multi-assign': 'off',
'no-unused-expressions': ['error', { allowShortCircuit: true, allowTernary: true }],
'no-console': ['error', { allow: ['warn', 'error'] }],
'no-empty': ['error', { allowEmptyCatch: true }],
'no-cond-assign': ['error', 'except-parens'],
camelcase: ['error', { allow: ['^__', '^UNSAFE_'] }],
'prefer-destructuring': 'off',
'consistent-return': 'off',
'import/prefer-default-export': 'off',
'import/no-extraneous-dependencies': 'off',
'import/no-unresolved': [
'error',
{
ignore: [`^@/.*`],
},
],
'import/extensions': [
'off',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
},
rules: defaultRules,
overrides: [
{
files: ['*.ts', '*.tsx', '*.d.ts'],
extends: ['plugin:@typescript-eslint/recommended', 'plugin:react/recommended'],
extends: ['plugin:@typescript-eslint/recommended', 'airbnb', 'prettier'],
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./packages/**/tsconfig.json', './local/**/tsconfig.json'],
},
rules: {
...defaultRules,
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],
'no-use-before-define': 'off',
@@ -83,6 +94,7 @@ module.exports = {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/consistent-type-imports': 'warn',
'@typescript-eslint/no-this-alias': [
'error',
{
-1
View File
@@ -3,7 +3,6 @@
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "es5",
"jsxBracketSameLine": true,
"arrowParens": "always",
"endOfLine": "lf",
"parser": "babel-ts",
+3
View File
@@ -4,6 +4,7 @@ const resolve = require('./resolve');
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html
/** @type {import('jest').Config} */
module.exports = {
coverageDirectory: './.coverage/jest',
projects: [
@@ -16,6 +17,7 @@ module.exports = {
moduleFileExtensions: resolve.extensions.map((ext) => ext.replace(/\./, '')),
testPathIgnorePatterns: ['\\\\node_modules\\\\'],
setupFilesAfterEnv: [path.resolve(__dirname, './jest.setup.js')],
...resolve.paths.jest,
},
{
displayName: 'jsdom',
@@ -26,6 +28,7 @@ module.exports = {
moduleFileExtensions: resolve.extensions.map((ext) => ext.replace(/\./, '')),
testPathIgnorePatterns: ['\\\\node_modules\\\\'],
setupFilesAfterEnv: [path.resolve(__dirname, './jest.setup.js')],
...resolve.paths.jest,
},
],
};
+15 -2
View File
@@ -1,5 +1,18 @@
{
"extensions": [".json", ".js", ".jsx", ".cjs", ".mjs", ".ts", ".tsx"],
"directories": ["node_modules", "src"],
"styleExtensions": [".scss", ".sass", ".css"]
"styleExtensions": [".scss", ".sass", ".css"],
"directories": ["node_modules"],
"paths": {
"jest": {
"moduleNameMapper": {
"^~/(.*)": "<rootDir>/src/$1"
}
},
"rollupAlias": {
"^~/(.*)": "<rootDir>/src/$1"
},
"rollupTypes": {
"~/*": ["<typesDir>/*"]
}
}
}
+17 -2
View File
@@ -19,9 +19,24 @@ const normalizePath = (pathName) =>
pathName ? pathName.split(path.sep).join(path.posix.sep) : pathName;
module.exports = {
rollupAlias: (aliasEntries) =>
rollupAlias: (resolve, aliasEntries) =>
rollupPluginAlias({
entries: aliasEntries,
entries: [
...Object.entries(aliasEntries).reduce((arr, [key, value]) => {
arr.push({
find: key,
replacement: value,
});
return arr;
}, []),
...Object.entries(resolve.paths.rollupAlias).reduce((arr, [key, value]) => {
arr.push({
find: new RegExp(key),
replacement: value.replace('<rootDir>', normalizePath(process.cwd())),
});
return arr;
}, []),
],
}),
rollupCommonjs: (sourcemap, resolve) =>
rollupPluginCommonjs({
+1 -1
View File
@@ -64,7 +64,7 @@ module.exports = (resolve, options) => {
...rollupOptions,
plugins: [
rollupLicense(banner, sourcemap),
rollupAlias(alias),
rollupAlias(resolve, alias),
rollupScss(resolve, sourcemap, extractStyles, false),
rollupTs(input),
rollupResolve(resolve),
+1 -1
View File
@@ -29,7 +29,7 @@ module.exports = (resolve, options) => {
...rollupOptions,
plugins: [
rollupLicense(banner, sourcemap),
rollupAlias(alias),
rollupAlias(resolve, alias),
rollupScss(resolve, sourcemap, extractStyles, false),
rollupEsBuild(sourcemap),
rollupCommonjs(sourcemap, resolve),
+1 -1
View File
@@ -11,7 +11,7 @@ module.exports = (resolve, options) => {
const pipeline = (cssFilename, minified) => ({
input,
plugins: [
rollupAlias(alias),
rollupAlias(resolve, alias),
rollupScss(
resolve,
sourcemap && !minified,
+8 -1
View File
@@ -23,6 +23,7 @@ module.exports = (resolve, options) => {
output: {
file: path.resolve(typesPath, `${file}`),
},
external: [...resolve.styleExtensions.map((ext) => new RegExp(`.*\\${ext}`))],
plugins: [rollupTs(input, true)],
},
{
@@ -30,11 +31,17 @@ module.exports = (resolve, options) => {
output: {
file: dtsOutput,
},
external: [...resolve.styleExtensions.map((ext) => new RegExp(`.*\\${ext}`))],
plugins: [
rollupDts.default({
respectExternal: true,
compilerOptions: {
baseUrl: typesPath,
paths: {
...Object.entries(resolve.paths.rollupTypes).reduce((obj, [key, value]) => {
obj[key] = value.map((entry) => entry.replace('<typesDir>', typesPath));
return obj;
}, {}),
},
},
}),
{
+331 -12
View File
@@ -36,13 +36,12 @@
"eslint": "^8.20.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^3.5.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.8.0",
"eslint-plugin-json": "^3.1.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.30.0",
"eslint-plugin-react-hooks": "^4.6.0",
"glob": "^7.1.6",
"istanbul-lib-instrument": "^5.2.0",
"jest": "^28.1.3",
@@ -2448,6 +2447,26 @@
"node": ">= 8"
}
},
"node_modules/@pkgr/utils": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.3.1.tgz",
"integrity": "sha512-wfzX8kc1PMyUILA+1Z/EqoE4UCXGy0iRGMhPwdfae1+f0OXlLqCk+By+aMzgJBzR9AzS4CDizioG6Ss1gvAFJw==",
"dev": true,
"dependencies": {
"cross-spawn": "^7.0.3",
"is-glob": "^4.0.3",
"open": "^8.4.0",
"picocolors": "^1.0.0",
"tiny-glob": "^0.2.9",
"tslib": "^2.4.0"
},
"engines": {
"node": "^12.20.0 || ^14.18.0 || >=16.0.0"
},
"funding": {
"url": "https://opencollective.com/unts"
}
},
"node_modules/@playwright/test": {
"version": "1.22.2",
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.22.2.tgz",
@@ -3513,6 +3532,7 @@
"resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.0.tgz",
"integrity": "sha512-PZC9/8TKAIxcWKdyeb77EzULHPrIX/tIZebLJUQOMR1OwYosT8yggdfWScfTBCDj5utONvOuPQQumYsU2ULbkg==",
"dev": true,
"peer": true,
"dependencies": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.3",
@@ -4475,6 +4495,15 @@
"node": ">=8"
}
},
"node_modules/define-lazy-prop": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",
"integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/define-properties": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz",
@@ -5314,6 +5343,62 @@
"ms": "^2.1.1"
}
},
"node_modules/eslint-import-resolver-typescript": {
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.5.1.tgz",
"integrity": "sha512-U7LUjNJPYjNsHvAUAkt/RU3fcTSpbllA0//35B4eLYTX74frmOepbt7F7J3D1IGtj9k21buOpaqtDd4ZlS/BYQ==",
"dev": true,
"dependencies": {
"debug": "^4.3.4",
"enhanced-resolve": "^5.10.0",
"get-tsconfig": "^4.2.0",
"globby": "^13.1.2",
"is-core-module": "^2.10.0",
"is-glob": "^4.0.3",
"synckit": "^0.8.3"
},
"engines": {
"node": "^12.20.0 || ^14.18.0 || >=16.0.0"
},
"funding": {
"url": "https://opencollective.com/unts"
},
"peerDependencies": {
"eslint": "*",
"eslint-plugin-import": "*"
}
},
"node_modules/eslint-import-resolver-typescript/node_modules/globby": {
"version": "13.1.2",
"resolved": "https://registry.npmjs.org/globby/-/globby-13.1.2.tgz",
"integrity": "sha512-LKSDZXToac40u8Q1PQtZihbNdTYSNMuWe+K5l+oa6KgDzSvVrHXlJy40hUP522RjAIoNLJYBJi7ow+rbFpIhHQ==",
"dev": true,
"dependencies": {
"dir-glob": "^3.0.1",
"fast-glob": "^3.2.11",
"ignore": "^5.2.0",
"merge2": "^1.4.1",
"slash": "^4.0.0"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/eslint-import-resolver-typescript/node_modules/slash": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz",
"integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==",
"dev": true,
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/eslint-module-utils": {
"version": "2.7.3",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz",
@@ -5547,6 +5632,7 @@
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.30.0.tgz",
"integrity": "sha512-RgwH7hjW48BleKsYyHK5vUAvxtE9SMPDKmcPRQgtRCYaZA0XQPt5FSkrU3nhz5ifzMZcA8opwmRJ2cmOO8tr5A==",
"dev": true,
"peer": true,
"dependencies": {
"array-includes": "^3.1.5",
"array.prototype.flatmap": "^1.3.0",
@@ -5575,6 +5661,7 @@
"resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz",
"integrity": "sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==",
"dev": true,
"peer": true,
"engines": {
"node": ">=10"
},
@@ -5587,6 +5674,7 @@
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
"integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
"dev": true,
"peer": true,
"dependencies": {
"esutils": "^2.0.2"
},
@@ -5599,6 +5687,7 @@
"resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz",
"integrity": "sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==",
"dev": true,
"peer": true,
"dependencies": {
"is-core-module": "^2.9.0",
"path-parse": "^1.0.7",
@@ -6237,6 +6326,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-tsconfig": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.2.0.tgz",
"integrity": "sha512-X8u8fREiYOE6S8hLbq99PeykTDoLVnxvF4DjWKJmz9xy2nNRdUcV8ZN9tniJFeKyTU3qnC9lL8n4Chd6LmVKHg==",
"dev": true,
"funding": {
"url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
}
},
"node_modules/glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
@@ -6284,6 +6382,12 @@
"node": ">=4"
}
},
"node_modules/globalyzer": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz",
"integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==",
"dev": true
},
"node_modules/globby": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
@@ -6304,6 +6408,12 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/globrex": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz",
"integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==",
"dev": true
},
"node_modules/graceful-fs": {
"version": "4.2.10",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
@@ -6667,9 +6777,9 @@
}
},
"node_modules/is-core-module": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz",
"integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==",
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz",
"integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==",
"dev": true,
"dependencies": {
"has": "^1.0.3"
@@ -6693,6 +6803,21 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/is-docker": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
"integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
"dev": true,
"bin": {
"is-docker": "cli.js"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -6886,6 +7011,18 @@
"node": ">=0.10.0"
}
},
"node_modules/is-wsl": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
"dev": true,
"dependencies": {
"is-docker": "^2.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@@ -8302,6 +8439,7 @@
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
"integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
"dev": true,
"peer": true,
"dependencies": {
"js-tokens": "^3.0.0 || ^4.0.0"
},
@@ -8719,6 +8857,7 @@
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
"dev": true,
"peer": true,
"engines": {
"node": ">=0.10.0"
}
@@ -8778,6 +8917,7 @@
"resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.5.tgz",
"integrity": "sha512-CAyG5mWQRRiBU57Re4FKoTBjXfDoNwdFVH2Y1tS9PqCsfUTymAohOkEMSG3aRNKmv4lV3O7p1et7c187q6bynw==",
"dev": true,
"peer": true,
"dependencies": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.3",
@@ -8795,6 +8935,7 @@
"resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.1.tgz",
"integrity": "sha512-LYLe4tivNQzq4JdaWW6WO3HMZZJWzkkH8fnI6EebWl0VZth2wL2Lovm74ep2/gZzlaTdV62JZHEqHQ2yVn8Q/A==",
"dev": true,
"peer": true,
"dependencies": {
"define-properties": "^1.1.4",
"es-abstract": "^1.19.5"
@@ -8844,6 +8985,23 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/open": {
"version": "8.4.0",
"resolved": "https://registry.npmjs.org/open/-/open-8.4.0.tgz",
"integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==",
"dev": true,
"dependencies": {
"define-lazy-prop": "^2.0.0",
"is-docker": "^2.1.1",
"is-wsl": "^2.2.0"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/opener": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz",
@@ -9798,6 +9956,7 @@
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
"integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==",
"dev": true,
"peer": true,
"dependencies": {
"loose-envify": "^1.4.0",
"object-assign": "^4.1.1",
@@ -9808,7 +9967,8 @@
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
"dev": true
"dev": true,
"peer": true
},
"node_modules/psl": {
"version": "1.8.0",
@@ -10774,6 +10934,7 @@
"resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.7.tgz",
"integrity": "sha512-f48okCX7JiwVi1NXCVWcFnZgADDC/n2vePlQ/KUCNqCikLLilQvwjMO8+BHVKvgzH0JB0J9LEPgxOGT02RoETg==",
"dev": true,
"peer": true,
"dependencies": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.3",
@@ -10947,6 +11108,22 @@
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==",
"dev": true
},
"node_modules/synckit": {
"version": "0.8.4",
"resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.4.tgz",
"integrity": "sha512-Dn2ZkzMdSX827QbowGbU/4yjWuvNaCoScLLoMo/yKbu+P4GBR6cRGKZH27k6a9bRzdqcyd1DE96pQtQ6uNkmyw==",
"dev": true,
"dependencies": {
"@pkgr/utils": "^2.3.1",
"tslib": "^2.4.0"
},
"engines": {
"node": "^14.18.0 || >=16.0.0"
},
"funding": {
"url": "https://opencollective.com/unts"
}
},
"node_modules/tapable": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",
@@ -11082,6 +11259,16 @@
"integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==",
"dev": true
},
"node_modules/tiny-glob": {
"version": "0.2.9",
"resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz",
"integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==",
"dev": true,
"dependencies": {
"globalyzer": "0.1.0",
"globrex": "^0.1.2"
}
},
"node_modules/tmpl": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
@@ -11760,7 +11947,7 @@
}
},
"packages/overlayscrollbars": {
"version": "2.0.0-beta.1",
"version": "2.0.0-beta.2",
"license": "MIT"
}
},
@@ -13457,6 +13644,20 @@
"fastq": "^1.6.0"
}
},
"@pkgr/utils": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.3.1.tgz",
"integrity": "sha512-wfzX8kc1PMyUILA+1Z/EqoE4UCXGy0iRGMhPwdfae1+f0OXlLqCk+By+aMzgJBzR9AzS4CDizioG6Ss1gvAFJw==",
"dev": true,
"requires": {
"cross-spawn": "^7.0.3",
"is-glob": "^4.0.3",
"open": "^8.4.0",
"picocolors": "^1.0.0",
"tiny-glob": "^0.2.9",
"tslib": "^2.4.0"
}
},
"@playwright/test": {
"version": "1.22.2",
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.22.2.tgz",
@@ -14294,6 +14495,7 @@
"resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.0.tgz",
"integrity": "sha512-PZC9/8TKAIxcWKdyeb77EzULHPrIX/tIZebLJUQOMR1OwYosT8yggdfWScfTBCDj5utONvOuPQQumYsU2ULbkg==",
"dev": true,
"peer": true,
"requires": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.3",
@@ -15017,6 +15219,12 @@
"strip-bom": "^4.0.0"
}
},
"define-lazy-prop": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",
"integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==",
"dev": true
},
"define-properties": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz",
@@ -15600,6 +15808,42 @@
}
}
},
"eslint-import-resolver-typescript": {
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.5.1.tgz",
"integrity": "sha512-U7LUjNJPYjNsHvAUAkt/RU3fcTSpbllA0//35B4eLYTX74frmOepbt7F7J3D1IGtj9k21buOpaqtDd4ZlS/BYQ==",
"dev": true,
"requires": {
"debug": "^4.3.4",
"enhanced-resolve": "^5.10.0",
"get-tsconfig": "^4.2.0",
"globby": "^13.1.2",
"is-core-module": "^2.10.0",
"is-glob": "^4.0.3",
"synckit": "^0.8.3"
},
"dependencies": {
"globby": {
"version": "13.1.2",
"resolved": "https://registry.npmjs.org/globby/-/globby-13.1.2.tgz",
"integrity": "sha512-LKSDZXToac40u8Q1PQtZihbNdTYSNMuWe+K5l+oa6KgDzSvVrHXlJy40hUP522RjAIoNLJYBJi7ow+rbFpIhHQ==",
"dev": true,
"requires": {
"dir-glob": "^3.0.1",
"fast-glob": "^3.2.11",
"ignore": "^5.2.0",
"merge2": "^1.4.1",
"slash": "^4.0.0"
}
},
"slash": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz",
"integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==",
"dev": true
}
}
},
"eslint-module-utils": {
"version": "2.7.3",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz",
@@ -15771,6 +16015,7 @@
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.30.0.tgz",
"integrity": "sha512-RgwH7hjW48BleKsYyHK5vUAvxtE9SMPDKmcPRQgtRCYaZA0XQPt5FSkrU3nhz5ifzMZcA8opwmRJ2cmOO8tr5A==",
"dev": true,
"peer": true,
"requires": {
"array-includes": "^3.1.5",
"array.prototype.flatmap": "^1.3.0",
@@ -15793,6 +16038,7 @@
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
"integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
"dev": true,
"peer": true,
"requires": {
"esutils": "^2.0.2"
}
@@ -15802,6 +16048,7 @@
"resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz",
"integrity": "sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==",
"dev": true,
"peer": true,
"requires": {
"is-core-module": "^2.9.0",
"path-parse": "^1.0.7",
@@ -15815,6 +16062,7 @@
"resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz",
"integrity": "sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==",
"dev": true,
"peer": true,
"requires": {}
},
"eslint-scope": {
@@ -16221,6 +16469,12 @@
"get-intrinsic": "^1.1.1"
}
},
"get-tsconfig": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.2.0.tgz",
"integrity": "sha512-X8u8fREiYOE6S8hLbq99PeykTDoLVnxvF4DjWKJmz9xy2nNRdUcV8ZN9tniJFeKyTU3qnC9lL8n4Chd6LmVKHg==",
"dev": true
},
"glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
@@ -16256,6 +16510,12 @@
"integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==",
"dev": true
},
"globalyzer": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz",
"integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==",
"dev": true
},
"globby": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
@@ -16270,6 +16530,12 @@
"slash": "^3.0.0"
}
},
"globrex": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz",
"integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==",
"dev": true
},
"graceful-fs": {
"version": "4.2.10",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
@@ -16532,9 +16798,9 @@
"dev": true
},
"is-core-module": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz",
"integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==",
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz",
"integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==",
"dev": true,
"requires": {
"has": "^1.0.3"
@@ -16549,6 +16815,12 @@
"has-tostringtag": "^1.0.0"
}
},
"is-docker": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
"integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
"dev": true
},
"is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -16682,6 +16954,15 @@
"integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==",
"dev": true
},
"is-wsl": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
"dev": true,
"requires": {
"is-docker": "^2.0.0"
}
},
"isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@@ -17770,6 +18051,7 @@
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
"integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
"dev": true,
"peer": true,
"requires": {
"js-tokens": "^3.0.0 || ^4.0.0"
}
@@ -18095,7 +18377,8 @@
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
"dev": true
"dev": true,
"peer": true
},
"object-inspect": {
"version": "1.12.2",
@@ -18137,6 +18420,7 @@
"resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.5.tgz",
"integrity": "sha512-CAyG5mWQRRiBU57Re4FKoTBjXfDoNwdFVH2Y1tS9PqCsfUTymAohOkEMSG3aRNKmv4lV3O7p1et7c187q6bynw==",
"dev": true,
"peer": true,
"requires": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.3",
@@ -18148,6 +18432,7 @@
"resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.1.tgz",
"integrity": "sha512-LYLe4tivNQzq4JdaWW6WO3HMZZJWzkkH8fnI6EebWl0VZth2wL2Lovm74ep2/gZzlaTdV62JZHEqHQ2yVn8Q/A==",
"dev": true,
"peer": true,
"requires": {
"define-properties": "^1.1.4",
"es-abstract": "^1.19.5"
@@ -18182,6 +18467,17 @@
"mimic-fn": "^2.1.0"
}
},
"open": {
"version": "8.4.0",
"resolved": "https://registry.npmjs.org/open/-/open-8.4.0.tgz",
"integrity": "sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==",
"dev": true,
"requires": {
"define-lazy-prop": "^2.0.0",
"is-docker": "^2.1.1",
"is-wsl": "^2.2.0"
}
},
"opener": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz",
@@ -18808,6 +19104,7 @@
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
"integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==",
"dev": true,
"peer": true,
"requires": {
"loose-envify": "^1.4.0",
"object-assign": "^4.1.1",
@@ -18818,7 +19115,8 @@
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
"dev": true
"dev": true,
"peer": true
}
}
},
@@ -19586,6 +19884,7 @@
"resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.7.tgz",
"integrity": "sha512-f48okCX7JiwVi1NXCVWcFnZgADDC/n2vePlQ/KUCNqCikLLilQvwjMO8+BHVKvgzH0JB0J9LEPgxOGT02RoETg==",
"dev": true,
"peer": true,
"requires": {
"call-bind": "^1.0.2",
"define-properties": "^1.1.3",
@@ -19710,6 +20009,16 @@
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==",
"dev": true
},
"synckit": {
"version": "0.8.4",
"resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.4.tgz",
"integrity": "sha512-Dn2ZkzMdSX827QbowGbU/4yjWuvNaCoScLLoMo/yKbu+P4GBR6cRGKZH27k6a9bRzdqcyd1DE96pQtQ6uNkmyw==",
"dev": true,
"requires": {
"@pkgr/utils": "^2.3.1",
"tslib": "^2.4.0"
}
},
"tapable": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",
@@ -19799,6 +20108,16 @@
"integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==",
"dev": true
},
"tiny-glob": {
"version": "0.2.9",
"resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz",
"integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==",
"dev": true,
"requires": {
"globalyzer": "0.1.0",
"globrex": "^0.1.2"
}
},
"tmpl": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
+3 -3
View File
@@ -32,13 +32,12 @@
"eslint": "^8.20.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^3.5.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.8.0",
"eslint-plugin-json": "^3.1.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.30.0",
"eslint-plugin-react-hooks": "^4.6.0",
"glob": "^7.1.6",
"istanbul-lib-instrument": "^5.2.0",
"jest": "^28.1.3",
@@ -74,6 +73,7 @@
"playwright": "npm run playwright --workspace=overlayscrollbars",
"playwright:dev": "npm run test:playwright:dev --workspace=overlayscrollbars",
"build": "npm run build --workspace=overlayscrollbars",
"lint": "npx eslint --fix ."
"lint": "eslint ./packages/overlayscrollbars/{src,tests}/**/*.{js,jsx,ts,tsx}",
"prettier": "prettier --check ./packages/overlayscrollbars/{src,tests}/**/*.{js,jsx,ts,tsx}"
}
}
+17 -14
View File
@@ -8,7 +8,6 @@ import {
absoluteCoordinates,
offsetSize,
scrollLeft,
XY,
removeAttr,
removeElements,
equalBCRWH,
@@ -18,18 +17,20 @@ import {
createCache,
equalXY,
createEventListenerHub,
EventListener,
} from 'support';
} from '~/support';
import {
classNameEnvironment,
classNameEnvironmentFlexboxGlue,
classNameEnvironmentFlexboxGlueMax,
classNameViewportScrollbarHidden,
} from 'classnames';
import { Options, defaultOptions } from 'options';
import { DeepPartial } from 'typings';
import { Initialization } from 'initialization';
import { getPlugins, ScrollbarsHidingPluginInstance, scrollbarsHidingPluginName } from 'plugins';
} from '~/classnames';
import { defaultOptions } from '~/options';
import { getPlugins, scrollbarsHidingPluginName } from '~/plugins';
import type { XY, EventListener } from '~/support';
import type { Options } from '~/options';
import type { DeepPartial } from '~/typings';
import type { ScrollbarsHidingPluginInstance } from '~/plugins';
import type { Initialization } from '~/initialization';
type EnvironmentEventMap = {
_: [];
@@ -178,15 +179,17 @@ const createEnvironment = (): InternalEnvironment => {
_rtlScrollBehavior: getRtlScrollBehavior(envElm, envChildElm),
_flexboxGlue: getFlexboxGlue(envElm, envChildElm),
_addListener: (listener) => addEvent('_', listener),
_getDefaultInitialization: assignDeep<Initialization, Initialization>.bind(
0,
{} as Initialization,
staticDefaultInitialization
),
_getDefaultInitialization: (
assignDeep as typeof assignDeep<Initialization, Initialization>
).bind(0, {} as Initialization, staticDefaultInitialization),
_setDefaultInitialization(newInitializationStrategy) {
assignDeep(staticDefaultInitialization, newInitializationStrategy);
},
_getDefaultOptions: assignDeep<Options, Options>.bind(0, {} as Options, staticDefaultOptions),
_getDefaultOptions: (assignDeep as typeof assignDeep<Options, Options>).bind(
0,
{} as Options,
staticDefaultOptions
),
_setDefaultOptions(newDefaultOptions) {
assignDeep(staticDefaultOptions, newDefaultOptions);
},
@@ -1,10 +1,10 @@
import type { OverlayScrollbars } from 'overlayscrollbars';
import type { DeepPartial } from 'typings';
import type { Options } from 'options';
import type { OverlayScrollbars } from '~/overlayscrollbars';
import type { DeepPartial } from '~/typings';
import type { Options } from '~/options';
import type {
InitialEventListeners as GeneralInitialEventListeners,
EventListener as GeneralEventListener,
} from 'support/eventListeners';
} from '~/support/eventListeners';
export interface OnUpdatedEventListenerArgs {
updateHints: {
+7 -7
View File
@@ -1,20 +1,20 @@
import 'index.scss';
import '~/index.scss';
export { OverlayScrollbars } from 'overlayscrollbars';
export { ScrollbarsHidingPlugin, SizeObserverPlugin, ClickScrollPlugin } from 'plugins';
export { OverlayScrollbars } from '~/overlayscrollbars';
export { ScrollbarsHidingPlugin, SizeObserverPlugin, ClickScrollPlugin } from '~/plugins';
export type {
Options,
OverflowBehavior,
ScrollbarVisibilityBehavior,
ScrollbarAutoHideBehavior,
} from 'options';
} from '~/options';
export type {
EventListenerMap,
EventListener,
InitialEventListeners,
OnUpdatedEventListenerArgs,
} from 'eventListeners';
} from '~/eventListeners';
export type {
Initialization,
InitializationTarget,
@@ -22,5 +22,5 @@ export type {
InitializationTargetObject,
StaticInitializationElement,
DynamicInitializationElement,
} from 'initialization';
export type { Plugin, PluginInstance } from 'plugins';
} from '~/initialization';
export type { Plugin, PluginInstance } from '~/plugins';
@@ -1,6 +1,6 @@
import { isFunction, isHTMLElement, isNull, isUndefined } from 'support';
import { getEnvironment } from 'environment';
import type { DeepPartial } from 'typings';
import { isFunction, isHTMLElement, isNull, isUndefined } from '~/support';
import { getEnvironment } from '~/environment';
import type { DeepPartial } from '~/typings';
type StaticInitialization = HTMLElement | false | null;
type DynamicInitialization = HTMLElement | boolean | null;
+1 -1
View File
@@ -1,4 +1,4 @@
import { OverlayScrollbars } from 'overlayscrollbars';
import type { OverlayScrollbars } from '~/overlayscrollbars';
const targetInstanceMap: WeakMap<Element, OverlayScrollbars> = new WeakMap();
@@ -13,7 +13,7 @@ import {
push,
from,
runEachAndClear,
} from 'support';
} from '~/support';
type DOMContentObserverCallback = (contentChangedThroughEvent: boolean) => any;
@@ -1,3 +1,3 @@
export * from 'observers/domObserver';
export * from 'observers/sizeObserver';
export * from 'observers/trinsicObserver';
export * from '~/observers/domObserver';
export * from '~/observers/sizeObserver';
export * from '~/observers/trinsicObserver';
@@ -1,5 +1,4 @@
import {
CacheValues,
createCache,
createDOM,
scrollLeft,
@@ -17,15 +16,16 @@ import {
stopPropagation,
appendChildren,
directionIsRTL,
} from 'support';
import { getEnvironment } from 'environment';
} from '~/support';
import { getEnvironment } from '~/environment';
import {
classNameSizeObserver,
classNameSizeObserverAppear,
classNameSizeObserverListener,
} from 'classnames';
import { getPlugins, sizeObserverPluginName } from 'plugins';
import type { SizeObserverPluginInstance } from 'plugins';
} from '~/classnames';
import { getPlugins, sizeObserverPluginName } from '~/plugins';
import type { CacheValues } from '~/support';
import type { SizeObserverPluginInstance } from '~/plugins';
export interface SizeObserverOptions {
_direction?: boolean;
@@ -1,6 +1,4 @@
import {
WH,
CacheValues,
createDiv,
offsetSize,
runEachAndClear,
@@ -9,9 +7,10 @@ import {
push,
IntersectionObserverConstructor,
appendChildren,
} from 'support';
import { createSizeObserver } from 'observers/sizeObserver';
import { classNameTrinsicObserver } from 'classnames';
} from '~/support';
import { createSizeObserver } from '~/observers/sizeObserver';
import { classNameTrinsicObserver } from '~/classnames';
import type { WH, CacheValues } from '~/support';
export type TrinsicObserverCallback = (heightIntrinsic: CacheValues<boolean>) => any;
export type TrinsicObserver = [
+2 -2
View File
@@ -7,8 +7,8 @@ import {
hasOwnProperty,
isFunction,
isEmptyObject,
} from 'support';
import { DeepPartial, DeepReadonly } from 'typings';
} from '~/support';
import type { DeepPartial, DeepReadonly } from '~/typings';
const opsStringify = (value: any) =>
JSON.stringify(value, (_, val) => {
@@ -7,23 +7,23 @@ import {
isHTMLElement,
createEventListenerHub,
isPlainObject,
} from 'support';
import { getOptionsDiff } from 'options';
import { getEnvironment } from 'environment';
import { cancelInitialization } from 'initialization';
import { addInstance, getInstance, removeInstance } from 'instances';
import { createStructureSetup, createScrollbarsSetup } from 'setups';
import { getPlugins, addPlugin, optionsValidationPluginName, PluginInstance } from 'plugins';
import type { XY, TRBL } from 'support';
import type { Options, ReadonlyOptions } from 'options';
import type { Plugin, OptionsValidationPluginInstance } from 'plugins';
import type { InitializationTarget, Initialization } from 'initialization';
import type { DeepPartial, OverflowStyle } from 'typings';
import type { EventListenerMap, EventListener, InitialEventListeners } from 'eventListeners';
} from '~/support';
import { getOptionsDiff } from '~/options';
import { getEnvironment } from '~/environment';
import { cancelInitialization } from '~/initialization';
import { addInstance, getInstance, removeInstance } from '~/instances';
import { createStructureSetup, createScrollbarsSetup } from '~/setups';
import { getPlugins, addPlugin, optionsValidationPluginName } from '~/plugins';
import type { XY, TRBL } from '~/support';
import type { Options, ReadonlyOptions } from '~/options';
import type { Plugin, OptionsValidationPluginInstance, PluginInstance } from '~/plugins';
import type { InitializationTarget, Initialization } from '~/initialization';
import type { DeepPartial, OverflowStyle } from '~/typings';
import type { EventListenerMap, EventListener, InitialEventListeners } from '~/eventListeners';
import type {
ScrollbarsSetupElement,
ScrollbarStructure,
} from 'setups/scrollbarsSetup/scrollbarsSetup.elements';
} from '~/setups/scrollbarsSetup/scrollbarsSetup.elements';
// Notes:
// Height intrinsic detection use "content: true" init strategy - or open ticket for custom height intrinsic observer
@@ -1,5 +1,5 @@
import { animateNumber, noop } from 'support';
import type { Plugin } from 'plugins';
import { animateNumber, noop } from '~/support';
import type { Plugin } from '~/plugins';
export type ClickScrollPluginInstance = {
_: (
@@ -1 +1 @@
export * from 'plugins/clickScrollPlugin/clickScrollPlugin';
export * from '~/plugins/clickScrollPlugin/clickScrollPlugin';
@@ -1,5 +1,5 @@
export * from './plugins';
export * from './optionsValidationPlugin';
export * from './sizeObserverPlugin';
export * from './scrollbarsHidingPlugin';
export * from './clickScrollPlugin';
export * from '~/plugins/plugins';
export * from '~/plugins/optionsValidationPlugin';
export * from '~/plugins/sizeObserverPlugin';
export * from '~/plugins/scrollbarsHidingPlugin';
export * from '~/plugins/clickScrollPlugin';
@@ -1 +1 @@
export * from 'plugins/optionsValidationPlugin/optionsValidationPlugin';
export * from '~/plugins/optionsValidationPlugin/optionsValidationPlugin';
@@ -1,17 +1,19 @@
import {
validateOptions,
optionsTemplateTypes as oTypes,
} from '~/plugins/optionsValidationPlugin/validation';
import type {
Options,
OverflowBehavior,
ScrollbarVisibilityBehavior,
ScrollbarAutoHideBehavior,
} from 'options';
import {
validateOptions,
} from '~/options';
import type {
OptionsTemplate,
OptionsTemplateValue,
optionsTemplateTypes as oTypes,
} from 'plugins/optionsValidationPlugin/validation';
import type { DeepPartial } from 'typings';
import type { Plugin } from 'plugins';
} from '~/plugins/optionsValidationPlugin/validation';
import type { DeepPartial } from '~/typings';
import type { Plugin } from '~/plugins';
const numberAllowedValues: OptionsTemplateValue<number> = oTypes.number;
const booleanAllowedValues: OptionsTemplateValue<boolean> = oTypes.boolean;
@@ -1,13 +1,13 @@
import {
import { isArray } from '~/support/utils/types';
import { each, keys } from '~/support/utils';
import type {
OptionsTemplate,
OptionsObjectType,
OptionsTemplateNativeTypes,
OptionsTemplateTypes,
OptionsTemplateValue,
} from 'plugins/optionsValidationPlugin/validation';
import { PlainObject } from 'typings';
import { isArray } from 'support/utils/types';
import { each, keys } from 'support/utils';
} from '~/plugins/optionsValidationPlugin/validation';
import type { PlainObject } from '~/typings';
export interface OptionsWithOptionsTemplateTransformation<T> {
_template: OptionsTemplate<T>;
@@ -1,6 +1,6 @@
import { each, hasOwnProperty, keys, push, isEmptyObject } from 'support/utils';
import { type, isArray, isUndefined, isPlainObject, isString } from 'support/utils/types';
import { PlainObject, DeepPartial } from 'typings';
import { each, hasOwnProperty, keys, push, isEmptyObject } from '~/support/utils';
import { type, isArray, isUndefined, isPlainObject, isString } from '~/support/utils/types';
import type { PlainObject, DeepPartial } from '~/typings';
export type OptionsObjectType = Record<string, unknown>;
export type OptionsFunctionType = (this: any, ...args: any[]) => any;
@@ -1,5 +1,5 @@
import { each, isArray, keys, push } from 'support';
import { OverlayScrollbars, OverlayScrollbarsStatic } from 'overlayscrollbars';
import { each, isArray, keys, push } from '~/support';
import type { OverlayScrollbars, OverlayScrollbarsStatic } from '~/overlayscrollbars';
export type PluginInstance =
| Record<string, unknown>
@@ -1 +1 @@
export * from 'plugins/scrollbarsHidingPlugin/scrollbarsHidingPlugin';
export * from '~/plugins/scrollbarsHidingPlugin/scrollbarsHidingPlugin';
@@ -1,7 +1,6 @@
import {
keys,
attr,
WH,
style,
addClass,
removeClass,
@@ -9,19 +8,18 @@ import {
each,
assignDeep,
windowSize,
UpdateCache,
XY,
} from 'support';
import { classNameViewportArrange } from 'classnames';
import type { StyleObject } from 'typings';
import type { StructureSetupState } from 'setups/structureSetup';
} from '~/support';
import { classNameViewportArrange } from '~/classnames';
import type { WH, UpdateCache, XY } from '~/support';
import type { StyleObject } from '~/typings';
import type { StructureSetupState } from '~/setups/structureSetup';
import type {
ViewportOverflowState,
GetViewportOverflowState,
HideNativeScrollbars,
} from 'setups/structureSetup/updateSegments/overflowUpdateSegment';
import type { InternalEnvironment } from 'environment';
import type { Plugin } from 'plugins';
} from '~/setups/structureSetup/updateSegments/overflowUpdateSegment';
import type { InternalEnvironment } from '~/environment';
import type { Plugin } from '~/plugins';
export type ArrangeViewport = (
viewportOverflowState: ViewportOverflowState,
@@ -1 +1 @@
export * from 'plugins/sizeObserverPlugin/sizeObserverPlugin';
export * from '~/plugins/sizeObserverPlugin/sizeObserverPlugin';
@@ -12,13 +12,13 @@ import {
cAF,
rAF,
stopPropagation,
} from 'support';
} from '~/support';
import {
classNameSizeObserverListenerScroll,
classNameSizeObserverListenerItem,
classNameSizeObserverListenerItemFinal,
} from 'classnames';
import type { Plugin } from 'plugins';
} from '~/classnames';
import type { Plugin } from '~/plugins';
export type SizeObserverPluginInstance = {
_: (
@@ -1,3 +1,3 @@
export * from 'setups/setups';
export * from 'setups/structureSetup';
export * from 'setups/scrollbarsSetup';
export * from '~/setups/setups';
export * from '~/setups/structureSetup';
export * from '~/setups/scrollbarsSetup';
@@ -1 +1 @@
export * from 'setups/scrollbarsSetup/scrollbarsSetup';
export * from '~/setups/scrollbarsSetup/scrollbarsSetup';
@@ -1,6 +1,6 @@
import { offsetSize } from 'support';
import { getEnvironment } from 'environment';
import type { StructureSetupState } from 'setups';
import { offsetSize } from '~/support';
import { getEnvironment } from '~/environment';
import type { StructureSetupState } from '~/setups';
const { min, max, abs, round } = Math;
@@ -12,7 +12,7 @@ import {
runEachAndClear,
setT,
style,
} from 'support';
} from '~/support';
import {
classNameScrollbar,
classNameScrollbarHorizontal,
@@ -20,22 +20,22 @@ import {
classNameScrollbarTrack,
classNameScrollbarHandle,
classNamesScrollbarTransitionless,
} from 'classnames';
import { getEnvironment } from 'environment';
import { dynamicInitializationElement as generalDynamicInitializationElement } from 'initialization';
} from '~/classnames';
import { getEnvironment } from '~/environment';
import { dynamicInitializationElement as generalDynamicInitializationElement } from '~/initialization';
import {
getScrollbarHandleLengthRatio,
getScrollbarHandleOffsetRatio,
} from 'setups/scrollbarsSetup/scrollbarsSetup.calculations';
} from '~/setups/scrollbarsSetup/scrollbarsSetup.calculations';
import type {
InitializationTarget,
InitializationTargetElement,
InitializationTargetObject,
} from 'initialization';
import type { StructureSetupElementsObj } from 'setups/structureSetup/structureSetup.elements';
import type { ScrollbarsSetupEvents } from 'setups/scrollbarsSetup/scrollbarsSetup.events';
import type { StyleObject } from 'typings';
import type { StructureSetupState } from 'setups';
} from '~/initialization';
import type { StructureSetupElementsObj } from '~/setups/structureSetup/structureSetup.elements';
import type { ScrollbarsSetupEvents } from '~/setups/scrollbarsSetup/scrollbarsSetup.events';
import type { StyleObject } from '~/typings';
import type { StructureSetupState } from '~/setups';
export interface ScrollbarStructure {
_scrollbar: HTMLElement;
@@ -6,26 +6,26 @@ import {
preventDefault,
runEachAndClear,
stopPropagation,
XY,
selfClearTimeout,
parent,
closest,
push,
} from 'support';
import { getPlugins, clickScrollPluginName } from 'plugins';
import { getEnvironment } from 'environment';
} from '~/support';
import { getPlugins, clickScrollPluginName } from '~/plugins';
import { getEnvironment } from '~/environment';
import {
classNameScrollbarHandle,
classNamesScrollbarInteraction,
classNamesScrollbarWheel,
} from 'classnames';
import type { ClickScrollPluginInstance } from 'plugins';
import type { ReadonlyOptions } from 'options';
import type { StructureSetupState } from 'setups';
} from '~/classnames';
import type { XY } from '~/support';
import type { ClickScrollPluginInstance } from '~/plugins';
import type { ReadonlyOptions } from '~/options';
import type { StructureSetupState } from '~/setups';
import type {
ScrollbarsSetupElementsObj,
ScrollbarStructure,
} from 'setups/scrollbarsSetup/scrollbarsSetup.elements';
} from '~/setups/scrollbarsSetup/scrollbarsSetup.elements';
export type ScrollbarsSetupEvents = (
scrollbarStructure: ScrollbarStructure,
@@ -1,11 +1,7 @@
import { on, runEachAndClear, parent, scrollLeft, scrollTop, selfClearTimeout } from 'support';
import { createState, createOptionCheck } from 'setups/setups';
import { createScrollbarsSetupEvents } from 'setups/scrollbarsSetup/scrollbarsSetup.events';
import {
createScrollbarsSetupElements,
ScrollbarsSetupElementsObj,
ScrollbarStructure,
} from 'setups/scrollbarsSetup/scrollbarsSetup.elements';
import { on, runEachAndClear, parent, scrollLeft, scrollTop, selfClearTimeout } from '~/support';
import { createState, createOptionCheck } from '~/setups/setups';
import { createScrollbarsSetupEvents } from '~/setups/scrollbarsSetup/scrollbarsSetup.events';
import { createScrollbarsSetupElements } from '~/setups/scrollbarsSetup/scrollbarsSetup.elements';
import {
classNamesScrollbarVisible,
classNamesScrollbarUnusable,
@@ -14,16 +10,20 @@ import {
classNamesScrollbarHandleInteractive,
classNamesScrollbarTrackInteractive,
classNameScrollbarRtl,
} from 'classnames';
import type { StructureSetupUpdateHints } from 'setups/structureSetup/structureSetup.update';
} from '~/classnames';
import type {
ScrollbarsSetupElementsObj,
ScrollbarStructure,
} from '~/setups/scrollbarsSetup/scrollbarsSetup.elements';
import type { StructureSetupUpdateHints } from '~/setups/structureSetup/structureSetup.update';
import type {
ReadonlyOptions,
ScrollbarVisibilityBehavior,
ScrollbarAutoHideBehavior,
} from 'options';
import type { Setup, StructureSetupState, StructureSetupStaticState } from 'setups';
import type { InitializationTarget } from 'initialization';
import type { DeepPartial, OverflowStyle, StyleObject } from 'typings';
} from '~/options';
import type { Setup, StructureSetupState, StructureSetupStaticState } from '~/setups';
import type { InitializationTarget } from '~/initialization';
import type { DeepPartial, OverflowStyle, StyleObject } from '~/typings';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface ScrollbarsSetupState {}
@@ -1,6 +1,6 @@
import { assignDeep, hasOwnProperty } from 'support';
import type { Options, ReadonlyOptions } from 'options';
import type { DeepPartial } from 'typings';
import { assignDeep, hasOwnProperty } from '~/support';
import type { Options, ReadonlyOptions } from '~/options';
import type { DeepPartial } from '~/typings';
export type SetupElements<T extends Record<string, any>> = [elements: T, destroy: () => void];
@@ -44,7 +44,7 @@ export const createOptionCheck =
(path: string) =>
[getPropByPath(options, path), force || getPropByPath(changedOptions, path) !== undefined];
export const createState = <S>(initialState: S): SetupState<S> => {
export const createState = <S extends Record<string, any>>(initialState: S): SetupState<S> => {
let state: S = initialState;
return [
() => state,
@@ -1 +1 @@
export * from 'setups/structureSetup/structureSetup';
export * from '~/setups/structureSetup/structureSetup';
@@ -21,7 +21,7 @@ import {
hasAttrClass,
noop,
on,
} from 'support';
} from '~/support';
import {
dataAttributeHost,
dataAttributeHostOverflowX,
@@ -30,19 +30,19 @@ import {
classNameViewport,
classNameContent,
classNameViewportScrollbarHidden,
} from 'classnames';
import { getEnvironment } from 'environment';
import { getPlugins, scrollbarsHidingPluginName } from 'plugins';
} from '~/classnames';
import { getEnvironment } from '~/environment';
import { getPlugins, scrollbarsHidingPluginName } from '~/plugins';
import {
staticInitializationElement as generalStaticInitializationElement,
dynamicInitializationElement as generalDynamicInitializationElement,
} from 'initialization';
import type { ScrollbarsHidingPluginInstance } from 'plugins/scrollbarsHidingPlugin';
} from '~/initialization';
import type { ScrollbarsHidingPluginInstance } from '~/plugins/scrollbarsHidingPlugin';
import type {
InitializationTarget,
InitializationTargetElement,
InitializationTargetObject,
} from 'initialization';
} from '~/initialization';
export type StructureSetupElements = [
elements: StructureSetupElementsObj,
@@ -7,13 +7,11 @@ import {
isString,
attr,
removeAttr,
CacheValues,
keys,
liesBetween,
scrollSize,
equalWH,
createCache,
WH,
fractionalSize,
isFunction,
ResizeObserverConstructor,
@@ -23,8 +21,8 @@ import {
scrollLeft,
scrollTop,
noop,
} from 'support';
import { getEnvironment } from 'environment';
} from '~/support';
import { getEnvironment } from '~/environment';
import {
dataAttributeHost,
dataValueHostOverflowVisible,
@@ -33,21 +31,17 @@ import {
classNameOverflowVisible,
classNameScrollbar,
classNameViewportArrange,
} from 'classnames';
import {
createSizeObserver,
createTrinsicObserver,
createDOMObserver,
DOMObserver,
SizeObserverCallbackParams,
} from 'observers';
import type { SetupState, SetupUpdateCheckOption } from 'setups';
import type { StructureSetupState } from 'setups/structureSetup';
import type { StructureSetupElementsObj } from 'setups/structureSetup/structureSetup.elements';
} from '~/classnames';
import { createSizeObserver, createTrinsicObserver, createDOMObserver } from '~/observers';
import type { DOMObserver, SizeObserverCallbackParams } from '~/observers';
import type { CacheValues, WH } from '~/support';
import type { SetupState, SetupUpdateCheckOption } from '~/setups';
import type { StructureSetupState } from '~/setups/structureSetup';
import type { StructureSetupElementsObj } from '~/setups/structureSetup/structureSetup.elements';
import type {
StructureSetupUpdate,
StructureSetupUpdateHints,
} from 'setups/structureSetup/structureSetup.update';
} from '~/setups/structureSetup/structureSetup.update';
export type StructureSetupObserversUpdate = (checkOption: SetupUpdateCheckOption) => void;
@@ -1,15 +1,15 @@
import { createEventListenerHub, isEmptyObject, keys, scrollLeft, scrollTop } from 'support';
import { createState, createOptionCheck } from 'setups/setups';
import { createStructureSetupElements } from 'setups/structureSetup/structureSetup.elements';
import { createStructureSetupUpdate } from 'setups/structureSetup/structureSetup.update';
import { createStructureSetupObservers } from 'setups/structureSetup/structureSetup.observers';
import type { StructureSetupUpdateHints } from 'setups/structureSetup/structureSetup.update';
import type { StructureSetupElementsObj } from 'setups/structureSetup/structureSetup.elements';
import type { TRBL, XY, EventListener } from 'support';
import type { Options, ReadonlyOptions } from 'options';
import type { Setup } from 'setups';
import type { InitializationTarget } from 'initialization';
import type { DeepPartial, StyleObject, OverflowStyle } from 'typings';
import { createEventListenerHub, isEmptyObject, keys, scrollLeft, scrollTop } from '~/support';
import { createState, createOptionCheck } from '~/setups/setups';
import { createStructureSetupElements } from '~/setups/structureSetup/structureSetup.elements';
import { createStructureSetupUpdate } from '~/setups/structureSetup/structureSetup.update';
import { createStructureSetupObservers } from '~/setups/structureSetup/structureSetup.observers';
import type { StructureSetupUpdateHints } from '~/setups/structureSetup/structureSetup.update';
import type { StructureSetupElementsObj } from '~/setups/structureSetup/structureSetup.elements';
import type { TRBL, XY, EventListener } from '~/support';
import type { Options, ReadonlyOptions } from '~/options';
import type { Setup } from '~/setups';
import type { InitializationTarget } from '~/initialization';
import type { DeepPartial, StyleObject, OverflowStyle } from '~/typings';
export interface StructureSetupState {
_padding: TRBL;
@@ -1,14 +1,14 @@
import { each, scrollLeft, scrollTop, assignDeep, keys } from 'support';
import { getEnvironment } from 'environment';
import { dataValueHostUpdating } from 'classnames';
import { each, scrollLeft, scrollTop, assignDeep, keys } from '~/support';
import { getEnvironment } from '~/environment';
import { dataValueHostUpdating } from '~/classnames';
import {
createTrinsicUpdateSegment,
createPaddingUpdateSegment,
createOverflowUpdateSegment,
} from 'setups/structureSetup/updateSegments';
import type { SetupState, SetupUpdateSegment, SetupUpdateCheckOption } from 'setups';
import type { StructureSetupState } from 'setups/structureSetup';
import type { StructureSetupElementsObj } from 'setups/structureSetup/structureSetup.elements';
} from '~/setups/structureSetup/updateSegments';
import type { SetupState, SetupUpdateSegment, SetupUpdateCheckOption } from '~/setups';
import type { StructureSetupState } from '~/setups/structureSetup';
import type { StructureSetupElementsObj } from '~/setups/structureSetup/structureSetup.elements';
export type CreateStructureUpdateSegment = (
structureSetupElements: StructureSetupElementsObj,
@@ -1,3 +1,3 @@
export * from 'setups/structureSetup/updateSegments/trinsicUpdateSegment';
export * from 'setups/structureSetup/updateSegments/paddingUpdateSegment';
export * from 'setups/structureSetup/updateSegments/overflowUpdateSegment';
export * from '~/setups/structureSetup/updateSegments/trinsicUpdateSegment';
export * from '~/setups/structureSetup/updateSegments/paddingUpdateSegment';
export * from '~/setups/structureSetup/updateSegments/overflowUpdateSegment';
@@ -1,8 +1,6 @@
import {
createCache,
attr,
WH,
XY,
style,
scrollSize,
fractionalSize,
@@ -13,8 +11,8 @@ import {
equalXY,
attrClass,
noop,
} from 'support';
import { getEnvironment } from 'environment';
} from '~/support';
import { getEnvironment } from '~/environment';
import {
classNameViewportScrollbarHidden,
classNameOverflowVisible,
@@ -23,16 +21,17 @@ import {
dataAttributeHostOverflowY,
dataValueHostScrollbarHidden,
dataValueHostOverflowVisible,
} from 'classnames';
import { getPlugins, scrollbarsHidingPluginName } from 'plugins';
} from '~/classnames';
import { getPlugins, scrollbarsHidingPluginName } from '~/plugins';
import type { WH, XY } from '~/support';
import type {
ScrollbarsHidingPluginInstance,
ArrangeViewport,
UndoArrangeViewport,
} from 'plugins/scrollbarsHidingPlugin';
import type { StyleObject, OverflowStyle } from 'typings';
import type { OverflowBehavior } from 'options';
import type { CreateStructureUpdateSegment } from 'setups/structureSetup/structureSetup.update';
} from '~/plugins/scrollbarsHidingPlugin';
import type { StyleObject, OverflowStyle } from '~/typings';
import type { OverflowBehavior } from '~/options';
import type { CreateStructureUpdateSegment } from '~/setups/structureSetup/structureSetup.update';
export interface ViewportOverflowState {
_scrollbarsHideOffset: XY<number>;
@@ -1,7 +1,7 @@
import { createCache, topRightBottomLeft, equalTRBL, style, assignDeep } from 'support';
import { StyleObject } from 'typings';
import { getEnvironment } from 'environment';
import type { CreateStructureUpdateSegment } from 'setups/structureSetup/structureSetup.update';
import { createCache, topRightBottomLeft, equalTRBL, style, assignDeep } from '~/support';
import { getEnvironment } from '~/environment';
import type { StyleObject } from '~/typings';
import type { CreateStructureUpdateSegment } from '~/setups/structureSetup/structureSetup.update';
/**
* Lifecycle with the responsibility to adjust the padding styling of the padding and viewport element.
@@ -1,6 +1,6 @@
import { style } from 'support';
import { getEnvironment } from 'environment';
import type { CreateStructureUpdateSegment } from 'setups/structureSetup/structureSetup.update';
import { style } from '~/support';
import { getEnvironment } from '~/environment';
import type { CreateStructureUpdateSegment } from '~/setups/structureSetup/structureSetup.update';
/**
* Lifecycle with the responsibility to adjust the trinsic behavior of the content element.
@@ -1,4 +1,4 @@
import { jsAPI } from 'support/compatibility/vendors';
import { jsAPI } from '~/support/compatibility/vendors';
export const MutationObserverConstructor = jsAPI<typeof MutationObserver>('MutationObserver');
export const IntersectionObserverConstructor =
@@ -1,2 +1,2 @@
export * from 'support/compatibility/vendors';
export * from 'support/compatibility/apis';
export * from '~/support/compatibility/vendors';
export * from '~/support/compatibility/apis';
@@ -1,6 +1,6 @@
import { each } from 'support/utils/array';
import { hasOwnProperty } from 'support/utils/object';
import { createDiv } from 'support/dom/create';
import { each } from '~/support/utils/array';
import { hasOwnProperty } from '~/support/utils/object';
import { createDiv } from '~/support/dom/create';
const firstLetterToUpper = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1);
const getDummyStyle = (): CSSStyleDeclaration => createDiv().style;
@@ -1,5 +1,5 @@
import { rAF, cAF } from 'support/compatibility';
import { isFunction } from 'support/utils';
import { rAF, cAF } from '~/support/compatibility';
import { isFunction } from '~/support/utils';
const { max } = Math;
const animationCurrentTime = () => performance.now();
@@ -1,5 +1,5 @@
import { from } from 'support/utils/array';
import { isNumber, isString, isUndefined } from 'support/utils/types';
import { from } from '~/support/utils/array';
import { isNumber, isString, isUndefined } from '~/support/utils/types';
type GetSetPropName = 'scrollLeft' | 'scrollTop' | 'value';
@@ -1,6 +1,6 @@
import { isString } from 'support/utils/types';
import { each } from 'support/utils/array';
import { keys } from 'support/utils/object';
import { isString } from '~/support/utils/types';
import { each } from '~/support/utils/array';
import { keys } from '~/support/utils/object';
type ClassContainingElement = Node | Element | false | null | undefined;
type ClassName = string | false | null | undefined;
@@ -1,7 +1,7 @@
import { each } from 'support/utils/array';
import { attr } from 'support/dom/attribute';
import { contents } from 'support/dom/traversal';
import { removeElements } from 'support/dom/manipulation';
import { each } from '~/support/utils/array';
import { attr } from '~/support/dom/attribute';
import { contents } from '~/support/dom/traversal';
import { removeElements } from '~/support/dom/manipulation';
/**
* Creates a div DOM node.
@@ -1,4 +1,4 @@
import { style } from 'support/dom/style';
import { style } from '~/support/dom/style';
export interface WH<T = number> {
w: T;
@@ -1,5 +1,5 @@
import { isUndefined } from 'support/utils/types';
import { each, push, runEachAndClear } from 'support/utils/array';
import { isUndefined } from '~/support/utils/types';
import { each, push, runEachAndClear } from '~/support/utils/array';
let passiveEventsSupport: boolean;
const supportPassiveEvents = (): boolean => {
@@ -1,10 +1,10 @@
export * from 'support/dom/animation';
export * from 'support/dom/attribute';
export * from 'support/dom/class';
export * from 'support/dom/create';
export * from 'support/dom/dimensions';
export * from 'support/dom/events';
export * from 'support/dom/style';
export * from 'support/dom/manipulation';
export * from 'support/dom/offset';
export * from 'support/dom/traversal';
export * from '~/support/dom/animation';
export * from '~/support/dom/attribute';
export * from '~/support/dom/class';
export * from '~/support/dom/create';
export * from '~/support/dom/dimensions';
export * from '~/support/dom/events';
export * from '~/support/dom/style';
export * from '~/support/dom/manipulation';
export * from '~/support/dom/offset';
export * from '~/support/dom/traversal';
@@ -1,6 +1,6 @@
import { isArrayLike } from 'support/utils/types';
import { each, from } from 'support/utils/array';
import { parent } from 'support/dom/traversal';
import { isArrayLike } from '~/support/utils/types';
import { each, from } from '~/support/utils/array';
import { parent } from '~/support/dom/traversal';
type NodeCollection = ArrayLike<Node> | Node | false | null | undefined;
@@ -1,4 +1,4 @@
import { getBoundingClientRect } from 'support/dom/dimensions';
import { getBoundingClientRect } from '~/support/dom/dimensions';
export interface XY<T = number> {
x: T;
@@ -1,6 +1,6 @@
import { each, keys } from 'support/utils';
import { isString, isNumber, isArray, isUndefined } from 'support/utils/types';
import { PlainObject, StyleObject } from 'typings';
import { each, keys } from '~/support/utils';
import { isString, isNumber, isArray, isUndefined } from '~/support/utils/types';
import type { PlainObject, StyleObject } from '~/typings';
export interface TRBL {
t: number;
@@ -1,5 +1,5 @@
import { isElement } from 'support/utils/types';
import { push, from } from 'support/utils/array';
import { isElement } from '~/support/utils/types';
import { push, from } from '~/support/utils/array';
type InputElementType = Node | Element | Node | false | null | undefined;
type OutputElementType = Node | Element | null;
@@ -1,6 +1,6 @@
import { isArray } from 'support/utils/types';
import { keys } from 'support/utils/object';
import { each, from, isEmptyArray } from 'support/utils/array';
import { isArray } from '~/support/utils/types';
import { keys } from '~/support/utils/object';
import { each, from, isEmptyArray } from '~/support/utils/array';
export type EventListener<EventMap extends Record<string, any[]>, N extends keyof EventMap> = (
...args: EventMap[N]
@@ -1,5 +1,5 @@
export * from 'support/cache';
export * from 'support/compatibility';
export * from 'support/dom';
export * from 'support/utils';
export * from 'support/eventListeners';
export * from '~/support/cache';
export * from '~/support/compatibility';
export * from '~/support/dom';
export * from '~/support/utils';
export * from '~/support/eventListeners';
@@ -1,5 +1,5 @@
import { isArrayLike, isString } from 'support/utils/types';
import { PlainObject } from 'typings';
import { isArrayLike, isString } from '~/support/utils/types';
import type { PlainObject } from '~/typings';
type RunEachItem = ((...args: any) => any | any[]) | null | undefined;
@@ -1,6 +1,6 @@
import { each } from 'support/utils/array';
import { WH, XY, TRBL } from 'support/dom';
import { PlainObject } from 'typings';
import { each } from '~/support/utils/array';
import type { WH, XY, TRBL } from '~/support/dom';
import type { PlainObject } from '~/typings';
/**
* Compares two objects and returns true if all values of the passed prop names are identical, false otherwise or if one of the two object is falsy.
@@ -1,6 +1,6 @@
import { isNumber, isFunction } from 'support/utils/types';
import { from } from 'support/utils/array';
import { rAF, cAF, setT, clearT } from 'support/compatibility/apis';
import { isNumber, isFunction } from '~/support/utils/types';
import { from } from '~/support/utils/array';
import { rAF, cAF, setT, clearT } from '~/support/compatibility/apis';
type DebounceTiming = number | false | null | undefined;
@@ -1,5 +1,5 @@
export * from 'support/utils/array';
export * from 'support/utils/equal';
export * from 'support/utils/function';
export * from 'support/utils/object';
export * from 'support/utils/types';
export * from '~/support/utils/array';
export * from '~/support/utils/equal';
export * from '~/support/utils/function';
export * from '~/support/utils/object';
export * from '~/support/utils/types';
@@ -1,5 +1,5 @@
import { isArray, isFunction, isPlainObject, isNull } from 'support/utils/types';
import { each } from 'support/utils/array';
import { isArray, isFunction, isPlainObject, isNull } from '~/support/utils/types';
import { each } from '~/support/utils/array';
/**
* Determines whether the passed object has a property with the passed name.
@@ -1,4 +1,4 @@
import { PlainObject } from 'typings';
import type { PlainObject } from '~/typings';
const ElementNodeType = Node.ELEMENT_NODE;
const { toString, hasOwnProperty } = Object.prototype;
@@ -1,8 +1,9 @@
import { DeepPartial } from 'typings';
import { defaultOptions, Options } from 'options';
import { Initialization } from 'initialization';
import { getEnvironment } from 'environment';
import { ScrollbarsHidingPlugin, scrollbarsHidingPluginName } from 'plugins';
import type { DeepPartial } from '~/typings';
import type { Options } from '~/options';
import { defaultOptions } from '~/options';
import type { Initialization } from '~/initialization';
import { getEnvironment } from '~/environment';
import { ScrollbarsHidingPlugin, scrollbarsHidingPluginName } from '~/plugins';
const defaultInitialization = {
elements: {
@@ -25,8 +26,8 @@ let getEnv = getEnvironment;
describe('environment', () => {
beforeEach(async () => {
jest.resetModules();
jest.doMock('support', () => {
const originalModule = jest.requireActual('support');
jest.doMock('~/support', () => {
const originalModule = jest.requireActual('~/support');
let i = 0;
return {
...originalModule,
@@ -37,15 +38,15 @@ describe('environment', () => {
clientSize: jest.fn().mockImplementation(() => ({ w: 90, h: 90 })),
};
});
jest.doMock('plugins', () => {
const originalModule = jest.requireActual('plugins');
jest.doMock('~/plugins', () => {
const originalModule = jest.requireActual('~/plugins');
return {
...originalModule,
getPlugins: jest.fn(() => originalModule.getPlugins()),
};
});
({ getEnvironment: getEnv } = await import('environment'));
({ getEnvironment: getEnv } = await import('~/environment'));
});
test('singleton behavior', () => {
@@ -143,7 +144,7 @@ describe('environment', () => {
describe('addListener', () => {
test('with scrollbarsHidingPlugin registered before environment was created', async () => {
const { getPlugins } = await import('plugins');
const { getPlugins } = await import('~/plugins');
(getPlugins as jest.Mock).mockImplementation(() => ({
[scrollbarsHidingPluginName]: ScrollbarsHidingPlugin[scrollbarsHidingPluginName],
}));
@@ -163,7 +164,7 @@ describe('environment', () => {
_addListener(listener);
const { getPlugins } = await import('plugins');
const { getPlugins } = await import('~/plugins');
(getPlugins as jest.Mock).mockImplementation(() => ({
[scrollbarsHidingPluginName]: ScrollbarsHidingPlugin[scrollbarsHidingPluginName],
}));
@@ -1,13 +1,13 @@
import type { Initialization } from '~/initialization';
import {
staticInitializationElement,
dynamicInitializationElement,
cancelInitialization,
Initialization,
} from 'initialization';
import { getEnvironment } from 'environment';
} from '~/initialization';
import { getEnvironment } from '~/environment';
jest.mock('environment', () => ({
getEnvironment: jest.fn(() => jest.requireActual('environment').getEnvironment()),
jest.mock('~/environment', () => ({
getEnvironment: jest.fn(() => jest.requireActual('~/environment').getEnvironment()),
}));
const createDiv = () => document.createElement('div');
@@ -422,7 +422,7 @@ describe('initialization', () => {
},
].forEach((env) => {
(getEnvironment as jest.Mock).mockImplementation(() => ({
...jest.requireActual('environment').getEnvironment(),
...jest.requireActual('~/environment').getEnvironment(),
...env,
}));
const hasOverlaidScrollbars =
@@ -474,7 +474,7 @@ describe('initialization', () => {
},
].forEach((env) => {
(getEnvironment as jest.Mock).mockImplementation(() => ({
...jest.requireActual('environment').getEnvironment(),
...jest.requireActual('~/environment').getEnvironment(),
...env,
}));
const hasOverlaidScrollbars =
@@ -521,7 +521,7 @@ describe('initialization', () => {
(env) => {
[false, true].forEach((isBody) => {
(getEnvironment as jest.Mock).mockImplementation(() => ({
...jest.requireActual('environment').getEnvironment(),
...jest.requireActual('~/environment').getEnvironment(),
...env,
}));
const defaultBody = defaultCancelInitialization.body;
@@ -561,7 +561,7 @@ describe('initialization', () => {
[{ _nativeScrollbarsHiding: false }, { _nativeScrollbarsHiding: true }].forEach((env) => {
[false, true].forEach((isBody) => {
(getEnvironment as jest.Mock).mockImplementation(() => ({
...jest.requireActual('environment').getEnvironment(),
...jest.requireActual('~/environment').getEnvironment(),
...env,
}));
const defaultBody = defaultCancelInitialization.body;
@@ -1,5 +1,5 @@
import { addInstance, removeInstance, getInstance } from 'instances';
import { OverlayScrollbars } from '../../src/overlayscrollbars';
import { addInstance, removeInstance, getInstance } from '~/instances';
import { OverlayScrollbars } from '~/overlayscrollbars';
const testElm = document.body;
const testInstance = OverlayScrollbars(document.body, {});
@@ -1,9 +1,9 @@
import { createDOMObserver } from 'observers';
import { createDOMObserver } from '~/observers';
jest.useFakeTimers();
jest.mock('support/compatibility/apis', () => {
const originalModule = jest.requireActual('support/compatibility/apis');
jest.mock('~/support/compatibility/apis', () => {
const originalModule = jest.requireActual('~/support/compatibility/apis');
const mockRAF = (arg: any) => setTimeout(arg, 0);
return {
...originalModule,
@@ -1,17 +1,17 @@
import { createSizeObserver as originalCreateSizeObserver } from 'observers';
import { SizeObserverPlugin, sizeObserverPluginName } from 'plugins';
import { createSizeObserver as originalCreateSizeObserver } from '~/observers';
import { SizeObserverPlugin, sizeObserverPluginName } from '~/plugins';
let createSizeObserver = originalCreateSizeObserver;
const mockResizeObserverConstructor = async (value: any) => {
jest.resetModules();
jest.unmock('plugins');
jest.doMock('support/compatibility/apis', () => ({
...jest.requireActual('support/compatibility/apis'),
jest.unmock('~/plugins');
jest.doMock('~/support/compatibility/apis', () => ({
...jest.requireActual('~/support/compatibility/apis'),
ResizeObserverConstructor: value,
}));
({ createSizeObserver } = await import('observers'));
({ createSizeObserver } = await import('~/observers'));
};
describe('createSizeObserver', () => {
@@ -64,8 +64,8 @@ describe('createSizeObserver', () => {
beforeEach(() => {
mockResizeObserverConstructor(false);
jest.doMock('plugins', () => ({
...jest.requireActual('plugins'),
jest.doMock('~/plugins', () => ({
...jest.requireActual('~/plugins'),
getPlugins: () => ({
[sizeObserverPluginName]: {
_: mockSizeObserverPlugin,
@@ -1,4 +1,4 @@
import { createTrinsicObserver } from 'observers';
import { createTrinsicObserver } from '~/observers';
describe('createTrinsicObserver', () => {
beforeEach(() => {
@@ -1,4 +1,4 @@
import { defaultOptions, getOptionsDiff } from 'options';
import { defaultOptions, getOptionsDiff } from '~/options';
describe('options', () => {
test('defaultOptions', () => {
@@ -1,8 +1,9 @@
import { DeepPartial } from 'typings';
import { defaultOptions, Options } from 'options';
import { assignDeep } from 'support';
import { OptionsValidationPlugin } from 'plugins';
import { OverlayScrollbars as originalOverlayScrollbars } from '../../src/overlayscrollbars';
import type { DeepPartial } from '~/typings';
import type { Options } from '~/options';
import { defaultOptions } from '~/options';
import { assignDeep } from '~/support';
import { OptionsValidationPlugin } from '~/plugins';
import { OverlayScrollbars as originalOverlayScrollbars } from '~/overlayscrollbars';
const bodyElm = document.body;
const div = document.createElement('div');
@@ -14,7 +15,7 @@ let OverlayScrollbars = originalOverlayScrollbars;
describe('overlayscrollbars', () => {
beforeEach(async () => {
jest.resetModules();
({ OverlayScrollbars } = await import('../../src/overlayscrollbars'));
({ OverlayScrollbars } = await import('~/overlayscrollbars'));
});
afterEach(() => {
@@ -1,8 +1,8 @@
import { defaultOptions } from 'options';
import { defaultOptions } from '~/options';
import {
OptionsValidationPlugin,
optionsValidationPluginName,
} from 'plugins/optionsValidationPlugin';
} from '~/plugins/optionsValidationPlugin';
const getValidationFn = () => {
const name = Object.keys(OptionsValidationPlugin)[0];
@@ -1,12 +1,8 @@
import { PlainObject } from 'typings';
import {
optionsTemplateTypes as oTypes,
OptionsTemplate,
} from 'plugins/optionsValidationPlugin/validation';
import {
transformOptions,
OptionsWithOptionsTemplate,
} from 'plugins/optionsValidationPlugin/transformation';
import type { PlainObject } from '~/typings';
import type { OptionsTemplate } from '~/plugins/optionsValidationPlugin/validation';
import { optionsTemplateTypes as oTypes } from '~/plugins/optionsValidationPlugin/validation';
import type { OptionsWithOptionsTemplate } from '~/plugins/optionsValidationPlugin/transformation';
import { transformOptions } from '~/plugins/optionsValidationPlugin/transformation';
type TestOptionsObj = { propA: 'propA'; null: null };
type TestOptionsEnum = 'A' | 'B' | 'C';
@@ -1,9 +1,9 @@
import type { OptionsTemplate } from '~/plugins/optionsValidationPlugin/validation';
import {
validateOptions,
optionsTemplateTypes as oTypes,
OptionsTemplate,
} from 'plugins/optionsValidationPlugin/validation';
import { assignDeep } from 'support/utils';
} from '~/plugins/optionsValidationPlugin/validation';
import { assignDeep } from '~/support/utils';
type TestOptionsObj = { propA: 'propA'; null: null };
type TestOptionsEnum = 'A' | 'B' | 'C';
@@ -1,4 +1,4 @@
import { addPlugin, getPlugins } from 'plugins';
import { addPlugin, getPlugins } from '~/plugins';
describe('plugins', () => {
test('getPlugins', () => {
@@ -1,13 +1,11 @@
import {
createScrollbarsSetupElements,
import type {
ScrollbarsSetupElement,
ScrollbarsSetupElementsObj,
ScrollbarStructure,
} from 'setups/scrollbarsSetup/scrollbarsSetup.elements';
import {
createStructureSetupElements,
StructureSetupElementsObj,
} from 'setups/structureSetup/structureSetup.elements';
} from '~/setups/scrollbarsSetup/scrollbarsSetup.elements';
import { createScrollbarsSetupElements } from '~/setups/scrollbarsSetup/scrollbarsSetup.elements';
import type { StructureSetupElementsObj } from '~/setups/structureSetup/structureSetup.elements';
import { createStructureSetupElements } from '~/setups/structureSetup/structureSetup.elements';
import {
classNameScrollbar,
classNameScrollbarHorizontal,
@@ -15,13 +13,13 @@ import {
classNameScrollbarTrack,
classNameScrollbarHandle,
classNamesScrollbarTransitionless,
} from 'classnames';
import type { InitializationTarget } from 'initialization';
} from '~/classnames';
import type { InitializationTarget } from '~/initialization';
jest.useFakeTimers();
jest.mock('support/compatibility/apis', () => {
const originalModule = jest.requireActual('support/compatibility/apis');
jest.mock('~/support/compatibility/apis', () => {
const originalModule = jest.requireActual('~/support/compatibility/apis');
return {
...originalModule,
// @ts-ignore
@@ -1,23 +1,22 @@
import { hasClass, is, isFunction, isHTMLElement } from 'support';
import { hasClass, is, isFunction, isHTMLElement } from '~/support';
import {
dataAttributeHost,
classNamePadding,
classNameViewport,
classNameContent,
} from 'classnames';
import { getEnvironment, InternalEnvironment } from 'environment';
import {
createStructureSetupElements,
StructureSetupElementsObj,
} from 'setups/structureSetup/structureSetup.elements';
import { addPlugin, ScrollbarsHidingPlugin } from 'plugins';
} from '~/classnames';
import type { InternalEnvironment } from '~/environment';
import { getEnvironment } from '~/environment';
import type { StructureSetupElementsObj } from '~/setups/structureSetup/structureSetup.elements';
import { createStructureSetupElements } from '~/setups/structureSetup/structureSetup.elements';
import { addPlugin, ScrollbarsHidingPlugin } from '~/plugins';
import type {
Initialization,
InitializationTarget,
InitializationTargetObject,
} from 'initialization';
} from '~/initialization';
jest.mock('environment', () => ({
jest.mock('~/environment', () => ({
getEnvironment: jest.fn(),
}));
@@ -343,7 +342,7 @@ const assertCorrectDestroy = (snapshot: string, destroy: () => void) => {
expect(snapshot).toBe(getSnapshot());
};
const env: InternalEnvironment = jest.requireActual('environment').getEnvironment();
const env: InternalEnvironment = jest.requireActual('~/environment').getEnvironment();
const envDefault = {
name: 'default',
env,
@@ -430,7 +429,7 @@ describe('structureSetup.elements', () => {
beforeEach(() => {
(getEnvironment as jest.Mock).mockImplementation(() =>
jest.requireActual('environment').getEnvironment()
jest.requireActual('~/environment').getEnvironment()
);
});
@@ -1,4 +1,4 @@
import { createCache } from 'support/cache';
import { createCache } from '~/support/cache';
const createUpdater = <T>(updaterReturn: (i: number) => T) => {
let index = 0;
@@ -1,4 +1,4 @@
import { jsAPI, cssProperty, cssPropertyValue } from 'support/compatibility/vendors';
import { jsAPI, cssProperty, cssPropertyValue } from '~/support/compatibility/vendors';
describe('vendors', () => {
describe('jsAPI', () => {
@@ -1,9 +1,9 @@
import { animateNumber } from 'support/dom/animation';
import { animateNumber } from '~/support/dom/animation';
jest.useFakeTimers();
jest.mock('support/compatibility/apis', () => {
const originalModule = jest.requireActual('support/compatibility/apis');
jest.mock('~/support/compatibility/apis', () => {
const originalModule = jest.requireActual('~/support/compatibility/apis');
const mockRAF = (arg: any) => setTimeout(arg, 0);
return {
...originalModule,
@@ -6,7 +6,7 @@ import {
val,
scrollLeft,
scrollTop,
} from 'support/dom/attribute';
} from '~/support/dom/attribute';
const testElm = document.body;
const getAttribute = (name: string) => testElm.getAttribute(name);
@@ -1,4 +1,4 @@
import { addClass, removeClass, hasClass, diffClass } from 'support/dom/class';
import { addClass, removeClass, hasClass, diffClass } from '~/support/dom/class';
const testElm = document.body;
const removeAllClassNames = () => {
@@ -1,5 +1,5 @@
import { each } from 'support/utils';
import { createDiv, createDOM } from 'support/dom/create';
import { each } from '~/support/utils';
import { createDiv, createDOM } from '~/support/dom/create';
const slotElm = document.body;
const testHTML =
@@ -1,5 +1,5 @@
import { isNumber, isPlainObject } from 'support/utils/types';
import { createDiv } from 'support/dom/create';
import { isNumber, isPlainObject } from '~/support/utils/types';
import { createDiv } from '~/support/dom/create';
import {
windowSize,
offsetSize,
@@ -8,7 +8,7 @@ import {
fractionalSize,
getBoundingClientRect,
hasDimensions,
} from 'support/dom/dimensions';
} from '~/support/dom/dimensions';
describe('dom dimensions', () => {
describe('offsetSize', () => {
@@ -1,10 +1,5 @@
import {
off,
preventDefault,
stopPropagation,
stopAndPrevent,
OnOptions,
} from 'support/dom/events';
import type { OnOptions } from '~/support/dom/events';
import { off, preventDefault, stopPropagation, stopAndPrevent } from '~/support/dom/events';
const testElm = document.body;
const mockEventListener = (
@@ -89,7 +84,7 @@ describe('dom events', () => {
};
beforeEach(() =>
import('support/dom/events').then((module) => {
import('~/support/dom/events').then((module) => {
eventsModule = module;
jest.resetModules();
})
@@ -1,5 +1,13 @@
import { createDiv, contents, appendChildren, prependChildren, insertBefore, insertAfter, removeElements } from 'support/dom';
import { each, isArray, isHTMLElement } from 'support/utils';
import {
createDiv,
contents,
appendChildren,
prependChildren,
insertBefore,
insertAfter,
removeElements,
} from '~/support/dom';
import { each, isArray, isHTMLElement } from '~/support/utils';
const slotElm = document.body;
const fillSlotElm = () => {
@@ -19,7 +27,7 @@ const compareToNative = (
method: string,
snapshot: Array<Node>,
elms: Element | Node | Array<Element> | Array<Node>,
compareIds = false,
compareIds = false
) => {
if (!compareIds) {
if (!isArray(elms)) {
@@ -47,7 +55,12 @@ const compareToNative = (
if (isHTMLElement(elm) && child.getAttribute('id') === elm.getAttribute('id')) {
realElms.push(child);
}
if (compareIds && target !== slotElm && isHTMLElement(target) && child.getAttribute('id') === target.getAttribute('id')) {
if (
compareIds &&
target !== slotElm &&
isHTMLElement(target) &&
child.getAttribute('id') === target.getAttribute('id')
) {
target = child;
}
}
@@ -1,5 +1,5 @@
import { isNumber, isPlainObject } from 'support/utils/types';
import { absoluteCoordinates, offsetCoordinates } from 'support/dom/offset';
import { isNumber, isPlainObject } from '~/support/utils/types';
import { absoluteCoordinates, offsetCoordinates } from '~/support/dom/offset';
describe('dom offset', () => {
describe('absoluteCoordinates', () => {
@@ -1,6 +1,6 @@
import { isEmptyObject } from 'support/utils/object';
import { isString, isPlainObject } from 'support/utils/types';
import { style, topRightBottomLeft, directionIsRTL } from 'support/dom/style';
import { isEmptyObject } from '~/support/utils/object';
import { isString, isPlainObject } from '~/support/utils/types';
import { style, topRightBottomLeft, directionIsRTL } from '~/support/dom/style';
describe('dom style', () => {
afterEach(() => {
@@ -8,7 +8,7 @@ import {
createDiv,
liesBetween,
createDOM,
} from 'support/dom';
} from '~/support/dom';
const slotElm = document.body;
const testHTML =
@@ -1,4 +1,4 @@
import { createEventListenerHub } from 'support/eventListeners';
import { createEventListenerHub } from '~/support/eventListeners';
type EventMap = {
onBoolean: [a: boolean, b: string];
@@ -1,4 +1,4 @@
import { push, each, from, indexOf, runEachAndClear, isEmptyArray } from 'support/utils/array';
import { push, each, from, indexOf, runEachAndClear, isEmptyArray } from '~/support/utils/array';
describe('array utilities', () => {
describe('push', () => {

Some files were not shown because too many files have changed in this diff Show More