diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index ac58caf..0000000 --- a/.eslintignore +++ /dev/null @@ -1,37 +0,0 @@ -# dist -/dist/ -/dist-server/ - -# npm -/node_modules/ - -# report -/coverage-ts/ -/tsc-check/ -/coverage/ - -# style's d.ts -*.scss.d.ts -*.css.d.ts - -# test -/test-backstop/ - -# static site -/static-site/ - -# storybook -/storybook-static/ - -# example - -# /* eslint consistent-this: ["error", "unit", "aggressor"] */ - -# /* eslint-disable no-unused-vars */ -# var React = require('react'); -# /* eslint-enable no-unused-vars */ - -# // eslint-disable-next-line no-unused-vars -# var React = require('react'); - -# var React = require('react'); // eslint-disable-line no-unused-vars diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100755 index a529587..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,839 +0,0 @@ -// Rule 'space-after-keywords' was removed and replaced by: keyword-spacing space-after-keywords -// Rule 'space-return-throw-case' was removed and replaced by: keyword-spacing space-return-throw-case - -{ - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": [ - "./tsconfig.json" - ], - "ecmaVersion": 2020, - "sourceType": "module", - "ecmaFeatures": { - "jsx": true - } - }, - "extends": [ - "prettier", - "plugin:prettier/recommended", - "plugin:jest/all", - "eslint:all", - "plugin:@typescript-eslint/all", - // typescript begin - // "plugin:@typescript-eslint/recommended", - // "plugin:@typescript-eslint/recommended-type-checked", - // "plugin:@typescript-eslint/strict", - // "plugin:@typescript-eslint/strict-type-checked", - // "plugin:@typescript-eslint/stylistic", - // "plugin:@typescript-eslint/stylistic-type-checked", - // typescript end - "plugin:typescript-sort-keys/recommended", - "plugin:jsx-a11y/recommended", - "plugin:react/all", - "plugin:import/errors", - "plugin:import/warnings", - "plugin:import/recommended", - "plugin:import/typescript", - "plugin:promise/recommended", - "plugin:sonarjs/recommended", - "plugin:unicorn/all" - ], - "globals": { - "JSX": true, - "require": true, - "module": true, - "console": true - }, - "plugins": [ - "prettier", - "@typescript-eslint", - "jest", - "jsx-a11y", - "no-use-extend-native", - "import", - "react", - "react-hooks", - "promise", - "sonarjs", - "optimize-regex", - "unicorn", - "no-loops", - "filenames", - "typescript-sort-keys", - "babel" - ], - "env": { - "es6": true, - "browser": false, - "node": false - }, - "settings": { - "import/resolver": { - "typescript": {} - }, - "react": { - "version": "detect" - } - }, - "rules": { - // Small, one rule only - "jest/require-hook": [ - 2, - { - "allowedFunctionCalls": [ - "innerInitialization" - ] - } - ], - "prettier/prettier": 2, - "promise/always-return": 0, - "no-loops/no-loops": 2, - "optimize-regex/optimize-regex": 2, - "no-use-extend-native/no-use-extend-native": 2, - // React-hooks - "react-hooks/rules-of-hooks": 2, - "react-hooks/exhaustive-deps": 2, - // Typescript - "@typescript-eslint/array-type": [ - 2, - { - "default": "generic" - } - ], - "@typescript-eslint/ban-ts-comment": 1, - "@typescript-eslint/naming-convention": [ - 2, - { - "selector": "typeAlias", - "format": [ - "StrictPascalCase" - ], - "suffix": [ - "Type" - ] - }, - { - "selector": "enum", - "format": [ - "StrictPascalCase" - ], - "suffix": [ - "Enum" - ] - } - ], - "@typescript-eslint/no-shadow": [ - 2, - { - "builtinGlobals": false, - "hoist": "all" - } - ], - "@typescript-eslint/no-unused-vars": [ - 2, - { - "varsIgnorePattern": "[iI]gnored" - } - ], - "@typescript-eslint/no-use-before-define": 2, - "@typescript-eslint/no-misused-promises": [ - 2, - { - "checksVoidReturn": { - "arguments": true, - "attributes": true, - "properties": true, - "returns": true, - "variables": true - } - } - ], - "@typescript-eslint/no-floating-promises": [ - 2, - { - "ignoreIIFE": true - } - ], - "@typescript-eslint/no-unnecessary-boolean-literal-compare": 0, - // Typescript - defined by eslint - "@typescript-eslint/space-before-function-paren": 0, - "@typescript-eslint/indent": 0, - "@typescript-eslint/comma-dangle": 0, - "@typescript-eslint/no-magic-numbers": 0, - "@typescript-eslint/no-extra-parens": 0, - "@typescript-eslint/lines-around-comment": 0, - "@typescript-eslint/lines-between-class-members": 0, - "@typescript-eslint/block-spacing": 0, - "@typescript-eslint/quotes": 0, - "@typescript-eslint/prefer-readonly-parameter-types": [ - 2, - { - "allow": [ - { - "from": "package", - "name": "Compiler", - "package": "webpack" - } - ] - } - ], - // Unicorn - "unicorn/prefer-string-replace-all": 0, - "unicorn/prefer-node-protocol": 2, - "unicorn/no-array-callback-reference": 0, - "unicorn/no-array-for-each": 0, - "unicorn/filename-case": 2, - "unicorn/no-array-reduce": 0, - "unicorn/no-null": 0, - "unicorn/no-fn-reference-in-iterator": 2, - "unicorn/prevent-abbreviations": [ - 2, - { - "replacements": { - "attr": false, - "attrs": false, - "arg": false, - "args": false, - "prop": false, - "props": false, - "prev": false, - "dev": false, - "evt": false, - "src": false, - "ref": false - } - } - ], - // Babel - "babel/new-cap": 2, - "babel/camelcase": 2, - "babel/no-invalid-this": 2, - "babel/object-curly-spacing": 2, - "babel/quotes": 0, - "babel/semi": 2, - "babel/no-unused-expressions": 2, - "babel/valid-typeof": 2, - // JSX-a11y - // deprecated - "jsx-a11y/label-has-for": 0, - "jsx-a11y/no-access-key": 2, - "jsx-a11y/no-autofocus": 2, - "jsx-a11y/no-onchange": 2, - // Filenames - "filenames/no-index": 2, - "filenames/match-regex": [ - 2, - "^[a-z\\.\\-\\d]+$", - true - ], - "filenames/match-exported": 0, - // Import - "import/no-named-as-default-member": 0, - "import/default": 2, - "import/no-unused-modules": 2, - "import/no-useless-path-segments": 2, - "import/no-default-export": 2, - "import/order": [ - 2, - { - "newlines-between": "always-and-inside-groups", - "groups": [ - "builtin", - "internal", - "external", - "parent", - "sibling", - "index" - ] - } - ], - // React - "react/jsx-uses-react": 2, - "react/react-in-jsx-scope": 0, - "react/jsx-no-bind": 0, - "react/jsx-newline": 0, - "react/jsx-filename-extension": [ - 2, - { - "extensions": [ - ".ts", - ".tsx" - ] - } - ], - "react/no-unused-prop-types": 2, - "react/sort-comp": 2, - "react/jsx-sort-props": [ - 2, - { - "reservedFirst": false, - "shorthandLast": false, - "ignoreCase": false, - "callbacksLast": false, - "noSortAlphabetically": false - } - ], - "react/jsx-closing-bracket-location": [ - 2, - "line-aligned" - ], - "react/forbid-component-props": 0, - "react/jsx-indent-props": [ - 2, - "first" - ], - "react/jsx-no-literals": 0, - "react/require-default-props": 0, - "react/require-optimization": 0, - "react/jsx-max-depth": [ - 2, - { - "max": 5 - } - ], - "react/jsx-tag-spacing": [ - 2, - { - "closingSlash": "never", - "beforeSelfClosing": "always", - "afterOpening": "never", - "beforeClosing": "never" - } - ], - "react/jsx-max-props-per-line": [ - 2, - { - "maximum": 5 - } - ], - "react/jsx-one-expression-per-line": 0, - "react/state-in-constructor": 0, - "react/no-set-state": 0, - // eslint - "function-call-argument-newline": [ - 2, - "consistent" - ], - "array-element-newline": [ - 2, - "consistent" - ], - "object-property-newline": [ - 2, - { - "allowAllPropertiesOnSameLine": true - } - ], - "multiline-ternary": 0, - "max-lines": [ - 2, - 1000 - ], - "max-lines-per-function": [ - 2, - 600 - ], - "no-magic-numbers": 0, - "sort-keys": 2, - "sort-imports": 0, - "newline-per-chained-call": [ - 2, - { - "ignoreChainWithDepth": 4 - } - ], - "function-paren-newline": 0, - "capitalized-comments": [ - 2, - "always", - { - "ignorePattern": "ignored|webpackChunkName", - "ignoreInlineComments": true - } - ], - "arrow-body-style": [ - 2, - "always" - ], - "prefer-named-capture-group": 0, - "prefer-destructuring": [ - 2, - { - "VariableDeclarator": { - "array": true, - "object": true - }, - "AssignmentExpression": { - "array": true, - "object": true - } - }, - { - "enforceForRenamedProperties": false - } - ], - "no-return-await": 2, - "no-console": 0, - "no-warning-comments": 0, - "no-unused-vars": [ - 2, - { - "varsIgnorePattern": "[iI]gnored" - } - ], - "consistent-this": 2, - "no-inline-comments": 0, - "no-ternary": 0, - "object-curly-spacing": [ - 2, - "never", - { - "arraysInObjects": false, - "objectsInObjects": false - } - ], - "one-var": [ - 2, - { - "var": "always", - "let": "never", - "const": "never" - } - ], - "wrap-regex": 0, - "comma-dangle": [ - 2, - { - "arrays": "always-multiline", - "objects": "always-multiline", - "imports": "always-multiline", - "exports": "always-multiline", - "functions": "never" - } - ], - "no-cond-assign": [ - 2, - "always" - ], - "no-constant-condition": 2, - "no-control-regex": 2, - "no-debugger": 2, - "no-dupe-args": 2, - "no-dupe-keys": 2, - "no-duplicate-case": 2, - "no-empty-character-class": 2, - "no-empty": 2, - "no-ex-assign": 2, - "no-extra-boolean-cast": 2, - "no-extra-parens": 0, - "no-extra-semi": 2, - "no-func-assign": 2, - "no-inner-declarations": [ - 2, - "both" - ], - "no-invalid-regexp": 2, - "no-irregular-whitespace": 2, - "no-negated-in-lhs": 2, - "no-obj-calls": 2, - "no-regex-spaces": 2, - "no-sparse-arrays": 2, - "no-unreachable": 2, - "use-isnan": 2, - "valid-jsdoc": 2, - "valid-typeof": 2, - "no-unexpected-multiline": 2, - "accessor-pairs": [ - 2, - { - "getWithoutSet": true, - "setWithoutGet": true - } - ], - "block-scoped-var": 2, - "complexity": [ - 2, - 5 - ], - "consistent-return": 2, - "curly": [ - 2, - "all" - ], - "default-case": 2, - "dot-notation": [ - 2, - { - "allowKeywords": true - } - ], - "dot-location": [ - 2, - "property" - ], - "eqeqeq": [ - 2, - "smart" - ], - "guard-for-in": 2, - "no-alert": 2, - "no-caller": 2, - "no-div-regex": 2, - "no-else-return": 2, - "no-eq-null": 2, - "no-eval": 2, - "no-extend-native": 2, - "no-extra-bind": 2, - "no-fallthrough": 2, - "no-floating-decimal": 2, - "no-implicit-coercion": [ - 2, - { - "boolean": true, - "number": true, - "string": true - } - ], - "no-implied-eval": 2, - "no-invalid-this": 0, - "no-iterator": 2, - "no-labels": 2, - "no-lone-blocks": 2, - "no-loop-func": 2, - "no-multi-spaces": 2, - "no-multi-str": 2, - "no-native-reassign": 2, - "no-new-func": 2, - "no-new-wrappers": 2, - "no-new": 2, - "no-octal-escape": 2, - "no-octal": 2, - "no-param-reassign": [ - 2, - { - "props": true - } - ], - "no-process-env": 2, - "no-proto": 2, - "no-redeclare": 2, - "no-return-assign": [ - 2, - "always" - ], - "no-script-url": 2, - "no-self-compare": 2, - "no-sequences": 2, - "no-throw-literal": 2, - "no-unused-expressions": 2, - "no-useless-call": 2, - "no-void": 2, - "no-with": 2, - "radix": 2, - "vars-on-top": 2, - "wrap-iife": [ - 2, - "inside" - ], - "yoda": [ - 2, - "never", - { - "exceptRange": true - } - ], - "strict": [ - 2, - "global" - ], - "init-declarations": [ - 2, - "always" - ], - "no-catch-shadow": 2, - "no-delete-var": 2, - "no-label-var": 2, - "no-shadow-restricted-names": 2, - // see @typescript-eslint/no-shadow - "no-shadow": 0, - "no-undef-init": 2, - "no-undef": 2, - "no-undefined": 2, - "no-use-before-define": 2, - "callback-return": 2, - "handle-callback-err": [ - 2, - "err" - ], - "no-mixed-requires": [ - 2, - true - ], - "no-new-require": 2, - "no-path-concat": 2, - "no-process-exit": 2, - "no-restricted-modules": 2, - "no-sync": 2, - "array-bracket-spacing": [ - 2, - "never", - { - "singleValue": false, - "objectsInArrays": false, - "arraysInArrays": false - } - ], - "brace-style": [ - 2, - "1tbs", - {} - ], - "camelcase": [ - 2, - { - "properties": "always" - } - ], - "comma-spacing": [ - 2, - { - "before": false, - "after": true - } - ], - "comma-style": [ - 2, - "last", - { - "exceptions": { - "ArrayExpression": false, - "ArrayPattern": false, - "ArrowFunctionExpression": false, - "CallExpression": false, - "FunctionDeclaration": false, - "FunctionExpression": false, - "ImportDeclaration": false, - "ObjectExpression": false, - "ObjectPattern": false, - "VariableDeclaration": false - } - } - ], - "computed-property-spacing": [ - 2, - "never" - ], - "eol-last": 2, - "func-names": 2, - "func-style": [ - 2, - "declaration" - ], - "jsx-quotes": 2, - "id-length": [ - 2, - { - "min": 3, - "max": 34, - "exceptions": [ - "id", - "to", - "x", - "y" - ] - } - ], - "indent": 0, - "key-spacing": [ - 2, - { - "beforeColon": false, - "afterColon": true - } - ], - "keyword-spacing": [ - 2, - { - "before": true, - "after": true - } - ], - "lines-around-comment": 0, - "linebreak-style": [ - 2, - "unix" - ], - "lines-between-class-members": [ - 2, - "always", - { - "exceptAfterSingleLine": true - } - ], - "max-nested-callbacks": [ - 2, - 5 - ], - "new-cap": [ - 2, - { - "newIsCap": true, - "capIsNew": true - } - ], - "new-parens": 2, - "newline-after-var": [ - 2, - "always" - ], - "no-array-constructor": 2, - "no-continue": 2, - "no-lonely-if": 2, - "no-mixed-spaces-and-tabs": [ - 2, - "smart-tabs" - ], - "no-multiple-empty-lines": [ - 2, - { - "max": 2 - } - ], - "no-nested-ternary": 2, - "no-new-object": 2, - "no-spaced-func": 2, - "no-trailing-spaces": 2, - "no-underscore-dangle": 2, - "no-unneeded-ternary": 2, - "operator-assignment": [ - 2, - "always" - ], - "operator-linebreak": 0, - "padded-blocks": [ - 2, - { - "blocks": "never", - "classes": "never", - "switches": "never" - } - ], - "quote-props": [ - 2, - "as-needed", - { - "keywords": true, - "unnecessary": true, - "numbers": true - } - ], - "quotes": 0, - "id-match": [ - 2, - "^[a-zA-Z0-9$]+$|^[A-Z0-9_]+$", - { - "onlyDeclarations": false, - "properties": true - } - ], - "semi-spacing": [ - 2, - { - "before": false, - "after": true - } - ], - "semi": [ - 2, - "always" - ], - "sort-vars": [ - 2, - { - "ignoreCase": false - } - ], - "space-before-blocks": [ - 2, - "always" - ], - "space-before-function-paren": [ - 2, - { - "anonymous": "always", - "named": "never", - "asyncArrow": "ignore" - } - ], - "space-in-parens": [ - 2, - "never" - ], - "space-infix-ops": [ - 2, - { - "int32Hint": true - } - ], - "space-unary-ops": [ - 2, - { - "words": true, - "nonwords": false - } - ], - "spaced-comment": [ - 2, - "always", - {} - ], - "arrow-parens": [ - 2, - "as-needed" - ], - "arrow-spacing": [ - 2, - { - "before": true, - "after": true - } - ], - "constructor-super": 2, - "generator-star-spacing": 2, - "no-class-assign": 2, - "no-const-assign": 2, - "no-this-before-super": 2, - "no-var": 2, - "object-shorthand": [ - 2, - "always" - ], - "prefer-const": 2, - "prefer-spread": 2, - "prefer-reflect": 2, - "require-yield": 2, - "max-depth": [ - 2, - 4 - ], - "max-len": [ - 2, - 120, - 4, - { - "ignoreComments": true, - "ignoreUrls": true - } - ], - "max-params": [ - 2, - 5 - ], - "max-statements": [ - 2, - 20 - ], - "no-bitwise": 2, - "no-plusplus": 2 - } -} diff --git a/.github/workflows/github-ci.yml b/.github/workflows/github-ci.yml index 164639f..e7f3dc9 100644 --- a/.github/workflows/github-ci.yml +++ b/.github/workflows/github-ci.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - node-version: [16.x, 18.x, 20.x, latest] + node-version: [ 18.x, 20.x, latest ] steps: - uses: actions/checkout@v3 diff --git a/declaration.d.ts b/declaration.d.ts index d117d5b..06e5858 100644 --- a/declaration.d.ts +++ b/declaration.d.ts @@ -1,5 +1,4 @@ /* global SVGSVGElement */ -/* eslint-disable import/no-default-export, init-declarations */ declare module "*.svg" { // eslint-disable-next-line @typescript-eslint/no-require-imports diff --git a/dist/index.js.map b/dist/index.js.map index a77971b..7721557 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","mappings":"mBACA,ICDYA,EDCRC,EAAsB,CEA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFV,EAAyBC,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,mMHL9D,SAAYjB,GACRA,EAAA,kBACAA,EAAA,gBACAA,EAAA,eACH,CAJD,CAAYA,IAAAA,EAAmB,KIA/B,MAAM,EAA+BkB,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SAAS,IAE5E,KACH5C,OAAO6C,oBAAoB,SAAUJ,EAAuB,CAACE,SAAS,GAAO,CAChF,GACF,CAACd,IAEGvC,CACX,CC3BM,SAAU+D,IACZ,MAAwB,oBAAb1D,UAIyB,YAA7BA,SAAS2D,eACpB,CCDM,SAAUC,IACZ,MAAOC,EAAWC,IAAgBnC,EAAAA,EAAAA,UAAkB+B,KAE9CK,GAAyB5B,EAAAA,EAAAA,cAAY,KACvC2B,EAAaJ,IAAuB,GACrC,IAYH,OAVAb,EAAAA,EAAAA,YAAU,KACN,MAAMmB,EAAkCjF,EAAagF,EAAwB,KAI7E,OAFA/D,SAAS+C,iBAAiB,mBAAoBiB,EAAiC,CAAChB,SAAS,EAAOC,SAAS,IAElG,KACHjD,SAASkD,oBAAoB,mBAAoBc,EAAiC,CAAChB,SAAS,GAAO,CACtG,GACF,CAACe,KAEGX,EAAAA,EAAAA,UAAQ,IACJS,GACR,CAACA,GACR,C","sources":["webpack://react-system-hook/webpack/bootstrap","webpack://react-system-hook/./www/library/src/system-hook-type.ts","webpack://react-system-hook/webpack/runtime/define property getters","webpack://react-system-hook/webpack/runtime/hasOwnProperty shorthand","webpack://react-system-hook/webpack/runtime/make namespace object","webpack://react-system-hook/external commonjs \"react\"","webpack://react-system-hook/./www/library/src/util/function.ts","webpack://react-system-hook/./www/library/src/system-hook-const.ts","webpack://react-system-hook/./www/library/src/system-hook-helper.ts","webpack://react-system-hook/./www/library/src/system-hook.ts","webpack://react-system-hook/./www/library/src/screen-size-hook.ts","webpack://react-system-hook/./www/library/src/screen-width-hook.ts","webpack://react-system-hook/./www/library/src/screen-height-hook.ts","webpack://react-system-hook/./www/library/src/util/system.ts","webpack://react-system-hook/./www/library/src/document-visibility-hook.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","export enum ScreenWidthNameEnum {\n desktop = \"desktop\",\n mobile = \"mobile\",\n tablet = \"tablet\",\n}\n\nexport type RectangleSizeType = Readonly<{\n height: number;\n width: number;\n}>;\n\nexport type SystemScreenDataType = Readonly<{\n devicePixelRatio: number;\n isDesktop: boolean;\n isLandscape: boolean;\n isMobile: boolean;\n isPortrait: boolean;\n isTablet: boolean;\n name: ScreenWidthNameEnum;\n}>;\n\nexport type SystemHookType = Readonly<{\n isBrowser: boolean;\n screenInfo: SystemScreenDataType;\n}>;\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react\");","/* global NodeJS, setTimeout, clearTimeout */\n\nexport function debounce>(\n wrappedFunction: (...args: ArgsType) => unknown,\n waitInMs: number\n): (...args: ArgsType) => void {\n let timeout: NodeJS.Timeout | null = null;\n\n return function debouncedFunction(...args: ArgsType): void {\n if (timeout !== null) {\n clearTimeout(timeout);\n }\n\n timeout = setTimeout(() => {\n wrappedFunction(...args);\n }, waitInMs);\n };\n}\n","import {type RectangleSizeType, ScreenWidthNameEnum} from \"./system-hook-type\";\n\nexport const screenMinWidth: Record = {\n [ScreenWidthNameEnum.desktop]: 1024,\n [ScreenWidthNameEnum.mobile]: 320,\n [ScreenWidthNameEnum.tablet]: 768,\n};\n\nexport const defaultScreenSize: RectangleSizeType = {\n height: screenMinWidth.tablet,\n width: screenMinWidth.desktop,\n};\n","/* eslint-disable multiline-comment-style, capitalized-comments, line-comment-position, multiline-comment-style */\n\n/* global window, document */\n\nimport {type RectangleSizeType, ScreenWidthNameEnum, type SystemScreenDataType} from \"./system-hook-type\";\nimport {defaultScreenSize, screenMinWidth} from \"./system-hook-const\";\n\nexport function getScreenName(screenWidth: number): ScreenWidthNameEnum {\n if (screenWidth >= screenMinWidth[ScreenWidthNameEnum.desktop]) {\n return ScreenWidthNameEnum.desktop;\n }\n\n if (screenWidth >= screenMinWidth[ScreenWidthNameEnum.tablet]) {\n return ScreenWidthNameEnum.tablet;\n }\n\n return ScreenWidthNameEnum.mobile;\n}\n\nexport function getScreenSize(): RectangleSizeType {\n if (typeof document === \"undefined\") {\n return defaultScreenSize;\n }\n\n const {documentElement} = document;\n\n const {clientWidth: width, clientHeight: height} = documentElement;\n\n return {height, width};\n}\n\nexport function getDevicePixelRatio(): number {\n const defaultDevicePixelRatio = 2;\n\n if (typeof window === \"undefined\") {\n return defaultDevicePixelRatio;\n }\n\n const {devicePixelRatio} = window;\n\n if (devicePixelRatio <= defaultDevicePixelRatio) {\n return defaultDevicePixelRatio;\n }\n\n return devicePixelRatio;\n}\n\nexport function getScreenState(width: number, height: number): SystemScreenDataType {\n const isLandscape = width > height; // use >, do not use >=, if width === height it is portrait\n const screenName = getScreenName(width);\n\n return {\n devicePixelRatio: getDevicePixelRatio(),\n isDesktop: screenName === ScreenWidthNameEnum.desktop,\n isLandscape,\n isMobile: screenName === ScreenWidthNameEnum.mobile,\n isPortrait: !isLandscape,\n isTablet: screenName === ScreenWidthNameEnum.tablet,\n name: screenName,\n };\n}\n\n/*\nexport function getIsIOS(): boolean {\n if (typeof navigator === 'undefined') {\n return false;\n }\n\n return /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;\n}\n\nexport function getIsAndroid(): boolean {\n if (typeof navigator === 'undefined') {\n return false;\n }\n\n return /(android)/i.test(navigator.userAgent);\n}\n*/\n","/* global window */\n\nimport {useCallback, useEffect, useMemo, useState} from \"react\";\n\nimport {debounce} from \"./util/function\";\n\nimport type {ScreenWidthNameEnum, SystemHookType, SystemScreenDataType} from \"./system-hook-type\";\nimport {getScreenSize, getScreenState} from \"./system-hook-helper\";\n\nexport function useSystem(): SystemHookType {\n const isBrowser = typeof window !== \"undefined\";\n\n const {width: defaultWidth, height: defaultHeight} = getScreenSize();\n\n const {\n devicePixelRatio: defaultDevicePixelRatio,\n isDesktop: defaultIsDesktop,\n isLandscape: defaultIsLandscape,\n isMobile: defaultIsMobile,\n isPortrait: defaultIsPortrait,\n isTablet: defaultIsTablet,\n name: defaultName,\n } = getScreenState(defaultWidth, defaultHeight);\n\n const [devicePixelRatio, setDevicePixelRatio] = useState(defaultDevicePixelRatio);\n const [isDesktop, setIsDesktop] = useState(defaultIsDesktop);\n const [isLandscape, setIsLandscape] = useState(defaultIsLandscape);\n const [isMobile, setIsMobile] = useState(defaultIsMobile);\n const [isPortrait, setIsPortrait] = useState(defaultIsPortrait);\n const [isTablet, setIsTablet] = useState(defaultIsTablet);\n const [name, setName] = useState(defaultName);\n\n const handleResize = useCallback(() => {\n const {width: updatedWidth, height: updatedHeight} = getScreenSize();\n\n const {\n devicePixelRatio: updatedDevicePixelRatio,\n isDesktop: updatedIsDesktop,\n isLandscape: updatedIsLandscape,\n isMobile: updatedIsMobile,\n isPortrait: updatedIsPortrait,\n isTablet: updatedIsTablet,\n name: updatedName,\n } = getScreenState(updatedWidth, updatedHeight);\n\n setDevicePixelRatio(updatedDevicePixelRatio);\n setIsDesktop(updatedIsDesktop);\n setIsLandscape(updatedIsLandscape);\n setIsMobile(updatedIsMobile);\n setIsPortrait(updatedIsPortrait);\n setIsTablet(updatedIsTablet);\n setName(updatedName);\n }, []);\n\n useEffect(() => {\n const handleResizeDebounced = debounce<[]>(handleResize, 150);\n\n window.addEventListener(\"resize\", handleResizeDebounced, {capture: false, passive: true});\n\n return () => {\n window.removeEventListener(\"resize\", handleResizeDebounced, {capture: false});\n };\n }, [handleResize]);\n\n const screenInfo: SystemScreenDataType = useMemo((): SystemScreenDataType => {\n return {\n devicePixelRatio,\n isDesktop,\n isLandscape,\n isMobile,\n isPortrait,\n isTablet,\n name,\n };\n }, [devicePixelRatio, isDesktop, isLandscape, isMobile, isPortrait, isTablet, name]);\n\n return useMemo((): SystemHookType => {\n return {isBrowser, screenInfo};\n }, [isBrowser, screenInfo]);\n}\n","/* global window */\n\nimport {useCallback, useEffect, useMemo, useState} from \"react\";\n\nimport {debounce} from \"./util/function\";\nimport type {RectangleSizeType} from \"./system-hook-type\";\nimport {getScreenSize} from \"./system-hook-helper\";\n\nexport function useScreenSize(): RectangleSizeType {\n const {width: defaultWidth, height: defaultHeight} = getScreenSize();\n\n const [width, setWidth] = useState(defaultWidth);\n const [height, setHeight] = useState(defaultHeight);\n\n const handleResize = useCallback(() => {\n const {width: updatedWidth, height: updatedHeight} = getScreenSize();\n\n setWidth(updatedWidth);\n setHeight(updatedHeight);\n }, []);\n\n useEffect(() => {\n const handleResizeDebounced = debounce<[]>(handleResize, 150);\n\n window.addEventListener(\"resize\", handleResizeDebounced, {capture: false, passive: true});\n\n return () => {\n window.removeEventListener(\"resize\", handleResizeDebounced, {capture: false});\n };\n }, [handleResize]);\n\n return useMemo((): RectangleSizeType => {\n return {height, width};\n }, [height, width]);\n}\n","/* global window */\n\nimport {useCallback, useEffect, useState} from \"react\";\n\nimport {debounce} from \"./util/function\";\nimport {getScreenSize} from \"./system-hook-helper\";\n\nexport function useScreenWidth(): number {\n const {width: defaultWidth} = getScreenSize();\n\n const [width, setWidth] = useState(defaultWidth);\n\n const handleResize = useCallback(() => {\n const {width: updatedWidth} = getScreenSize();\n\n setWidth(updatedWidth);\n }, []);\n\n useEffect(() => {\n const handleResizeDebounced = debounce<[]>(handleResize, 150);\n\n window.addEventListener(\"resize\", handleResizeDebounced, {capture: false, passive: true});\n\n return () => {\n window.removeEventListener(\"resize\", handleResizeDebounced, {capture: false});\n };\n }, [handleResize]);\n\n return width;\n}\n","/* global window */\n\nimport {useCallback, useEffect, useState} from \"react\";\n\nimport {debounce} from \"./util/function\";\nimport {getScreenSize} from \"./system-hook-helper\";\n\nexport function useScreenHeight(): number {\n const {height: defaultHeight} = getScreenSize();\n\n const [height, setHeight] = useState(defaultHeight);\n\n const handleResize = useCallback(() => {\n const {height: updatedHeight} = getScreenSize();\n\n setHeight(updatedHeight);\n }, []);\n\n useEffect(() => {\n const handleResizeDebounced = debounce<[]>(handleResize, 150);\n\n window.addEventListener(\"resize\", handleResizeDebounced, {capture: false, passive: true});\n\n return () => {\n window.removeEventListener(\"resize\", handleResizeDebounced, {capture: false});\n };\n }, [handleResize]);\n\n return height;\n}\n","/* global document */\n\nexport function getDocumentIsVisible(): boolean {\n if (typeof document === \"undefined\") {\n return false;\n }\n\n return document.visibilityState === \"visible\";\n}\n","/* global document */\n\nimport {useCallback, useEffect, useMemo, useState} from \"react\";\n\nimport {debounce} from \"./util/function\";\nimport {getDocumentIsVisible} from \"./util/system\";\n\nexport function useDocumentVisibility(): boolean {\n const [isVisible, setIsVisible] = useState(getDocumentIsVisible());\n\n const handleVisibilityChange = useCallback(() => {\n setIsVisible(getDocumentIsVisible());\n }, []);\n\n useEffect(() => {\n const handleVisibilityChangeDebounced = debounce<[]>(handleVisibilityChange, 150);\n\n document.addEventListener(\"visibilitychange\", handleVisibilityChangeDebounced, {capture: false, passive: true});\n\n return () => {\n document.removeEventListener(\"visibilitychange\", handleVisibilityChangeDebounced, {capture: false});\n };\n }, [handleVisibilityChange]);\n\n return useMemo((): boolean => {\n return isVisible;\n }, [isVisible]);\n}\n"],"names":["ScreenWidthNameEnum","__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","debounce","wrappedFunction","waitInMs","timeout","args","clearTimeout","setTimeout","screenMinWidth","desktop","mobile","tablet","defaultScreenSize","height","width","getScreenName","screenWidth","getScreenSize","document","documentElement","clientWidth","clientHeight","getDevicePixelRatio","window","devicePixelRatio","getScreenState","isLandscape","screenName","isDesktop","isMobile","isPortrait","isTablet","name","useSystem","isBrowser","defaultWidth","defaultHeight","defaultDevicePixelRatio","defaultIsDesktop","defaultIsLandscape","defaultIsMobile","defaultIsPortrait","defaultIsTablet","defaultName","setDevicePixelRatio","useState","setIsDesktop","setIsLandscape","setIsMobile","setIsPortrait","setIsTablet","setName","handleResize","useCallback","updatedWidth","updatedHeight","updatedDevicePixelRatio","updatedIsDesktop","updatedIsLandscape","updatedIsMobile","updatedIsPortrait","updatedIsTablet","updatedName","useEffect","handleResizeDebounced","addEventListener","capture","passive","removeEventListener","screenInfo","useMemo","useScreenSize","setWidth","setHeight","useScreenWidth","useScreenHeight","getDocumentIsVisible","visibilityState","useDocumentVisibility","isVisible","setIsVisible","handleVisibilityChange","handleVisibilityChangeDebounced"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":"mBACA,ICDYA,EDCRC,EAAsB,CEA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFV,EAAyBC,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,mMHL9D,SAAYjB,GACRA,EAAA,kBACAA,EAAA,gBACAA,EAAA,eACH,CAJD,CAAYA,IAAAA,EAAmB,KIA/B,MAAM,EAA+BkB,QAAQ,SCEvC,SAAUC,EACZC,EACAC,GAEA,IAAIC,EAAiC,KAErC,OAAO,YAA8BC,GACjB,OAAZD,GACAE,aAAaF,GAGjBA,EAAUG,YAAW,KACjBL,KAAmBG,EAAK,GACzBF,EACP,CACJ,CCfO,MAAMK,EAAsD,CAC/D,CAAC1B,EAAoB2B,SAAU,KAC/B,CAAC3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UAAkB+B,KAE9CK,GAAyB5B,EAAAA,EAAAA,cAAY,KACvC2B,EAAaJ,IAAuB,GACrC,IAYH,OAVAb,EAAAA,EAAAA,YAAU,KACN,MAAMmB,EAAkCjF,EAAagF,EAAwB,KAI7E,OAFA/D,SAAS+C,iBAAiB,mBAAoBiB,EAAiC,CAAChB,SAAS,EAAOC,SAAS,IAElG,KACHjD,SAASkD,oBAAoB,mBAAoBc,EAAiC,CAAChB,SAAS,GAAO,CACtG,GACF,CAACe,KAEGX,EAAAA,EAAAA,UAAQ,IACJS,GACR,CAACA,GACR,C","sources":["webpack://react-system-hook/webpack/bootstrap","webpack://react-system-hook/./www/library/src/system-hook-type.ts","webpack://react-system-hook/webpack/runtime/define property getters","webpack://react-system-hook/webpack/runtime/hasOwnProperty shorthand","webpack://react-system-hook/webpack/runtime/make namespace object","webpack://react-system-hook/external commonjs \"react\"","webpack://react-system-hook/./www/library/src/util/function.ts","webpack://react-system-hook/./www/library/src/system-hook-const.ts","webpack://react-system-hook/./www/library/src/system-hook-helper.ts","webpack://react-system-hook/./www/library/src/system-hook.ts","webpack://react-system-hook/./www/library/src/screen-size-hook.ts","webpack://react-system-hook/./www/library/src/screen-width-hook.ts","webpack://react-system-hook/./www/library/src/screen-height-hook.ts","webpack://react-system-hook/./www/library/src/util/system.ts","webpack://react-system-hook/./www/library/src/document-visibility-hook.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","export enum ScreenWidthNameEnum {\n desktop = \"desktop\",\n mobile = \"mobile\",\n tablet = \"tablet\",\n}\n\nexport type RectangleSizeType = Readonly<{\n height: number;\n width: number;\n}>;\n\nexport type SystemScreenDataType = Readonly<{\n devicePixelRatio: number;\n isDesktop: boolean;\n isLandscape: boolean;\n isMobile: boolean;\n isPortrait: boolean;\n isTablet: boolean;\n name: ScreenWidthNameEnum;\n}>;\n\nexport type SystemHookType = Readonly<{\n isBrowser: boolean;\n screenInfo: SystemScreenDataType;\n}>;\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react\");","/* global NodeJS, setTimeout, clearTimeout */\n\nexport function debounce>(\n wrappedFunction: (...args: ArgsType) => unknown,\n waitInMs: number\n): (...args: ArgsType) => void {\n let timeout: NodeJS.Timeout | null = null;\n\n return function debouncedFunction(...args: ArgsType): void {\n if (timeout !== null) {\n clearTimeout(timeout);\n }\n\n timeout = setTimeout(() => {\n wrappedFunction(...args);\n }, waitInMs);\n };\n}\n","import {type RectangleSizeType, ScreenWidthNameEnum} from \"./system-hook-type\";\n\nexport const screenMinWidth: Record = {\n [ScreenWidthNameEnum.desktop]: 1024,\n [ScreenWidthNameEnum.mobile]: 320,\n [ScreenWidthNameEnum.tablet]: 768,\n};\n\nexport const defaultScreenSize: RectangleSizeType = {\n height: screenMinWidth.tablet,\n width: screenMinWidth.desktop,\n};\n","/* eslint-disable capitalized-comments */\n\n/* global window, document */\n\nimport {type RectangleSizeType, ScreenWidthNameEnum, type SystemScreenDataType} from \"./system-hook-type\";\nimport {defaultScreenSize, screenMinWidth} from \"./system-hook-const\";\n\nexport function getScreenName(screenWidth: number): ScreenWidthNameEnum {\n if (screenWidth >= screenMinWidth[ScreenWidthNameEnum.desktop]) {\n return ScreenWidthNameEnum.desktop;\n }\n\n if (screenWidth >= screenMinWidth[ScreenWidthNameEnum.tablet]) {\n return ScreenWidthNameEnum.tablet;\n }\n\n return ScreenWidthNameEnum.mobile;\n}\n\nexport function getScreenSize(): RectangleSizeType {\n if (typeof document === \"undefined\") {\n return defaultScreenSize;\n }\n\n const {documentElement} = document;\n\n const {clientWidth: width, clientHeight: height} = documentElement;\n\n return {height, width};\n}\n\nexport function getDevicePixelRatio(): number {\n const defaultDevicePixelRatio = 2;\n\n if (typeof window === \"undefined\") {\n return defaultDevicePixelRatio;\n }\n\n const {devicePixelRatio} = window;\n\n if (devicePixelRatio <= defaultDevicePixelRatio) {\n return defaultDevicePixelRatio;\n }\n\n return devicePixelRatio;\n}\n\nexport function getScreenState(width: number, height: number): SystemScreenDataType {\n const isLandscape = width > height; // use >, do not use >=, if width === height it is portrait\n const screenName = getScreenName(width);\n\n return {\n devicePixelRatio: getDevicePixelRatio(),\n isDesktop: screenName === ScreenWidthNameEnum.desktop,\n isLandscape,\n isMobile: screenName === ScreenWidthNameEnum.mobile,\n isPortrait: !isLandscape,\n isTablet: screenName === ScreenWidthNameEnum.tablet,\n name: screenName,\n };\n}\n\n/*\nexport function getIsIOS(): boolean {\n if (typeof navigator === 'undefined') {\n return false;\n }\n\n return /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;\n}\n\nexport function getIsAndroid(): boolean {\n if (typeof navigator === 'undefined') {\n return false;\n }\n\n return /(android)/i.test(navigator.userAgent);\n}\n*/\n","/* global window */\n\nimport {useCallback, useEffect, useMemo, useState} from \"react\";\n\nimport {debounce} from \"./util/function\";\n\nimport type {ScreenWidthNameEnum, SystemHookType, SystemScreenDataType} from \"./system-hook-type\";\nimport {getScreenSize, getScreenState} from \"./system-hook-helper\";\n\nexport function useSystem(): SystemHookType {\n const isBrowser = typeof window !== \"undefined\";\n\n const {width: defaultWidth, height: defaultHeight} = getScreenSize();\n\n const {\n devicePixelRatio: defaultDevicePixelRatio,\n isDesktop: defaultIsDesktop,\n isLandscape: defaultIsLandscape,\n isMobile: defaultIsMobile,\n isPortrait: defaultIsPortrait,\n isTablet: defaultIsTablet,\n name: defaultName,\n } = getScreenState(defaultWidth, defaultHeight);\n\n const [devicePixelRatio, setDevicePixelRatio] = useState(defaultDevicePixelRatio);\n const [isDesktop, setIsDesktop] = useState(defaultIsDesktop);\n const [isLandscape, setIsLandscape] = useState(defaultIsLandscape);\n const [isMobile, setIsMobile] = useState(defaultIsMobile);\n const [isPortrait, setIsPortrait] = useState(defaultIsPortrait);\n const [isTablet, setIsTablet] = useState(defaultIsTablet);\n const [name, setName] = useState(defaultName);\n\n const handleResize = useCallback(() => {\n const {width: updatedWidth, height: updatedHeight} = getScreenSize();\n\n const {\n devicePixelRatio: updatedDevicePixelRatio,\n isDesktop: updatedIsDesktop,\n isLandscape: updatedIsLandscape,\n isMobile: updatedIsMobile,\n isPortrait: updatedIsPortrait,\n isTablet: updatedIsTablet,\n name: updatedName,\n } = getScreenState(updatedWidth, updatedHeight);\n\n setDevicePixelRatio(updatedDevicePixelRatio);\n setIsDesktop(updatedIsDesktop);\n setIsLandscape(updatedIsLandscape);\n setIsMobile(updatedIsMobile);\n setIsPortrait(updatedIsPortrait);\n setIsTablet(updatedIsTablet);\n setName(updatedName);\n }, []);\n\n useEffect(() => {\n const handleResizeDebounced = debounce<[]>(handleResize, 150);\n\n window.addEventListener(\"resize\", handleResizeDebounced, {capture: false, passive: true});\n\n return (): undefined => {\n window.removeEventListener(\"resize\", handleResizeDebounced, {capture: false});\n };\n }, [handleResize]);\n\n const screenInfo: SystemScreenDataType = useMemo((): SystemScreenDataType => {\n return {\n devicePixelRatio,\n isDesktop,\n isLandscape,\n isMobile,\n isPortrait,\n isTablet,\n name,\n };\n }, [devicePixelRatio, isDesktop, isLandscape, isMobile, isPortrait, isTablet, name]);\n\n return useMemo((): SystemHookType => {\n return {isBrowser, screenInfo};\n }, [isBrowser, screenInfo]);\n}\n","/* global window */\n\nimport {useCallback, useEffect, useMemo, useState} from \"react\";\n\nimport {debounce} from \"./util/function\";\nimport type {RectangleSizeType} from \"./system-hook-type\";\nimport {getScreenSize} from \"./system-hook-helper\";\n\nexport function useScreenSize(): RectangleSizeType {\n const {width: defaultWidth, height: defaultHeight} = getScreenSize();\n\n const [width, setWidth] = useState(defaultWidth);\n const [height, setHeight] = useState(defaultHeight);\n\n const handleResize = useCallback(() => {\n const {width: updatedWidth, height: updatedHeight} = getScreenSize();\n\n setWidth(updatedWidth);\n setHeight(updatedHeight);\n }, []);\n\n useEffect(() => {\n const handleResizeDebounced = debounce<[]>(handleResize, 150);\n\n window.addEventListener(\"resize\", handleResizeDebounced, {capture: false, passive: true});\n\n return (): undefined => {\n window.removeEventListener(\"resize\", handleResizeDebounced, {capture: false});\n };\n }, [handleResize]);\n\n return useMemo((): RectangleSizeType => {\n return {height, width};\n }, [height, width]);\n}\n","/* global window */\n\nimport {useCallback, useEffect, useState} from \"react\";\n\nimport {debounce} from \"./util/function\";\nimport {getScreenSize} from \"./system-hook-helper\";\n\nexport function useScreenWidth(): number {\n const {width: defaultWidth} = getScreenSize();\n\n const [width, setWidth] = useState(defaultWidth);\n\n const handleResize = useCallback(() => {\n const {width: updatedWidth} = getScreenSize();\n\n setWidth(updatedWidth);\n }, []);\n\n useEffect(() => {\n const handleResizeDebounced = debounce<[]>(handleResize, 150);\n\n window.addEventListener(\"resize\", handleResizeDebounced, {capture: false, passive: true});\n\n return (): undefined => {\n window.removeEventListener(\"resize\", handleResizeDebounced, {capture: false});\n };\n }, [handleResize]);\n\n return width;\n}\n","/* global window */\n\nimport {useCallback, useEffect, useState} from \"react\";\n\nimport {debounce} from \"./util/function\";\nimport {getScreenSize} from \"./system-hook-helper\";\n\nexport function useScreenHeight(): number {\n const {height: defaultHeight} = getScreenSize();\n\n const [height, setHeight] = useState(defaultHeight);\n\n const handleResize = useCallback(() => {\n const {height: updatedHeight} = getScreenSize();\n\n setHeight(updatedHeight);\n }, []);\n\n useEffect(() => {\n const handleResizeDebounced = debounce<[]>(handleResize, 150);\n\n window.addEventListener(\"resize\", handleResizeDebounced, {capture: false, passive: true});\n\n return (): undefined => {\n window.removeEventListener(\"resize\", handleResizeDebounced, {capture: false});\n };\n }, [handleResize]);\n\n return height;\n}\n","/* global document */\n\nexport function getDocumentIsVisible(): boolean {\n if (typeof document === \"undefined\") {\n return false;\n }\n\n return document.visibilityState === \"visible\";\n}\n","/* global document */\n\nimport {useCallback, useEffect, useMemo, useState} from \"react\";\n\nimport {debounce} from \"./util/function\";\nimport {getDocumentIsVisible} from \"./util/system\";\n\nexport function useDocumentVisibility(): boolean {\n const [isVisible, setIsVisible] = useState(getDocumentIsVisible());\n\n const handleVisibilityChange = useCallback(() => {\n setIsVisible(getDocumentIsVisible());\n }, []);\n\n useEffect(() => {\n const handleVisibilityChangeDebounced = debounce<[]>(handleVisibilityChange, 150);\n\n document.addEventListener(\"visibilitychange\", handleVisibilityChangeDebounced, {capture: false, passive: true});\n\n return (): undefined => {\n document.removeEventListener(\"visibilitychange\", handleVisibilityChangeDebounced, {capture: false});\n };\n }, [handleVisibilityChange]);\n\n return useMemo((): boolean => {\n return isVisible;\n }, [isVisible]);\n}\n"],"names":["ScreenWidthNameEnum","__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","debounce","wrappedFunction","waitInMs","timeout","args","clearTimeout","setTimeout","screenMinWidth","desktop","mobile","tablet","defaultScreenSize","height","width","getScreenName","screenWidth","getScreenSize","document","documentElement","clientWidth","clientHeight","getDevicePixelRatio","window","devicePixelRatio","getScreenState","isLandscape","screenName","isDesktop","isMobile","isPortrait","isTablet","name","useSystem","isBrowser","defaultWidth","defaultHeight","defaultDevicePixelRatio","defaultIsDesktop","defaultIsLandscape","defaultIsMobile","defaultIsPortrait","defaultIsTablet","defaultName","setDevicePixelRatio","useState","setIsDesktop","setIsLandscape","setIsMobile","setIsPortrait","setIsTablet","setName","handleResize","useCallback","updatedWidth","updatedHeight","updatedDevicePixelRatio","updatedIsDesktop","updatedIsLandscape","updatedIsMobile","updatedIsPortrait","updatedIsTablet","updatedName","useEffect","handleResizeDebounced","addEventListener","capture","passive","removeEventListener","screenInfo","useMemo","useScreenSize","setWidth","setHeight","useScreenWidth","useScreenHeight","getDocumentIsVisible","visibilityState","useDocumentVisibility","isVisible","setIsVisible","handleVisibilityChange","handleVisibilityChangeDebounced"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/src/document-visibility-hook.js.map b/dist/src/document-visibility-hook.js.map index 97cd0c8..ff1e92b 100644 --- a/dist/src/document-visibility-hook.js.map +++ b/dist/src/document-visibility-hook.js.map @@ -1 +1 @@ -{"version":3,"file":"document-visibility-hook.js","sourceRoot":"","sources":["../../www/library/src/document-visibility-hook.ts"],"names":[],"mappings":"AAAA,qBAAqB;AAErB,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAEnD,MAAM,UAAU,qBAAqB;IACjC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAU,oBAAoB,EAAE,CAAC,CAAC;IAE5E,MAAM,sBAAsB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC5C,YAAY,CAAC,oBAAoB,EAAE,CAAC,CAAC;IACzC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACX,MAAM,+BAA+B,GAAG,QAAQ,CAAK,sBAAsB,EAAE,GAAG,CAAC,CAAC;QAElF,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,+BAA+B,EAAE,EAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;QAEhH,OAAO,GAAG,EAAE;YACR,QAAQ,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,+BAA+B,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC,CAAC,CAAC;QACxG,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAE7B,OAAO,OAAO,CAAC,GAAY,EAAE;QACzB,OAAO,SAAS,CAAC;IACrB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;AACpB,CAAC"} \ No newline at end of file +{"version":3,"file":"document-visibility-hook.js","sourceRoot":"","sources":["../../www/library/src/document-visibility-hook.ts"],"names":[],"mappings":"AAAA,qBAAqB;AAErB,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAEnD,MAAM,UAAU,qBAAqB;IACjC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAU,oBAAoB,EAAE,CAAC,CAAC;IAE5E,MAAM,sBAAsB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC5C,YAAY,CAAC,oBAAoB,EAAE,CAAC,CAAC;IACzC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACX,MAAM,+BAA+B,GAAG,QAAQ,CAAK,sBAAsB,EAAE,GAAG,CAAC,CAAC;QAElF,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,+BAA+B,EAAE,EAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;QAEhH,OAAO,GAAc,EAAE;YACnB,QAAQ,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,+BAA+B,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC,CAAC,CAAC;QACxG,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAE7B,OAAO,OAAO,CAAC,GAAY,EAAE;QACzB,OAAO,SAAS,CAAC;IACrB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;AACpB,CAAC"} \ No newline at end of file diff --git a/dist/src/screen-height-hook.js.map b/dist/src/screen-height-hook.js.map index 96370e8..d70b3dc 100644 --- a/dist/src/screen-height-hook.js.map +++ b/dist/src/screen-height-hook.js.map @@ -1 +1 @@ -{"version":3,"file":"screen-height-hook.js","sourceRoot":"","sources":["../../www/library/src/screen-height-hook.ts"],"names":[],"mappings":"AAAA,mBAAmB;AAEnB,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEvD,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAEnD,MAAM,UAAU,eAAe;IAC3B,MAAM,EAAC,MAAM,EAAE,aAAa,EAAC,GAAG,aAAa,EAAE,CAAC;IAEhD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAS,aAAa,CAAC,CAAC;IAE5D,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,EAAE;QAClC,MAAM,EAAC,MAAM,EAAE,aAAa,EAAC,GAAG,aAAa,EAAE,CAAC;QAEhD,SAAS,CAAC,aAAa,CAAC,CAAC;IAC7B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACX,MAAM,qBAAqB,GAAG,QAAQ,CAAK,YAAY,EAAE,GAAG,CAAC,CAAC;QAE9D,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,EAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;QAE1F,OAAO,GAAG,EAAE;YACR,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC,CAAC,CAAC;QAClF,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file +{"version":3,"file":"screen-height-hook.js","sourceRoot":"","sources":["../../www/library/src/screen-height-hook.ts"],"names":[],"mappings":"AAAA,mBAAmB;AAEnB,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEvD,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAEnD,MAAM,UAAU,eAAe;IAC3B,MAAM,EAAC,MAAM,EAAE,aAAa,EAAC,GAAG,aAAa,EAAE,CAAC;IAEhD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAS,aAAa,CAAC,CAAC;IAE5D,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,EAAE;QAClC,MAAM,EAAC,MAAM,EAAE,aAAa,EAAC,GAAG,aAAa,EAAE,CAAC;QAEhD,SAAS,CAAC,aAAa,CAAC,CAAC;IAC7B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACX,MAAM,qBAAqB,GAAG,QAAQ,CAAK,YAAY,EAAE,GAAG,CAAC,CAAC;QAE9D,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,EAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;QAE1F,OAAO,GAAc,EAAE;YACnB,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC,CAAC,CAAC;QAClF,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/dist/src/screen-size-hook.js.map b/dist/src/screen-size-hook.js.map index 5eb4e20..4f5fb0a 100644 --- a/dist/src/screen-size-hook.js.map +++ b/dist/src/screen-size-hook.js.map @@ -1 +1 @@ -{"version":3,"file":"screen-size-hook.js","sourceRoot":"","sources":["../../www/library/src/screen-size-hook.ts"],"names":[],"mappings":"AAAA,mBAAmB;AAEnB,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAEnD,MAAM,UAAU,aAAa;IACzB,MAAM,EAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAC,GAAG,aAAa,EAAE,CAAC;IAErE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAS,YAAY,CAAC,CAAC;IACzD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAS,aAAa,CAAC,CAAC;IAE5D,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,EAAE;QAClC,MAAM,EAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAC,GAAG,aAAa,EAAE,CAAC;QAErE,QAAQ,CAAC,YAAY,CAAC,CAAC;QACvB,SAAS,CAAC,aAAa,CAAC,CAAC;IAC7B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACX,MAAM,qBAAqB,GAAG,QAAQ,CAAK,YAAY,EAAE,GAAG,CAAC,CAAC;QAE9D,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,EAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;QAE1F,OAAO,GAAG,EAAE;YACR,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC,CAAC,CAAC;QAClF,CA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O,EAAE,IAAI,EAAC,CAAC,CAAC;QAE1F,OAAO,GAAc,EAAE;YACnB,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC,CAAC,CAAC;QAClF,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO,OAAO,CAAC,GAAsB,EAAE;QACnC,OAAO,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC;IAC3B,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;AACxB,CAAC"} \ No newline at end of file diff --git a/dist/src/screen-width-hook.js.map b/dist/src/screen-width-hook.js.map index 0e19c72..e65b2fd 100644 --- a/dist/src/screen-width-hook.js.map +++ b/dist/src/screen-width-hook.js.map @@ -1 +1 @@ -{"version":3,"file":"screen-width-hook.js","sourceRoot":"","sources":["../../www/library/src/screen-width-hook.ts"],"names":[],"mappings":"AAAA,mBAAmB;AAEnB,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEvD,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAEnD,MAAM,UAAU,cAAc;IAC1B,MAAM,EAAC,KAAK,EAAE,YAAY,EAAC,GAAG,aAAa,EAAE,CAAC;IAE9C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAS,YAAY,CAAC,CAAC;IAEzD,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,EAAE;QAClC,MAAM,EAAC,KAAK,EAAE,YAAY,EAAC,GAAG,aAAa,EAAE,CAAC;QAE9C,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC3B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACX,MAAM,qBAAqB,GAAG,QAAQ,CA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O,EAAE,IAAI,EAAC,CAAC,CAAC;QAE1F,OAAO,GAAc,EAAE;YACnB,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC,CAAC,CAAC;QAClF,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO,KAAK,CAAC;AACjB,CAAC"} \ No newline at end of file diff --git a/dist/src/system-hook-helper.js b/dist/src/system-hook-helper.js index c48c6bd..aaeba57 100644 --- a/dist/src/system-hook-helper.js +++ b/dist/src/system-hook-helper.js @@ -1,4 +1,4 @@ -/* eslint-disable multiline-comment-style, capitalized-comments, line-comment-position, multiline-comment-style */ +/* eslint-disable capitalized-comments */ /* global window, document */ import { ScreenWidthNameEnum } from "./system-hook-type"; import { defaultScreenSize, screenMinWidth } from "./system-hook-const"; diff --git a/dist/src/system-hook-helper.js.map b/dist/src/system-hook-helper.js.map index b6ebad2..b2e5422 100644 --- a/dist/src/system-hook-helper.js.map +++ b/dist/src/system-hook-helper.js.map @@ -1 +1 @@ -{"version":3,"file":"system-hook-helper.js","sourceRoot":"","sources":["../../www/library/src/system-hook-helper.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAElH,6BAA6B;AAE7B,OAAO,EAAyB,mBAAmB,EAA4B,MAAM,oBAAoB,CAAC;AAC1G,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAEtE,MAAM,UAAU,aAAa,CAAC,WAAmB;IAC7C,IAAI,WAAW,IAAI,cAAc,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7D,OAAO,mBAAmB,CAAC,OAAO,CAAC;IACvC,CAAC;IAED,IAAI,WAAW,IAAI,cAAc,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5D,OAAO,mBAAmB,CAAC,MAAM,CAAC;IACtC,CAAC;IAED,OAAO,mBAAmB,CAAC,MAAM,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,aAAa;IACzB,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,iBAAiB,CAAC;IAC7B,CAAC;IAED,MAAM,EAAC,eAAe,EAAC,GAAG,QAAQ,CAAC;IAEnC,MAAM,EAAC,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAC,GAAG,eAAe,CAAC;IAEnE,OAAO,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,mBAAmB;IAC/B,MAAM,uBAAuB,GAAG,CAAC,CAAC;IAElC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAChC,OAAO,uBAAuB,CAAC;IACnC,CAAC;IAED,MAAM,EAAC,gBAAgB,EAAC,GAAG,MAAM,CAAC;IAElC,IAAI,gBAAgB,IAAI,uBAAuB,EAAE,CAAC;QAC9C,OAAO,uBAAuB,CAAC;IACnC,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE,MAAc;IACxD,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM,CAAC,CAAC,2DAA2D;IAC/F,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAExC,OAAO;QACH,gBAAgB,EAAE,mBAAmB,EAAE;QACvC,SAAS,EAAE,UAAU,KAAK,mBAAmB,CAAC,OAAO;QACrD,WAAW;QACX,QAAQ,EAAE,UAAU,KAAK,mBAAmB,CAAC,MAAM;QACnD,UAAU,EAAE,CAAC,WAAW;QACxB,QAAQ,EAAE,UAAU,KAAK,mBAAmB,CAAC,MAAM;QACnD,IAAI,EAAE,UAAU;KACnB,CAAC;AACN,CAAC;AAED;;;;;;;;;;;;;;;;EAgBE"} \ No newline at end of file +{"version":3,"file":"system-hook-helper.js","sourceRoot":"","sources":["../../www/library/src/system-hook-helper.ts"],"names":[],"mappings":"AA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D;IAC/F,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAExC,OAAO;QACH,gBAAgB,EAAE,mBAAmB,EAAE;QACvC,SAAS,EAAE,UAAU,KAAK,mBAAmB,CAAC,OAAO;QACrD,WAAW;QACX,QAAQ,EAAE,UAAU,KAAK,mBAAmB,CAAC,MAAM;QACnD,UAAU,EAAE,CAAC,WAAW;QACxB,QAAQ,EAAE,UAAU,KAAK,mBAAmB,CAAC,MAAM;QACnD,IAAI,EAAE,UAAU;KACnB,CAAC;AACN,CAAC;AAED;;;;;;;;;;;;;;;;EAgBE"} \ No newline at end of file diff --git a/dist/src/system-hook.js.map b/dist/src/system-hook.js.map index 558c1c7..83c12b9 100644 --- a/dist/src/system-hook.js.map +++ b/dist/src/system-hook.js.map @@ -1 +1 @@ -{"version":3,"file":"system-hook.js","sourceRoot":"","sources":["../../www/library/src/system-hook.ts"],"names":[],"mappings":"AAAA,mBAAmB;AAEnB,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AAGzC,OAAO,EAAC,aAAa,EAAE,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAEnE,MAAM,UAAU,SAAS;IACrB,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;IAEhD,MAAM,EAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAC,GAAG,aAAa,EAAE,CAAC;IAErE,MAAM,EACF,gBAAgB,EAAE,uBAAuB,EACzC,SAAS,EAAE,gBAAgB,EAC3B,WAAW,EAAE,kBAAkB,EAC/B,QAAQ,EAAE,eAAe,EACzB,UAAU,EAAE,iBAAiB,EAC7B,QAAQ,EAAE,eAAe,EACzB,IAAI,EAAE,WAAW,GACpB,GAAG,cAAc,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;IAEhD,MAAM,CA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EAAE,UAAU,CAAC,CAAC,CAAC;AAChC,CAAC"} \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..793abbe --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,444 @@ +/* eslint-disable sort-keys, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */ +import eslintJs from "@eslint/js"; +import eslintConfigPrettier from "eslint-config-prettier"; +import typescriptEslint from "typescript-eslint"; +import sonarjs from "eslint-plugin-sonarjs"; +import eslintPluginUnicorn from "eslint-plugin-unicorn"; +import jest from "eslint-plugin-jest"; + +/** + * List of plugins to add + * react + * react-hooks + * babel - maybe not needed + * JSX-a11y + * filenames + * import + * optimize-regex + */ + +export default [ + eslintJs.configs.all, + ...typescriptEslint.configs.all, + jest.configs["flat/all"], + sonarjs.configs.recommended, + eslintConfigPrettier, + { + languageOptions: { + parserOptions: { + project: [ + "./tsconfig.json", + ], + ecmaVersion: 2020, + sourceType: "module", + ecmaFeatures: { + jsx: true, + }, + }, + globals: { + JSX: true, + require: true, + module: true, + console: true, + }, + }, + plugins: { + unicorn: eslintPluginUnicorn, + // Sonarjs: sonarjs, + + }, + rules: { + // Jest + ...jest.configs["flat/all"].rules, + "jest/require-hook": [ + 2, + { + allowedFunctionCalls: [ + "innerInitialization", + ], + }, + ], + + // React, need to uncomment + // "react/jsx-uses-react": 2, + // "react/react-in-jsx-scope": 0, + // "react/jsx-no-bind": 0, + // "react/jsx-newline": 0, + // "react/jsx-filename-extension": [ + // 2, + // { + // "extensions": [ + // ".ts", + // ".tsx", + // ], + // }, + // ], + // "react/no-unused-prop-types": 2, + // "react/sort-comp": 2, + // "react/jsx-sort-props": [ + // 2, + // { + // "reservedFirst": false, + // "shorthandLast": false, + // "ignoreCase": false, + // "callbacksLast": false, + // "noSortAlphabetically": false, + // }, + // ], + // "react/jsx-closing-bracket-location": [ + // 2, + // "line-aligned", + // ], + // "react/forbid-component-props": 0, + // "react/jsx-indent-props": [ + // 2, + // "first", + // ], + // "react/jsx-no-literals": 0, + // "react/require-default-props": 0, + // "react/require-optimization": 0, + // "react/jsx-max-depth": [ + // 2, + // { + // "max": 5, + // }, + // ], + // "react/jsx-tag-spacing": [ + // 2, + // { + // "closingSlash": "never", + // "beforeSelfClosing": "always", + // "afterOpening": "never", + // "beforeClosing": "never", + // }, + // ], + // "react/jsx-max-props-per-line": [ + // 2, + // { + // "maximum": 5, + // }, + // ], + // "react/jsx-one-expression-per-line": 0, + // "react/state-in-constructor": 0, + // "react/no-set-state": 0, + + // React-hooks, need to uncomment + // "react-hooks/rules-of-hooks": 2, + // "react-hooks/exhaustive-deps": 2, + + // Babel, need to uncomment + // "babel/new-cap": 2, + // "babel/camelcase": 2, + // "babel/no-invalid-this": 2, + // "babel/object-curly-spacing": 2, + // "babel/quotes": 0, + // "babel/semi": 2, + // "babel/no-unused-expressions": 2, + // "babel/valid-typeof": 2, + + // JSX-a11y, need to uncomment + // Deprecated + // "jsx-a11y/label-has-for": 0, + // "jsx-a11y/no-access-key": 2, + // "jsx-a11y/no-autofocus": 2, + // "jsx-a11y/no-onchange": 2, + + // Filenames, need to uncomment + // "filenames/no-index": 2, + // "filenames/match-regex": [ + // 2, + // "^[a-z\\.\\-\\d]+$", + // True + // ], + // "filenames/match-exported": 0, + + // Import, need to uncomment + // "import/no-named-as-default-member": 0, + // "import/default": 2, + // "import/no-unused-modules": 2, + // "import/no-useless-path-segments": 2, + // "import/no-default-export": 2, + // "import/order": [ + // 2, + // { + // "newlines-between": "always-and-inside-groups", + // "groups": [ + // "builtin", + // "internal", + // "external", + // "parent", + // "sibling", + // "index" + // ] + // } + // ], + + // Optimize-regex, need to uncomment + // "optimize-regex/optimize-regex": 2, + + // Typescript + "@typescript-eslint/array-type": [ + 2, + { + "default": "generic", + }, + ], + "@typescript-eslint/ban-ts-comment": 1, + "@typescript-eslint/naming-convention": [ + 2, + { + selector: "typeAlias", + format: [ + "StrictPascalCase", + ], + suffix: [ + "Type", + ], + }, + { + selector: "enum", + format: [ + "StrictPascalCase", + ], + suffix: [ + "Enum", + ], + }, + ], + "@typescript-eslint/no-shadow": [ + 2, + { + builtinGlobals: false, + hoist: "all", + }, + ], + "@typescript-eslint/no-unused-vars": [ + 2, + { + varsIgnorePattern: "[iI]gnored", + }, + ], + "@typescript-eslint/no-use-before-define": 2, + "@typescript-eslint/no-misused-promises": [ + 2, + { + checksVoidReturn: { + arguments: true, + attributes: true, + properties: true, + returns: true, + variables: true, + }, + }, + ], + "@typescript-eslint/no-floating-promises": [ + 2, + { + ignoreIIFE: true, + }, + ], + "@typescript-eslint/no-unnecessary-boolean-literal-compare": 0, + // Typescript - defined by eslint + "@typescript-eslint/space-before-function-paren": 0, + "@typescript-eslint/indent": 0, + "@typescript-eslint/comma-dangle": 0, + "@typescript-eslint/no-magic-numbers": 0, + "@typescript-eslint/no-extra-parens": 0, + "@typescript-eslint/lines-around-comment": 0, + "@typescript-eslint/lines-between-class-members": 0, + "@typescript-eslint/block-spacing": 0, + "@typescript-eslint/quotes": 0, + "@typescript-eslint/use-unknown-in-catch-callback-variable": 0, + // TODO: enable this + "@typescript-eslint/prefer-readonly-parameter-types": 0, + // "@typescript-eslint/prefer-readonly-parameter-types": [ + // 2, + // { + // "allow": [ + // { + // "from": "package", + // "name": "Compiler", + // "package": "webpack" + // } + // ] + // } + // ], + + // Unicorn + "unicorn/prefer-string-replace-all": 0, + "unicorn/prefer-node-protocol": 2, + "unicorn/no-array-callback-reference": 0, + "unicorn/no-array-for-each": 0, + "unicorn/filename-case": 2, + "unicorn/no-array-reduce": 0, + "unicorn/no-null": 0, + "unicorn/no-fn-reference-in-iterator": 2, + "unicorn/prevent-abbreviations": [ + 2, + { + replacements: { + attr: false, + attrs: false, + arg: false, + args: false, + prop: false, + props: false, + prev: false, + dev: false, + evt: false, + src: false, + ref: false, + }, + }, + ], + + // eslint + "padded-blocks": [ + 2, + { + blocks: "never", + classes: "never", + switches: "never", + }, + ], + "func-style": [ + 2, + "declaration", + ], + "function-call-argument-newline": [ + 2, + "consistent", + ], + "max-len": [ + 2, + 120, + 4, + { + ignoreComments: true, + ignoreUrls: true, + }, + ], + "quote-props": [ + 2, + "as-needed", + { + keywords: true, + unnecessary: true, + numbers: true, + }, + ], + quotes: 0, + "sort-imports": 0, + "array-element-newline": [ + 2, + "consistent", + ], + "one-var": [ + 2, + { + "var": "always", + let: "never", + "const": "never", + }, + ], + "arrow-body-style": [ + 2, + "always", + ], + "max-statements": [ + 2, + 20, + ], + "dot-location": [ + 2, + "property", + ], + "max-lines-per-function": [ + 2, + 600, + ], + "object-property-newline": [ + 2, + { + allowAllPropertiesOnSameLine: true, + }, + ], + "multiline-ternary": 0, + "max-lines": [ + 2, + 1000, + ], + "newline-per-chained-call": [ + 2, + { + ignoreChainWithDepth: 4, + }, + ], + "function-paren-newline": 0, + "capitalized-comments": [ + 2, + "always", + { + ignorePattern: "ignored|webpackChunkName", + ignoreInlineComments: true, + }, + ], + "prefer-named-capture-group": 0, + "no-console": 0, + "no-warning-comments": 0, + "no-inline-comments": 0, + "multiline-comment-style": 0, + "no-ternary": 0, + "wrap-regex": 0, + "wrap-iife": [ + 2, + "inside", + ], + "max-params": [ + 2, + 5, + ], + "id-length": [ + 2, + { + min: 3, + max: 34, + exceptions: [ + "id", + "to", + "x", + "y", + ], + }, + ], + }, + }, + { + ignores: [ + // Dist + "dist/*", + "dist-server/*", + + // NPM + "node_modules/*", + + // Report + "coverage-ts/*", + "tsc-check/*", + "coverage/*", + + // Style's d.ts + // eslint-disable-next-line arrow-body-style, @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-unsafe-argument + pathToFile => /\S+\.s?css\.d\.ts/u.test(pathToFile), + + // Test + "test-backstop/*", + + // Static site + "static-site/*", + + // Storybook + "storybook-static/*", + ], + }, +]; diff --git a/license b/license index 07ce202..53051ff 100644 --- a/license +++ b/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Dzmitry Turautsou +Copyright (c) 2024 Dzmitry Turautsou Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 3b9581e..0e3dc52 100644 --- a/package.json +++ b/package.json @@ -27,117 +27,124 @@ }, "homepage": "https://github.com/webbestmaster/react-system-hook#readme", "engines": { - "node": ">=16.0.0" + "node": ">=18.0.0" }, "scripts": { "front:start-dev": "cross-env NODE_ENV=development SIDE=front webpack-cli serve --progress", "front:start-dev:transpile-only": "cross-env NODE_ENV=development SIDE=front TS_TRANSPILE_ONLY=true webpack-cli serve --progress", "front:build": "cross-env NODE_ENV=production SIDE=front NODE_OPTIONS=--max-old-space-size=512 webpack --progress", - "_back:start": "cross-env NODE_ENV=production node ./dist-server/dist/index.js", - "_back:build": "cross-env NODE_ENV=production SIDE=back IS_SERVER_PROD_BUILD=true NODE_OPTIONS=--max-old-space-size=256 webpack --progress", - "_back:build:watch": "cross-env NODE_ENV=production SIDE=back webpack --progress --watch", - "_back:nodemon": "nodemon ./dist-server/dist/index.js", - "_build:prod:start": "npm run front:build && npm run back:build && npm run back:start", - "front:build-library": "cross-env NODE_ENV=production SIDE=front IS_BUILD_LIBRARY=true NODE_OPTIONS=--max-old-space-size=256 webpack --progress && npm run front:tsc-library", - "_make-static-site": "cross-env MAKE_STATIC_SITE=TRUE npm run build:prod:start", + "back:start": "cross-env NODE_ENV=production node ./dist-server/dist/index.js", + "back:build": "cross-env NODE_ENV=production SIDE=back IS_SERVER_PROD_BUILD=true NODE_OPTIONS=--max-old-space-size=512 webpack --progress", + "back:build:watch": "cross-env NODE_ENV=production SIDE=back webpack --progress --watch", + "back:nodemon": "nodemon ./dist-server/dist/index.js", + "build:prod:start": "npm run front:build && npm run back:build && npm run back:start", + "front:build-library": "cross-env NODE_ENV=production SIDE=front IS_BUILD_LIBRARY=true NODE_OPTIONS=--max-old-space-size=512 webpack --progress && npm run front:tsc-library", + "make-static-site": "cross-env MAKE_STATIC_SITE=TRUE npm run build:prod:start", "check": "npm run ts-coverage && npm run tsc && npm run eslint && npm run stylelint", "check:fix": "npm run prettier && npm run ts-coverage && npm run tsc && npm run eslint:fix && npm run stylelint:fix", "eslint": "eslint .", "eslint:fix": "eslint . --fix", + "eslint:watch": "npm-watch eslint", "stylelint": "stylelint ./**.scss", "stylelint:fix": "stylelint ./**.scss --fix", + "stylelint:watch": "npm-watch stylelint", "prettier": "prettier --write \"./**/*.(js|ts|tsx)\" --log-level warn", "tsc": "tsc -p ./tsconfig.json", + "tsc-init": "npx tsc --init", "tsc:watch": "tsc -p ./tsconfig.json --watch", "front:tsc-library": "tsc -p ./tsconfig.library.json && npm run front:tsc-library-css", - "front:tsc-library-css": "cross-env NODE_ENV=production SIDE=front IS_BUILD_LIBRARY=true ts-node ./webpack/util/library/css.ts", - "front:ts-coverage": "typescript-coverage-report --threshold=100 --strict=true --project ./www/", - "back:ts-coverage": "typescript-coverage-report --threshold=100 --strict=true --project ./server/", - "webpack:ts-coverage": "typescript-coverage-report --threshold=100 --strict=true --project ./webpack/", - "ts-coverage": "npm run front:ts-coverage && npm run back:ts-coverage && npm run webpack:ts-coverage", - "test:e2e": "jest --config='test-e2e/config/jest.config.js' ./test-e2e/ --runInBand", + "front:tsc-library-css": "cross-env NODE_ENV=production SIDE=front IS_BUILD_LIBRARY=true ts-node --files ./webpack/util/library/css.ts", + "ts-coverage": "rimraf coverage-ts && typescript-coverage-report --threshold=100 --strict=true --project ./", + "ts-coverage:watch": "npm-watch ts-coverage", + "test:e2e": "jest --config='test-e2e/config/jest.config.ts' ./test-e2e/ --runInBand", "test:unit": "jest --config='test-unit/config/jest.config.ts' ./www/ --runInBand", "test:unit:watch": "jest --config='test-unit/config/jest.config.ts' ./www/ --runInBand --watch", - "_backstop:approve": "backstop approve --config=./test-backstop/backstop-config.json", - "_backstop:test": "backstop test --config=./test-backstop/backstop-config.json", + "backstop:approve": "backstop approve --config=./test-backstop/backstop-config.json", + "backstop:test": "backstop test --config=./test-backstop/backstop-config.json", "pre-commit-hook": "npm run check", "_postinstall": "cp ./git-hooks/pre-commit ./.git/hooks", - "zip": "zip -9 --exclude=*node_modules* --exclude=*.git* -r my-project_`git symbolic-ref --short HEAD`-`date +%Y-%m-%d--%H-%M-%S` ./" + "__start-site": "sudo nginx -c ~/user/master-git/db-cms/site/nginx/nginx.site.conf -g 'daemon off;'", + "lighthouse:run": "ts-node --project ./tsconfig.lighthouse.json --files ./lighthouse/lighthouse.ts", + "storybook:start-dev": "storybook dev -p 6006 -c storybook", + "storybook:build": "storybook build -c storybook", + "clean-install-windows": "rd .\\node_modules\\ -r; npm i" }, "peerDependencies": { - "@types/react": "^18.2.45", - "@types/react-dom": "^18.2.18", - "react": "^18.2.0", - "react-dom": "^18.2.0" + "@types/react": "^18.3.2", + "@types/react-dom": "^18.3.0", + "react": "^18.3.1", + "react-dom": "^18.3.1" }, "devDependencies": { - "@babel/core": "^7.23.6", - "@babel/plugin-transform-strict-mode": "^7.23.3", - "@testing-library/react": "^14.1.2", + "@babel/core": "^7.24.5", + "@babel/plugin-transform-strict-mode": "^7.24.1", + "@eslint/js": "^9.3.0", + "@storybook/addon-actions": "^8.1.1", + "@storybook/addon-essentials": "^8.1.1", + "@storybook/addon-interactions": "^8.1.1", + "@storybook/addon-links": "^8.1.1", + "@storybook/blocks": "^8.1.1", + "@storybook/builder-webpack5": "^8.1.1", + "@storybook/manager-webpack5": "^6.5.16", + "@storybook/react": "^8.1.1", + "@storybook/react-webpack5": "^8.1.1", + "@storybook/testing-library": "^0.2.2", + "@testing-library/react": "^15.0.7", "@types/circular-dependency-plugin": "^5.0.8", "@types/duplicate-package-checker-webpack-plugin": "^2.1.5", "@types/script-ext-html-webpack-plugin": "^2.1.6", - "@types/webpack-bundle-analyzer": "^4.6.3", + "@types/webpack-bundle-analyzer": "^4.7.0", "@types/webpack-node-externals": "^3.0.4", - "@typescript-eslint/eslint-plugin": "^6.15.0", - "@typescript-eslint/parser": "^6.15.0", - "ajv": "^8.12.0", + "@typescript-eslint/eslint-plugin": "^7.9.0", + "@typescript-eslint/parser": "^7.9.0", + "ajv": "^8.13.0", "babel-loader": "^9.1.3", + "backstopjs": "^6.3.23", "circular-dependency-plugin": "^5.2.2", "clean-webpack-plugin": "^4.0.0", - "copy-webpack-plugin": "^11.0.0", + "copy-webpack-plugin": "^12.0.2", "cross-env": "^7.0.3", - "css-loader": "^6.8.1", - "css-minimizer-webpack-plugin": "^5.0.1", - "css-modules-typescript-loader": "^4.0.1", + "css-loader": "^7.1.1", + "css-minimizer-webpack-plugin": "^7.0.0", + "css-module-typescript-loader": "^0.0.3", "duplicate-package-checker-webpack-plugin": "^3.0.0", - "eslint": "^8.56.0", + "eslint": "^9.3.0", "eslint-config-prettier": "^9.1.0", - "eslint-import-resolver-typescript": "^3.6.1", - "eslint-plugin-babel": "^5.3.1", - "eslint-plugin-filenames": "^1.3.2", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-jest": "^27.6.0", - "eslint-plugin-jsx-a11y": "^6.8.0", - "eslint-plugin-no-loops": "^0.3.0", - "eslint-plugin-no-use-extend-native": "^0.5.0", - "eslint-plugin-optimize-regex": "^1.2.1", - "eslint-plugin-prettier": "^5.1.1", - "eslint-plugin-promise": "^6.1.1", - "eslint-plugin-react": "^7.33.2", - "eslint-plugin-react-hooks": "^4.6.0", - "eslint-plugin-sonarjs": "^0.23.0", - "eslint-plugin-typescript-sort-keys": "^3.1.0", - "eslint-plugin-unicorn": "^50.0.1", + "eslint-plugin-jest": "^28.5.0", + "eslint-plugin-sonarjs": "^1.0.3", + "eslint-plugin-unicorn": "^53.0.0", "html-webpack-plugin": "^5.6.0", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "jest-transform-stub": "^2.0.0", - "mini-css-extract-plugin": "^2.7.6", - "nodemon": "^3.0.2", - "postcss": "^8.4.32", - "prettier": "^3.1.1", - "puppeteer": "^21.6.1", + "lighthouse": "^12.0.0", + "mini-css-extract-plugin": "^2.9.0", + "nodemon": "^3.1.0", + "npm-watch": "^0.13.0", + "prettier": "^3.2.5", + "puppeteer": "^22.9.0", "raw-loader": "^4.0.2", - "sass": "^1.69.5", - "sass-loader": "^13.3.2", + "sass": "^1.77.2", + "sass-loader": "^14.2.1", "script-ext-html-webpack-plugin": "^2.1.5", - "style-loader": "^3.3.3", - "stylelint": "^16.0.2", - "stylelint-config-standard": "^35.0.0", - "stylelint-config-standard-scss": "^12.0.0", + "storybook": "^8.1.1", + "style-loader": "^4.0.0", + "stylelint": "^16.5.0", + "stylelint-config-standard": "^36.0.0", + "stylelint-config-standard-scss": "^13.1.0", "stylelint-order": "^6.0.4", - "stylelint-scss": "^6.0.0", - "terser-webpack-plugin": "^5.3.9", - "ts-jest": "^29.1.1", + "stylelint-scss": "^6.3.0", + "terser-webpack-plugin": "^5.3.10", + "ts-jest": "^29.1.2", "ts-loader": "^9.5.1", "ts-node": "^10.9.2", - "typescript": "^5.3.3", - "typescript-coverage-report": "^0.8.0", - "webpack": "^5.89.0", - "webpack-bundle-analyzer": "^4.10.1", + "typescript": "^5.4.5", + "typescript-coverage-report": "^1.0.0", + "typescript-eslint": "^7.9.0", + "webpack": "^5.91.0", + "webpack-bundle-analyzer": "^4.10.2", "webpack-cli": "^5.1.4", - "webpack-dev-server": "^4.15.1", + "webpack-dev-server": "^5.0.4", "webpack-node-externals": "^3.0.0" } } diff --git a/test-unit/config/jest.config.ts b/test-unit/config/jest.config.ts index 42f550b..9b1db56 100644 --- a/test-unit/config/jest.config.ts +++ b/test-unit/config/jest.config.ts @@ -21,5 +21,4 @@ const config: Config = { testTimeout: 10e3, }; -// eslint-disable-next-line import/no-default-export export default config; diff --git a/test-unit/util.ts b/test-unit/util.ts index d634e7f..b17995e 100644 --- a/test-unit/util.ts +++ b/test-unit/util.ts @@ -1,4 +1,4 @@ -/* eslint-disable multiline-comment-style, capitalized-comments, line-comment-position, multiline-comment-style */ +/* eslint-disable capitalized-comments */ /* global setTimeout */ diff --git a/tsconfig.json b/tsconfig.json index 5bf73fa..a1f96b1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,4 @@ { - // https://www.typescriptlang.org/tsconfig - // "files": ["fie.ts"], // Specifies an allowlist of files to include in the program. An error occurs if any of the files can’t be found. // "extends": "./tsconfig.json", // The value of extends is a string which contains a path to another configuration file to inherit from. The path may use Node.js style resolution. // "include": ["src/**/*", "tests/**/*"], // Specifies an array of filenames or patterns to include in the program. These filenames are resolved relative to the directory containing the tsconfig.json file. @@ -14,93 +12,170 @@ "./node_modules/" ], "compilerOptions": { - // -=-=-=- Type Checking -=-=-=- - "allowUnreachableCode": true, - "allowUnusedLabels": false, - "alwaysStrict": true, - "exactOptionalPropertyTypes": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": false, - "noUnusedParameters": false, - "strict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "useUnknownInCatchVariables": true, - "noFallthroughCasesInSwitch": false, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": false, - "noUncheckedIndexedAccess": false, + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2019", + /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + "jsx": "react-jsx", + /* Specify what JSX code is generated. */ + "experimentalDecorators": true, + /* Enable experimental support for legacy experimental decorators. */ + "emitDecoratorMetadata": false, + /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + "noLib": false, + /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": false, + /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ - // -=-=-=- Modules -=-=-=- + /* Modules */ "module": "es2020", + /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ "moduleResolution": "node", + /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ "resolveJsonModule": true, - // no defined my config - // "allowArbitraryExtensions": false, - // "allowImportingTsExtensions": false, - // "allowUmdGlobalAccess": false, - // "baseUrl": false, - // "customConditions": false, - // "moduleSuffixes": false, - // "noResolve": false, - // "paths": false, - // "resolvePackageJsonExports": false, - // "resolvePackageJsonImports": false, - // "rootDir": false, - // "rootDirs": false, - // "typeRoots": false, - // "types": false, + /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + "allowJs": false, + /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + "checkJs": false, + /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ - // -=-=-=- Emit -=-=-=- + /* Emit */ "declaration": false, - "downlevelIteration": false, + /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ "emitDeclarationOnly": false, - "noEmit": false, - "noEmitHelpers": false, + /* Only output d.ts files and not JavaScript files. */ + "sourceMap": true, + /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ "outDir": "./tsc-check/", - "preserveConstEnums": true, + /* Specify an output folder for all emitted files. */ "removeComments": false, - "sourceMap": true, - "newLine": "lf", + /* Disable emitting comments. */ + "noEmit": false, + /* Disable emitting files from a compilation. */ "importHelpers": false, + /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + "downlevelIteration": false, + /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ "emitBOM": false, - // no defined my config - // "declarationDir": false, - // "declarationMap": false, - // "importsNotUsedAsValues": false, - // "inlineSourceMap": false, - // "inlineSources": false, - // "mapRoot": false, - // "noEmitOnError": false, - // "outFile": false, - // "preserveValueImports": false, - // "sourceRoot": false, - // "stripInternal": false, + /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + "newLine": "lf", + /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + "noEmitHelpers": false, + /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + "preserveConstEnums": true, + /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ - // -=-=-=- JavaScript Support -=-=-=- - "allowJs": false, - "checkJs": false, - // no defined my config - // "maxNodeModuleJsDepth": false, + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + "allowSyntheticDefaultImports": true, + /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, + /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, + /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, + /* Enable all strict type-checking options. */ + "noImplicitAny": true, + /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + "strictNullChecks": true, + /* When type checking, take into account 'null' and 'undefined'. */ + "strictFunctionTypes": true, + /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + "strictBindCallApply": true, + /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + "strictPropertyInitialization": true, + /* Check for class properties that are declared but not set in the constructor. */ + "noImplicitThis": true, + /* Enable error reporting when 'this' is given the type 'any'. */ + "useUnknownInCatchVariables": true, + /* Default catch clause variables as 'unknown' instead of 'any'. */ + "alwaysStrict": true, + /* Ensure 'use strict' is always emitted. */ + "noUnusedLocals": false, + /* Enable error reporting when local variables aren't read. */ + "noUnusedParameters": false, + /* Raise an error when a function parameter isn't read. */ + "exactOptionalPropertyTypes": true, + /* Interpret optional property types as written, rather than adding 'undefined'. */ + "noImplicitReturns": true, + /* Enable error reporting for codepaths that do not explicitly return in a function. */ + "noFallthroughCasesInSwitch": true, + /* Enable error reporting for fallthrough cases in switch statements. */ + "noUncheckedIndexedAccess": false, + /* Add 'undefined' to a type when accessed using an index. */ + "noImplicitOverride": true, + /* Ensure overriding members in derived classes are marked with an override modifier. */ + "noPropertyAccessFromIndexSignature": false, + /* Enforces using indexed accessors for keys declared using an indexed type. */ + "allowUnusedLabels": false, + /* Disable error reporting for unused labels. */ + "allowUnreachableCode": true, + /* Disable error reporting for unreachable code. */ + + /* Completeness */ + "skipDefaultLibCheck": true, + /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true, + /* Skip type checking all .d.ts files. */ + + ////////////// + // Appendix // + ////////////// + + // https://www.typescriptlang.org/tsconfig // -=-=-=- Editor Support -=-=-=- "disableSizeLimit": true, // no defined my config // "plugins": false, - // -=-=-=- Interop Constraints -=-=-=- - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - // no defined my config - // "forceConsistentCasingInFileNames": false, - // "isolatedModules": false, - // "preserveSymlinks": false, - // "verbatimModuleSyntax": false, - // -=-=-=- Backwards Compatibility -=-=-=- "noStrictGenericChecks": false, // no defined my config @@ -111,21 +186,6 @@ // "suppressExcessPropertyErrors": false, // "suppressImplicitAnyIndexErrors": false, - // -=-=-=- Language and Environment -=-=-=- - "emitDecoratorMetadata": false, - "experimentalDecorators": true, - "jsx": "react-jsx", - "noLib": false, - "target": "es2019", - "useDefineForClassFields": false, - // no defined my config - // "jsxFactory": false, - // "jsxFragmentFactory": false, - // "jsxImportSource": false, - // "lib": false, - // "moduleDetection": false, - // "reactNamespace": false, - // -=-=-=- Compiler Diagnostics -=-=-=- // no defined my config // "diagnostics": false, @@ -136,27 +196,13 @@ // "listFiles": false, // "traceResolution": false, - // -=-=-=- Projects -=-=-=- - // no defined my config - // "composite": false, - // "disableReferencedProjectLoad": false, - // "disableSolutionSearching": false, - // "disableSourceOfProjectReferenceRedirect": false, - // "incremental": false, - // "tsBuildInfoFile": false, - // -=-=-=- Output Formatting -=-=-=- "pretty": true, "noErrorTruncation": true, "preserveWatchOutput": false, - // -=-=-=- Command Line -=-=-=- // no properties yet - // -=-=-=- Completeness -=-=-=- - "skipLibCheck": true, - "skipDefaultLibCheck": true, - // -=-=-=- Watch Options -=-=-=- "assumeChangesOnlyAffectDirectDependencies": false }, diff --git a/tsconfig.lighthouse.json b/tsconfig.lighthouse.json new file mode 100644 index 0000000..6b73b5e --- /dev/null +++ b/tsconfig.lighthouse.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "ts-node": { + "compilerOptions": { + "target": "ES2020", + "moduleResolution": "NodeNext", + "module": "CommonJS", + "exactOptionalPropertyTypes": false, + } + } +} diff --git a/webpack.config.ts b/webpack.config.ts index a99e465..b12b7f8 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -1,2 +1 @@ -// eslint-disable-next-line import/no-default-export export {webpackRunningConfig as default} from "./webpack/running-config"; diff --git a/webpack/config.ts b/webpack/config.ts index c26d73d..dfef228 100644 --- a/webpack/config.ts +++ b/webpack/config.ts @@ -1,11 +1,11 @@ -/* eslint id-match: 0, optimize-regex/optimize-regex: 0, multiline-comment-style: 0, capitalized-comments: 0 */ +/* eslint id-match: 0, multiline-comment-style: 0, capitalized-comments: 0 */ import {env} from "node:process"; export const pathToStaticFileFolder = "/static/"; -const modeDevelopmentName = "development" as const; -const modeProductionName = "production" as const; +const modeDevelopmentName = "development"; +const modeProductionName = "production"; export const isDevelopment: boolean = env.NODE_ENV === modeDevelopmentName; export const isProduction: boolean = env.NODE_ENV === modeProductionName; diff --git a/webpack/running-config.ts b/webpack/running-config.ts index b4cc35e..4ca6603 100644 --- a/webpack/running-config.ts +++ b/webpack/running-config.ts @@ -1,11 +1,11 @@ -/* eslint-disable multiline-comment-style, capitalized-comments, line-comment-position */ +/* eslint-disable capitalized-comments */ import {cwd} from "node:process"; import path from "node:path"; import type {Configuration} from "webpack"; import nodeExternals from "webpack-node-externals"; -// import {BundleAnalyzerPlugin} from 'webpack-bundle-analyzer'; +// import {BundleAnalyzerPlugin} from "webpack-bundle-analyzer"; import {optimization} from "./setting/optimization"; import {rules} from "./setting/module/rules"; @@ -14,6 +14,7 @@ import {extensions} from "./setting/resolve/extensions"; import {plugins} from "./setting/plugins"; import {devServer} from "./setting/dev-server"; import {watchOptions} from "./setting/watch-options"; +import {experiments} from "./setting/experiments"; const externals = [nodeExternals()]; // in order to ignore all modules in node_modules folder const externalsPresets = {node: true}; // in order to ignore built-in modules like path, fs, etc. @@ -33,9 +34,10 @@ import { const configFront: Configuration = { devtool: "source-map", // isDevelopment ? 'source-map' : false, entry: ["./www/css/root.scss", "./www/root.tsx"], + experiments: {...experiments}, mode: nodeEnvironment, module: {rules}, - // optimization, + optimization: {...optimization}, output: { assetModuleFilename: isDevelopment ? "build-asset/[name]----[hash:6][ext][query]" @@ -48,8 +50,7 @@ const configFront: Configuration = { }, plugins, resolve: {alias, extensions}, - // devServer, - // watchOptions: watchOptions, + watchOptions: {...watchOptions}, }; const configBack: Configuration = { @@ -68,8 +69,10 @@ const configLibraryFront: Configuration = { externals, externalsPresets, mode: nodeEnvironment, - module: {rules}, // optimization, + module: {rules}, + // devServer, + optimization: {...optimization}, output: { filename: "index.js", libraryTarget: "commonjs2", @@ -77,10 +80,9 @@ const configLibraryFront: Configuration = { pathinfo: false, publicPath: "", }, - // devServer, plugins, resolve: {alias, extensions}, - // watchOptions: watchOptions, + watchOptions: {...watchOptions}, /* externals: { @@ -109,7 +111,6 @@ const configLibraryFront: Configuration = { const configLibraryBack: Configuration = {...configLibraryFront}; -// eslint-disable-next-line complexity const webpackConfig: Configuration = ((): Configuration => { if (isBuildLibrary && isFront) { return configLibraryFront; @@ -130,6 +131,6 @@ const webpackConfig: Configuration = ((): Configuration => { throw new Error("Can not detect config"); })(); -// webpackConfig?.plugins?.push(new BundleAnalyzerPlugin()); +// webpackConfig.plugins?.push(new BundleAnalyzerPlugin()); -export const webpackRunningConfig = {...webpackConfig, devServer, optimization, watchOptions}; +export const webpackRunningConfig = {...webpackConfig, devServer}; diff --git a/webpack/setting/dev-server.ts b/webpack/setting/dev-server.ts index 6b544e6..71350ca 100644 --- a/webpack/setting/dev-server.ts +++ b/webpack/setting/dev-server.ts @@ -1,4 +1,4 @@ -/* eslint-disable multiline-comment-style, capitalized-comments */ +/* eslint-disable capitalized-comments */ import type {WebpackOptionsNormalized} from "webpack"; import {webpackDevServerPort} from "../config"; @@ -26,19 +26,22 @@ export const devServer: WebpackOptionsNormalized["devServer"] = { // writeToDisk: isBack, // inline: false, port: webpackDevServerPort, - proxy: { - // TODO: need watch nginx - "/api-image/": { + proxy: [ + { + // TODO: need watch nginx + context: ["/api-image/"], target: `http://127.0.0.1:${serverPort}/`, }, - "/api/": { + { + context: ["/api/"], target: `http://127.0.0.1:${serverPort}/`, }, - // TODO: need watch nginx - "/static-file/": { + { + // TODO: need watch nginx + context: ["/static-file/"], target: `http://127.0.0.1:${serverPort}/`, }, - }, + ], // hotOnly: false, // disableHostCheck: true, // proxy: { diff --git a/webpack/setting/experiments.ts b/webpack/setting/experiments.ts new file mode 100644 index 0000000..42acbaa --- /dev/null +++ b/webpack/setting/experiments.ts @@ -0,0 +1,6 @@ +import type {Configuration} from "webpack"; + +export const experiments: Configuration["experiments"] = { + asyncWebAssembly: true, + syncWebAssembly: true, +}; diff --git a/webpack/setting/module/rules.ts b/webpack/setting/module/rules.ts index 900383b..0d71edf 100644 --- a/webpack/setting/module/rules.ts +++ b/webpack/setting/module/rules.ts @@ -14,6 +14,10 @@ const styleLoader = { const cssLoader = isProduction ? MiniCssExtractPlugin.loader : styleLoader; export const rules: Array = [ + { + test: /\.wasm$/u, + type: "asset/inline", + }, { exclude: /node_modules/u, test: /\.tsx?$/u, @@ -47,7 +51,7 @@ export const rules: Array = [ test: /\.scss$/u, use: [ cssLoader, - "css-modules-typescript-loader", + "css-module-typescript-loader", { loader: "css-loader", options: { @@ -68,7 +72,7 @@ export const rules: Array = [ test: /\.css$/u, use: [ cssLoader, - "css-modules-typescript-loader", + "css-module-typescript-loader", { loader: "css-loader", options: { diff --git a/webpack/setting/optimization.ts b/webpack/setting/optimization.ts index 1ea4050..cb11b23 100644 --- a/webpack/setting/optimization.ts +++ b/webpack/setting/optimization.ts @@ -1,3 +1,5 @@ +/* eslint-disable capitalized-comments */ + import type {Configuration} from "webpack"; import CssMinimizerPlugin from "css-minimizer-webpack-plugin"; @@ -12,7 +14,6 @@ const optimizationDevelopment: Configuration["optimization"] = { runtimeChunk: true, splitChunks: { cacheGroups: { - // eslint-disable-next-line sort-keys main: { chunks: "all", name: "main", @@ -27,7 +28,7 @@ const optimizationDevelopment: Configuration["optimization"] = { reuseExistingChunk: true, test: /www\/assets/u, }, - // eslint-disable-next-line sort-keys + util: { chunks: "all", name: "util", @@ -51,7 +52,7 @@ const optimizationDevelopment: Configuration["optimization"] = { reuseExistingChunk: true, test: /www\/layout/u, }, - // eslint-disable-next-line sort-keys + provider: { chunks: "all", name: "provider", @@ -59,7 +60,7 @@ const optimizationDevelopment: Configuration["optimization"] = { reuseExistingChunk: true, test: /www\/provider/u, }, - // eslint-disable-next-line sort-keys + service: { chunks: "all", name: "service", @@ -68,7 +69,6 @@ const optimizationDevelopment: Configuration["optimization"] = { test: /www\/service/u, }, - // eslint-disable-next-line sort-keys style: { chunks: "all", name: "style", @@ -76,7 +76,14 @@ const optimizationDevelopment: Configuration["optimization"] = { reuseExistingChunk: true, test: /\.s?css$/u, }, - // eslint-disable-next-line sort-keys + // files: { + // chunks: 'all', + // name: 'files', + // priority: -15, + // test: fileRegExp, + // reuseExistingChunk: true, + // }, + vendor: { chunks: "all", name: "vendor", @@ -95,7 +102,7 @@ const optimizationProduction: Configuration["optimization"] = { terserOptions: { compress: { passes: 3, - // eslint-disable-next-line camelcase, id-match, babel/camelcase + // eslint-disable-next-line camelcase pure_funcs: ["console.log"], }, output: { diff --git a/webpack/setting/plugins.ts b/webpack/setting/plugins.ts index 3c39f0b..03b3de8 100644 --- a/webpack/setting/plugins.ts +++ b/webpack/setting/plugins.ts @@ -20,9 +20,8 @@ const filePathPrefix = isProduction ? "./../" : "./"; const date = new Date(); const definePluginParameters: Record = { - // eslint-disable-next-line id-match // BUILD_DATE: JSON.stringify(date.getTime()), - // eslint-disable-next-line id-match + BUILD_DATE_H: JSON.stringify(date.toISOString()), // NODE_ENV: JSON.stringify(NODE_ENV), IS_PRODUCTION: JSON.stringify(isProduction), @@ -34,17 +33,22 @@ const definePluginParameters: Record = { type StaticFilesDataType = Record<"from" | "to", string>; -const staticFilesSiteList: Array = ["favicon.ico"].map( - (fileName: string): StaticFilesDataType => { - return { - from: `./www/${fileName}`, - to: `${filePathPrefix}${fileName}`, - }; - } -); +const staticFilesSiteList: Array = [ + "favicon.ico", + "robots.txt", + "ads.txt", + "gss-0.9.xsl", + "manifest.json", + // 'index-500.html', +].map((fileName: string): StaticFilesDataType => { + return { + from: `./www/${fileName}`, + to: `${filePathPrefix}${fileName}`, + }; +}); const duplicateCheckerPluginInstance: WebpackPluginInstance = { - // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars + // eslint-disable-next-line @typescript-eslint/no-unused-vars apply: (compiler: Compiler): void => { // eslint-disable-next-line no-undefined return undefined; diff --git a/webpack/setting/resolve/alias.ts b/webpack/setting/resolve/alias.ts index 64ce55b..d2be80e 100644 --- a/webpack/setting/resolve/alias.ts +++ b/webpack/setting/resolve/alias.ts @@ -6,7 +6,7 @@ import {isProduction, isFront} from "../../config"; const duplicateList = ["rc-resize-observer", "isarray", "@segment/isodate", "component-type", "uuid", "ms", "debug"]; export const alias: Record = duplicateList.reduce( - (accumulator: Readonly>, packageName: string) => { + (accumulator: Record, packageName: string) => { return {...accumulator, [packageName]: path.resolve(cwd(), `node_modules/${packageName}`)}; }, {} diff --git a/webpack/util/library/css.ts b/webpack/util/library/css.ts index 811390f..959768e 100644 --- a/webpack/util/library/css.ts +++ b/webpack/util/library/css.ts @@ -24,7 +24,7 @@ declare module '${packageName}/dist/style.css' { } `; -async function innerInitialization(): Promise { +async function innerInitialization(): Promise { const isStyleFileExists: boolean = await fileSystem .access(pathToStyle) .then((): true => { @@ -47,5 +47,5 @@ async function innerInitialization(): Promise { console.log("[css util] declaration for css has been added."); } -// eslint-disable-next-line unicorn/prefer-top-level-await, @typescript-eslint/no-floating-promises +// eslint-disable-next-line @typescript-eslint/no-floating-promises innerInitialization(); diff --git a/www/component/app/example-app.tsx b/www/component/app/example-app.tsx index b9c368f..613a04a 100644 --- a/www/component/app/example-app.tsx +++ b/www/component/app/example-app.tsx @@ -1,5 +1,5 @@ -/* eslint-disable multiline-comment-style, capitalized-comments, line-comment-position, multiline-comment-style */ -/* eslint-disable no-unused-vars, @typescript-eslint/no-unused-vars */ +/* eslint-disable capitalized-comments */ +/* eslint-disable @typescript-eslint/no-unused-vars */ import { useSystem, diff --git a/www/const.ts b/www/const.ts index 4568201..f84c6de 100644 --- a/www/const.ts +++ b/www/const.ts @@ -1,5 +1,4 @@ /* global BUILD_DATE_H, IS_PRODUCTION */ -/* eslint-disable id-match */ export const selector = { appWrapper: ".js-app-wrapper", @@ -10,16 +9,26 @@ function sayHi(): void { // http://patorjk.com/software/taag/#p=display&f=ANSI%20Shadow&t=Empty, font: ANSI Shadow const hiString = ` - - - ███████╗███╗ ███╗██████╗ ████████╗██╗ ██╗ - ██╔════╝████╗ ████║██╔══██╗╚══██╔══╝╚██╗ ██╔╝ - █████╗ ██╔████╔██║██████╔╝ ██║ ╚████╔╝ - ██╔══╝ ██║╚██╔╝██║██╔═══╝ ██║ ╚██╔╝ - ███████╗██║ ╚═╝ ██║██║ ██║ ██║ - ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ - - +██████╗ ███████╗ █████╗ ██████╗████████╗ +██╔══██╗██╔════╝██╔══██╗██╔════╝╚══██╔══╝ +██████╔╝█████╗ ███████║██║ ██║ +██╔══██╗██╔══╝ ██╔══██║██║ ██║ +██║ ██║███████╗██║ ██║╚██████╗ ██║ +╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ + +███████╗██╗ ██╗███████╗████████╗███████╗███╗ ███╗ +██╔════╝╚██╗ ██╔╝██╔════╝╚══██╔══╝██╔════╝████╗ ████║ +███████╗ ╚████╔╝ ███████╗ ██║ █████╗ ██╔████╔██║ +╚════██║ ╚██╔╝ ╚════██║ ██║ ██╔══╝ ██║╚██╔╝██║ +███████║ ██║ ███████║ ██║ ███████╗██║ ╚═╝ ██║ +╚══════╝ ╚═╝ ╚══════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ + +██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗ +██║ ██║██╔═══██╗██╔═══██╗██║ ██╔╝ +███████║██║ ██║██║ ██║█████╔╝ +██╔══██║██║ ██║██║ ██║██╔═██╗ +██║ ██║╚██████╔╝╚██████╔╝██║ ██╗ +╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ `; log(hiString); diff --git a/www/library/src/document-visibility-hook.ts b/www/library/src/document-visibility-hook.ts index 1a72530..9734d38 100644 --- a/www/library/src/document-visibility-hook.ts +++ b/www/library/src/document-visibility-hook.ts @@ -17,7 +17,7 @@ export function useDocumentVisibility(): boolean { document.addEventListener("visibilitychange", handleVisibilityChangeDebounced, {capture: false, passive: true}); - return () => { + return (): undefined => { document.removeEventListener("visibilitychange", handleVisibilityChangeDebounced, {capture: false}); }; }, [handleVisibilityChange]); diff --git a/www/library/src/screen-height-hook.ts b/www/library/src/screen-height-hook.ts index f05f2df..aa635fa 100644 --- a/www/library/src/screen-height-hook.ts +++ b/www/library/src/screen-height-hook.ts @@ -21,7 +21,7 @@ export function useScreenHeight(): number { window.addEventListener("resize", handleResizeDebounced, {capture: false, passive: true}); - return () => { + return (): undefined => { window.removeEventListener("resize", handleResizeDebounced, {capture: false}); }; }, [handleResize]); diff --git a/www/library/src/screen-size-hook.ts b/www/library/src/screen-size-hook.ts index 0f170f1..c0507cf 100644 --- a/www/library/src/screen-size-hook.ts +++ b/www/library/src/screen-size-hook.ts @@ -24,7 +24,7 @@ export function useScreenSize(): RectangleSizeType { window.addEventListener("resize", handleResizeDebounced, {capture: false, passive: true}); - return () => { + return (): undefined => { window.removeEventListener("resize", handleResizeDebounced, {capture: false}); }; }, [handleResize]); diff --git a/www/library/src/screen-width-hook.ts b/www/library/src/screen-width-hook.ts index 331b24c..433efd3 100644 --- a/www/library/src/screen-width-hook.ts +++ b/www/library/src/screen-width-hook.ts @@ -21,7 +21,7 @@ export function useScreenWidth(): number { window.addEventListener("resize", handleResizeDebounced, {capture: false, passive: true}); - return () => { + return (): undefined => { window.removeEventListener("resize", handleResizeDebounced, {capture: false}); }; }, [handleResize]); diff --git a/www/library/src/system-hook-helper.ts b/www/library/src/system-hook-helper.ts index b35f1ff..cb3c376 100644 --- a/www/library/src/system-hook-helper.ts +++ b/www/library/src/system-hook-helper.ts @@ -1,4 +1,4 @@ -/* eslint-disable multiline-comment-style, capitalized-comments, line-comment-position, multiline-comment-style */ +/* eslint-disable capitalized-comments */ /* global window, document */ diff --git a/www/library/src/system-hook.ts b/www/library/src/system-hook.ts index 74132fc..26814ef 100644 --- a/www/library/src/system-hook.ts +++ b/www/library/src/system-hook.ts @@ -57,7 +57,7 @@ export function useSystem(): SystemHookType { window.addEventListener("resize", handleResizeDebounced, {capture: false, passive: true}); - return () => { + return (): undefined => { window.removeEventListener("resize", handleResizeDebounced, {capture: false}); }; }, [handleResize]); diff --git a/www/library/src/test/main.test.tsx b/www/library/src/test/main.test.tsx index 631f9b1..1064edc 100644 --- a/www/library/src/test/main.test.tsx +++ b/www/library/src/test/main.test.tsx @@ -1,5 +1,4 @@ /* global window, Event */ -/* eslint-disable sonarjs/no-duplicate-string */ import {describe, it, expect} from "@jest/globals";