From f69d185000fccab2c59351409159d902a6c85991 Mon Sep 17 00:00:00 2001 From: dilane3 Date: Wed, 15 Feb 2023 21:23:45 +0100 Subject: [PATCH 1/5] UPDATE: Update the Package.json by adding author information and repository info --- package.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/package.json b/package.json index 3c2d903..048fd65 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,18 @@ "private": false, "license": "MIT", "main": "dist/index.js", + "author": { + "name": "dilane3", + "email": "komboudilane125@gmail.com", + "url": "https://dilane3.com", + "twitter": "https://twitter.com/dilanekombou", + "github": "https://github.com/dilane3" + }, + "repository": { + "type": "git", + "url": "https://github.com/react-gx/gx", + "issues": "https://github.com/react-gx/gx/issues" + }, "devDependencies": { "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^13.0.0", From 21ed03d0ba6664aef1797ba62e9eec10b32cd04d Mon Sep 17 00:00:00 2001 From: dilane3 Date: Fri, 17 Feb 2023 13:31:32 +0100 Subject: [PATCH 2/5] Rebuild the yarn.lock file --- README.md | 21 +- dist/providers/reducer.js | 6 - dist/providers/reducer.js.map | 2 +- package.json | 6 +- src/providers/reducer.ts | 9 - yarn.lock | 356 +++++++++++++++++----------------- 6 files changed, 196 insertions(+), 204 deletions(-) diff --git a/README.md b/README.md index 74a087f..22ac632 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ # GX - Global State Management for React Applications +`React` and `React Native` Library for managing global state. + +[![npm version](https://badge.fury.io/js/%40dilane3%2Fgx.svg)](https://badge.fury.io/js/%40dilane3%2Fgx) +[![npm downloads](https://img.shields.io/npm/dm/%40dilane3%2Fgx)](https://www.npmjs.com/package/@dilane3/gx) +[![GitHub license](https://img.shields.io/github/license/react-gx/gx)](https://github.com/react-gx/gx/blob/main/LICENCE) + + ![logo](./assets/logo.png) This library aims to provide you an `easy` and `fast` way to set up and manage the global state of your **`react`** application. @@ -11,13 +18,13 @@ You can use `npm` or `yarn` to install this library into your react application. ### Using npm ```bash -npm install gx +npm install @dilane3/gx ``` ### Using yarn ```bash -yarn add gx +yarn add @dilane3/gx ``` ## Prerequisites @@ -113,7 +120,7 @@ Here is the result. Inside the `signals` directory, create a file called `counter.js` for example. ```js -import { createSignal } from 'gx'; +import { createSignal } from '@dilane3/gx'; const counterSignal = createSignal({ name: 'counter', @@ -137,7 +144,7 @@ export default counterSignal; Inside the `store` directory, create an `index.js` file. ```js -import { createStore } from "gx"; +import { createStore } from "@dilane3/gx"; import counterSignal from "../signals/counter"; export default createStore([counterSignal]); @@ -150,7 +157,7 @@ Inside your `App.js` file, import your store and wrap your application with the ```js import React from "react"; import store from "./gx/store"; -import GXProvider from "gx"; +import GXProvider from "@dilane3/gx"; function App() { return ( @@ -172,7 +179,7 @@ Create a component called `Counter` inside the Counter.js file. Then import two ```js import React from "react"; -import { useSignal, useAction } from "gx"; +import { useSignal, useAction } from "@dilane3/gx"; function Counter() { // State @@ -285,4 +292,4 @@ See the [Contributing Guide](./CONTRIBUTING.md). ## Keywords -react, state, management, hooks, gx \ No newline at end of file +react, state, management, hooks, gx, dilane3 \ No newline at end of file diff --git a/dist/providers/reducer.js b/dist/providers/reducer.js index 988940b..49581eb 100644 --- a/dist/providers/reducer.js +++ b/dist/providers/reducer.js @@ -18,14 +18,8 @@ const gxReducer = (signals, action) => { } } if (actionToDispatch) { - // Display prev state - console.log(`Prev state of "${signal.name}" signal:`, signal.state); - // Display action payload - console.log(`Action payload: `, action.payload); // Dispatch the action signal.state = actionToDispatch.handler(signal.state, action.payload); - // Display new state - console.log(`New state of "${signal.name}" signal:`, signal.state); } else { console.warn(`Action "${action.type}" not found`); diff --git a/dist/providers/reducer.js.map b/dist/providers/reducer.js.map index 4c3daf1..84174f7 100644 --- a/dist/providers/reducer.js.map +++ b/dist/providers/reducer.js.map @@ -1 +1 @@ -{"version":3,"file":"reducer.js","sourceRoot":"","sources":["../../src/providers/reducer.ts"],"names":[],"mappings":"AAGA,MAAM,SAAS,GAAG,CAAC,OAAuB,EAAE,M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nD;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"} \ No newline at end of file +{"version":3,"file":"reducer.js","sourceRoot":"","sources":["../../src/providers/reducer.ts"],"names":[],"mappings":"AAGA,MAAM,SAAS,GAAG,CAAC,OAAuB,EAAE,MAAgB,EAAE,EAAE;IAC9D,eAAe;IACf,MAAM,WAAW,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;IAEjC,sBAAsB;IACtB,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAE7C,iBAAiB;IACjB,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;IAExE,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,CAAC,IAAI,CAAC,WAAW,UAAU,aAAa,CAAC,CAAC;QAEjD,OAAO,WAAW,CAAC;KACpB;IAED,IAAI,gBAAgB,GAAG,IAAI,CAAC;IAE5B,iBAAiB;IACjB,KAAK,IAAI,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE;QAC9B,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,EAAE;YAC5B,gBAAgB,GAAG,GAAG,CAAC;YAEvB,MAAM;SACP;KACF;IAED,IAAI,gBAAgB,EAAE;QACpB,sBAAsB;QACtB,MAAM,CAAC,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;KACvE;SAAM;QACL,OAAO,CAAC,IAAI,CAAC,WAAW,MAAM,CAAC,IAAI,aAAa,CAAC,CAAC;KACnD;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/package.json b/package.json index 048fd65..cd37b1e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "gx", - "version": "1.0.0", + "name": "@dilane3/gx", + "version": "1.0.1", "private": false, "license": "MIT", "main": "dist/index.js", @@ -27,7 +27,7 @@ "typescript": "^4.4.2" }, "peerDependencies": { - "react": "^18.2.0" + "react": "^18.0.0" }, "scripts": { "build": "tsc", diff --git a/src/providers/reducer.ts b/src/providers/reducer.ts index 8dd02d8..699ea5c 100644 --- a/src/providers/reducer.ts +++ b/src/providers/reducer.ts @@ -29,17 +29,8 @@ const gxReducer = (signals: GXSignalType[], action: GXAction) => { } if (actionToDispatch) { - // Display prev state - console.log(`Prev state of "${signal.name}" signal:`, signal.state); - - // Display action payload - console.log(`Action payload: `, action.payload); - // Dispatch the action signal.state = actionToDispatch.handler(signal.state, action.payload); - - // Display new state - console.log(`New state of "${signal.name}" signal:`, signal.state); } else { console.warn(`Action "${action.type}" not found`); } diff --git a/yarn.lock b/yarn.lock index db560bd..7447330 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1309,12 +1309,12 @@ "@types/node" "*" jest-mock "^27.5.1" -"@jest/expect-utils@^29.4.2": - version "29.4.2" - resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.4.2.tgz#cd0065dfdd8e8a182aa350cc121db97b5eed7b3f" - integrity sha512-Dd3ilDJpBnqa0GiPN7QrudVs0cczMMHtehSo2CSTjm3zdHx0RcpmhFNVEltuEFeqfLIyWKFI224FsMSQ/nsJQA== +"@jest/expect-utils@^29.4.3": + version "29.4.3" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.4.3.tgz#95ce4df62952f071bcd618225ac7c47eaa81431e" + integrity sha512-/6JWbkxHOP8EoS8jeeTd9dTfc9Uawi+43oLKHfp6zzux3U2hqOOVnV3ai4RpDYHOccL6g+5nrxpoc8DmJxtXVQ== dependencies: - jest-get-type "^29.4.2" + jest-get-type "^29.4.3" "@jest/fake-timers@^27.5.1": version "27.5.1" @@ -1375,10 +1375,10 @@ dependencies: "@sinclair/typebox" "^0.24.1" -"@jest/schemas@^29.4.2": - version "29.4.2" - resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.4.2.tgz#cf7cfe97c5649f518452b176c47ed07486270fc1" - integrity sha512-ZrGzGfh31NtdVH8tn0mgJw4khQuNHiKqdzJAFbCaERbyCP9tHlxWuL/mnMu8P7e/+k4puWjI1NOzi/sFsjce/g== +"@jest/schemas@^29.4.3": + version "29.4.3" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.4.3.tgz#39cf1b8469afc40b6f5a2baaa146e332c4151788" + integrity sha512-VLYKXQmtmuEz6IxJsrZwzG9NvtkQsWNnWMsKxqWNu3+CnfzJQhp0WDDKWLVV9hLKr0l3SLLFRqcYHjhtyuDVxg== dependencies: "@sinclair/typebox" "^0.25.16" @@ -1465,12 +1465,12 @@ "@types/yargs" "^17.0.8" chalk "^4.0.0" -"@jest/types@^29.4.2": - version "29.4.2" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.4.2.tgz#8f724a414b1246b2bfd56ca5225d9e1f39540d82" - integrity sha512-CKlngyGP0fwlgC1BRUtPZSiWLBhyS9dKwKmyGxk8Z6M82LBEGB2aLQSg+U1MyLsU+M7UjnlLllBM2BLWKVm/Uw== +"@jest/types@^29.4.3": + version "29.4.3" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.4.3.tgz#9069145f4ef09adf10cec1b2901b2d390031431f" + integrity sha512-bPYfw8V65v17m2Od1cv44FH+SiKW7w2Xu7trhcdTLUmSv85rfKsP+qXSjO4KGJr4dtPSzl/gvslZBXctf1qGEA== dependencies: - "@jest/schemas" "^29.4.2" + "@jest/schemas" "^29.4.3" "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^3.0.0" "@types/node" "*" @@ -1621,9 +1621,9 @@ integrity sha512-1P1OROm/rdubP5aFDSZQILU0vrLCJ4fvHt6EoqHEM+2D/G5MK3bIaymUKLit8Js9gbns5UyJnkP/TZROLw4tUA== "@sinclair/typebox@^0.25.16": - version "0.25.21" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.25.21.tgz#763b05a4b472c93a8db29b2c3e359d55b29ce272" - integrity sha512-gFukHN4t8K4+wVC+ECqeqwzBDeFeTzBXroBTqE6vcWrQGbEUpHO7LYdG0f4xnvYq4VOEwITSlHlp0JBAIFMS/g== + version "0.25.23" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.25.23.tgz#1c15b0d2b872d89cc0f47c7243eacb447df8b8bd" + integrity sha512-VEB8ygeP42CFLWyAJhN5OklpxUliqdNEUcXb4xZ/CINqtYGTjL5ukluKdKzQ0iWdUxyQ7B0539PAUhHKrCNWSQ== "@sinonjs/commons@^1.7.0": version "1.8.6" @@ -1884,9 +1884,9 @@ "@types/estree" "*" "@types/eslint@*", "@types/eslint@^7.29.0 || ^8.4.1": - version "8.21.0" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.21.0.tgz#21724cfe12b96696feafab05829695d4d7bd7c48" - integrity sha512-35EhHNOXgxnUgh4XCJsGhE7zdlDhYDN/aMG6UbkByCFFNgQ7b3U+uVoqBpicFydR8JEfgdjCF7SJ7MiJfzuiTA== + version "8.21.1" + resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.21.1.tgz#110b441a210d53ab47795124dbc3e9bb993d1e7c" + integrity sha512-rc9K8ZpVjNcLs8Fp0dkozd5Pt2Apk1glO4Vgz8ix1u6yFByxfqo5Yavpy65o+93TAe24jr7v+eSBtFLvOQtCRQ== dependencies: "@types/estree" "*" "@types/json-schema" "*" @@ -2035,9 +2035,9 @@ integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw== "@types/react-dom@^18.0.0": - version "18.0.10" - resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.10.tgz#3b66dec56aa0f16a6cc26da9e9ca96c35c0b4352" - integrity sha512-E42GW/JA4Qv15wQdqJq8DL4JhNpB3prJgjgapN3qJT9K2zO5IIAQh4VXvCEDupoqAwnz0cY4RlXeC/ajX5SFHg== + version "18.0.11" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.11.tgz#321351c1459bc9ca3d216aefc8a167beec334e33" + integrity sha512-O38bPbI2CWtgw/OoQoY+BRelw7uysmXbWvw3nLWO21H1HSh+GOlqPuXshJfjmpNlKiiSDG9cc1JZAaMmVdcTlw== dependencies: "@types/react" "*" @@ -2107,9 +2107,9 @@ "@types/jest" "*" "@types/trusted-types@^2.0.2": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.2.tgz#fc25ad9943bcac11cceb8168db4f275e0e72e756" - integrity sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg== + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.3.tgz#a136f83b0758698df454e328759dbd3d44555311" + integrity sha512-NfQ4gyz38SL8sDNrSixxU2Os1a5xcdFxipAFxYEuLUlvU2uDwS4NUpsImcf1//SlWItCVMMLiylsxbmNMToV/g== "@types/ws@^8.5.1": version "8.5.4" @@ -2138,13 +2138,13 @@ "@types/yargs-parser" "*" "@typescript-eslint/eslint-plugin@^5.5.0": - version "5.51.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.51.0.tgz#da3f2819633061ced84bb82c53bba45a6fe9963a" - integrity sha512-wcAwhEWm1RgNd7dxD/o+nnLW8oH+6RK1OGnmbmkj/GGoDPV1WWMVP0FXYQBivKHdwM1pwii3bt//RC62EriIUQ== + version "5.52.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.52.0.tgz#5fb0d43574c2411f16ea80f5fc335b8eaa7b28a8" + integrity sha512-lHazYdvYVsBokwCdKOppvYJKaJ4S41CgKBcPvyd0xjZNbvQdhn/pnJlGtQksQ/NhInzdaeaSarlBjDXHuclEbg== dependencies: - "@typescript-eslint/scope-manager" "5.51.0" - "@typescript-eslint/type-utils" "5.51.0" - "@typescript-eslint/utils" "5.51.0" + "@typescript-eslint/scope-manager" "5.52.0" + "@typescript-eslint/type-utils" "5.52.0" + "@typescript-eslint/utils" "5.52.0" debug "^4.3.4" grapheme-splitter "^1.0.4" ignore "^5.2.0" @@ -2154,78 +2154,78 @@ tsutils "^3.21.0" "@typescript-eslint/experimental-utils@^5.0.0": - version "5.51.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.51.0.tgz#936124843a9221863f027a08063b737578838bea" - integrity sha512-8/3+ZyBENl2aog1/QB3S39ptkZ2oRhDB+sJt15UWXBE3skgwL1C8BN9RjpOyhTejwR2hVrvqEjcYcNY6qtZ7nw== + version "5.52.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.52.0.tgz#cc79b91ea62f43bb5e9bec2d94a7df513220e9df" + integrity sha512-kd8CRr04mNE3hw4et6+0T0NI5vli2H6dJCGzjX1r12s/FXUehLVadmvo2Nl3DN80YqAh1cVC6zYZAkpmGiVJ5g== dependencies: - "@typescript-eslint/utils" "5.51.0" + "@typescript-eslint/utils" "5.52.0" "@typescript-eslint/parser@^5.5.0": - version "5.51.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.51.0.tgz#2d74626652096d966ef107f44b9479f02f51f271" - integrity sha512-fEV0R9gGmfpDeRzJXn+fGQKcl0inIeYobmmUWijZh9zA7bxJ8clPhV9up2ZQzATxAiFAECqPQyMDB4o4B81AaA== + version "5.52.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.52.0.tgz#73c136df6c0133f1d7870de7131ccf356f5be5a4" + integrity sha512-e2KiLQOZRo4Y0D/b+3y08i3jsekoSkOYStROYmPUnGMEoA0h+k2qOH5H6tcjIc68WDvGwH+PaOrP1XRzLJ6QlA== dependencies: - "@typescript-eslint/scope-manager" "5.51.0" - "@typescript-eslint/types" "5.51.0" - "@typescript-eslint/typescript-estree" "5.51.0" + "@typescript-eslint/scope-manager" "5.52.0" + "@typescript-eslint/types" "5.52.0" + "@typescript-eslint/typescript-estree" "5.52.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@5.51.0": - version "5.51.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.51.0.tgz#ad3e3c2ecf762d9a4196c0fbfe19b142ac498990" - integrity sha512-gNpxRdlx5qw3yaHA0SFuTjW4rxeYhpHxt491PEcKF8Z6zpq0kMhe0Tolxt0qjlojS+/wArSDlj/LtE69xUJphQ== +"@typescript-eslint/scope-manager@5.52.0": + version "5.52.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.52.0.tgz#a993d89a0556ea16811db48eabd7c5b72dcb83d1" + integrity sha512-AR7sxxfBKiNV0FWBSARxM8DmNxrwgnYMPwmpkC1Pl1n+eT8/I2NAUPuwDy/FmDcC6F8pBfmOcaxcxRHspgOBMw== dependencies: - "@typescript-eslint/types" "5.51.0" - "@typescript-eslint/visitor-keys" "5.51.0" + "@typescript-eslint/types" "5.52.0" + "@typescript-eslint/visitor-keys" "5.52.0" -"@typescript-eslint/type-utils@5.51.0": - version "5.51.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.51.0.tgz#7af48005531700b62a20963501d47dfb27095988" - integrity sha512-QHC5KKyfV8sNSyHqfNa0UbTbJ6caB8uhcx2hYcWVvJAZYJRBo5HyyZfzMdRx8nvS+GyMg56fugMzzWnojREuQQ== +"@typescript-eslint/type-utils@5.52.0": + version "5.52.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.52.0.tgz#9fd28cd02e6f21f5109e35496df41893f33167aa" + integrity sha512-tEKuUHfDOv852QGlpPtB3lHOoig5pyFQN/cUiZtpw99D93nEBjexRLre5sQZlkMoHry/lZr8qDAt2oAHLKA6Jw== dependencies: - "@typescript-eslint/typescript-estree" "5.51.0" - "@typescript-eslint/utils" "5.51.0" + "@typescript-eslint/typescript-estree" "5.52.0" + "@typescript-eslint/utils" "5.52.0" debug "^4.3.4" tsutils "^3.21.0" -"@typescript-eslint/types@5.51.0": - version "5.51.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.51.0.tgz#e7c1622f46c7eea7e12bbf1edfb496d4dec37c90" - integrity sha512-SqOn0ANn/v6hFn0kjvLwiDi4AzR++CBZz0NV5AnusT2/3y32jdc0G4woXPWHCumWtUXZKPAS27/9vziSsC9jnw== +"@typescript-eslint/types@5.52.0": + version "5.52.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.52.0.tgz#19e9abc6afb5bd37a1a9bea877a1a836c0b3241b" + integrity sha512-oV7XU4CHYfBhk78fS7tkum+/Dpgsfi91IIDy7fjCyq2k6KB63M6gMC0YIvy+iABzmXThCRI6xpCEyVObBdWSDQ== -"@typescript-eslint/typescript-estree@5.51.0": - version "5.51.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.51.0.tgz#0ec8170d7247a892c2b21845b06c11eb0718f8de" - integrity sha512-TSkNupHvNRkoH9FMA3w7TazVFcBPveAAmb7Sz+kArY6sLT86PA5Vx80cKlYmd8m3Ha2SwofM1KwraF24lM9FvA== +"@typescript-eslint/typescript-estree@5.52.0": + version "5.52.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.52.0.tgz#6408cb3c2ccc01c03c278cb201cf07e73347dfca" + integrity sha512-WeWnjanyEwt6+fVrSR0MYgEpUAuROxuAH516WPjUblIrClzYJj0kBbjdnbQXLpgAN8qbEuGywiQsXUVDiAoEuQ== dependencies: - "@typescript-eslint/types" "5.51.0" - "@typescript-eslint/visitor-keys" "5.51.0" + "@typescript-eslint/types" "5.52.0" + "@typescript-eslint/visitor-keys" "5.52.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/utils@5.51.0", "@typescript-eslint/utils@^5.43.0": - version "5.51.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.51.0.tgz#074f4fabd5b12afe9c8aa6fdee881c050f8b4d47" - integrity sha512-76qs+5KWcaatmwtwsDJvBk4H76RJQBFe+Gext0EfJdC3Vd2kpY2Pf//OHHzHp84Ciw0/rYoGTDnIAr3uWhhJYw== +"@typescript-eslint/utils@5.52.0", "@typescript-eslint/utils@^5.43.0": + version "5.52.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.52.0.tgz#b260bb5a8f6b00a0ed51db66bdba4ed5e4845a72" + integrity sha512-As3lChhrbwWQLNk2HC8Ree96hldKIqk98EYvypd3It8Q1f8d5zWyIoaZEp2va5667M4ZyE7X8UUR+azXrFl+NA== dependencies: "@types/json-schema" "^7.0.9" "@types/semver" "^7.3.12" - "@typescript-eslint/scope-manager" "5.51.0" - "@typescript-eslint/types" "5.51.0" - "@typescript-eslint/typescript-estree" "5.51.0" + "@typescript-eslint/scope-manager" "5.52.0" + "@typescript-eslint/types" "5.52.0" + "@typescript-eslint/typescript-estree" "5.52.0" eslint-scope "^5.1.1" eslint-utils "^3.0.0" semver "^7.3.7" -"@typescript-eslint/visitor-keys@5.51.0": - version "5.51.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.51.0.tgz#c0147dd9a36c0de758aaebd5b48cae1ec59eba87" - integrity sha512-Oh2+eTdjHjOFjKA27sxESlA87YPSOJafGCR0md5oeMdh1ZcCfAGCIOL216uTBAkAIptvLIfKQhl7lHxMJet4GQ== +"@typescript-eslint/visitor-keys@5.52.0": + version "5.52.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.52.0.tgz#e38c971259f44f80cfe49d97dbffa38e3e75030f" + integrity sha512-qMwpw6SU5VHCPr99y274xhbm+PRViK/NATY6qzt+Et7+mThGuFSl/ompj2/hrBlRP/kq+BFdgagnOSgw9TB0eA== dependencies: - "@typescript-eslint/types" "5.51.0" + "@typescript-eslint/types" "5.52.0" eslint-visitor-keys "^3.3.0" "@webassemblyjs/ast@1.11.1": @@ -2899,7 +2899,7 @@ browser-process-hrtime@^1.0.0: resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== -browserslist@^4.0.0, browserslist@^4.14.5, browserslist@^4.16.6, browserslist@^4.18.1, browserslist@^4.21.3, browserslist@^4.21.4: +browserslist@^4.0.0, browserslist@^4.14.5, browserslist@^4.18.1, browserslist@^4.21.3, browserslist@^4.21.4, browserslist@^4.21.5: version "4.21.5" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.5.tgz#75c5dae60063ee641f977e00edd3cfb2fb7af6a7" integrity sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w== @@ -2983,9 +2983,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001426, caniuse-lite@^1.0.30001449: - version "1.0.30001451" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001451.tgz#2e197c698fc1373d63e1406d6607ea4617c613f1" - integrity sha512-XY7UbUpGRatZzoRft//5xOa69/1iGJRBlrieH6QYrkKLIFn3m7OVEJ81dSrKoy2BnKsdbX5cLrOispZNYo9v2w== + version "1.0.30001456" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001456.tgz#734ec1dbfa4f3abe6e435b78ecf40d68e8c32ce4" + integrity sha512-XFHJY5dUgmpMV25UqaD4kVq2LsiaU5rS8fb0f17pCoXQiQslzmFgnfOxfvo1bTpTqf7dwG/N/05CnLCnOEKmzA== case-sensitive-paths-webpack-plugin@^2.4.0: version "2.4.0" @@ -3231,21 +3231,21 @@ cookie@0.5.0: integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== core-js-compat@^3.25.1: - version "3.27.2" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.27.2.tgz#607c50ad6db8fd8326af0b2883ebb987be3786da" - integrity sha512-welaYuF7ZtbYKGrIy7y3eb40d37rG1FvzEOfe7hSLd2iD6duMDqUhRfSvCGyC46HhR6Y8JXXdZ2lnRUMkPBpvg== + version "3.28.0" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.28.0.tgz#c08456d854608a7264530a2afa281fadf20ecee6" + integrity sha512-myzPgE7QodMg4nnd3K1TDoES/nADRStM8Gpz0D6nhkwbmwEnE0ZGJgoWsvQ722FR8D7xS0n0LV556RcEicjTyg== dependencies: - browserslist "^4.21.4" + browserslist "^4.21.5" core-js-pure@^3.23.3: - version "3.27.2" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.27.2.tgz#47e9cc96c639eefc910da03c3ece26c5067c7553" - integrity sha512-Cf2jqAbXgWH3VVzjyaaFkY1EBazxugUepGymDoeteyYr9ByX51kD2jdHZlsEF/xnJMyN3Prua7mQuzwMg6Zc9A== + version "3.28.0" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.28.0.tgz#4ef2888475b6c856ef6f5aeef8b4f618b76ad048" + integrity sha512-DSOVleA9/v3LNj/vFxAPfUHttKTzrB2RXhAPvR5TPXn4vrra3Z2ssytvRyt8eruJwAfwAiFADEbrjcRdcvPLQQ== core-js@^3.19.2: - version "3.27.2" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.27.2.tgz#85b35453a424abdcacb97474797815f4d62ebbf7" - integrity sha512-9ashVQskuh5AZEZ1JdQWp1GqSoC1e1G87MzRqg2gIfVAQ7Qn9K+uFj8EcniUFA4P2NLZfV+TOlX1SzoKfo+s7w== + version "3.28.0" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.28.0.tgz#ed8b9e99c273879fdfff0edfc77ee709a5800e4a" + integrity sha512-GiZn9D4Z/rSYvTeg1ljAIsEqFm0LaN9gVtwDCrKL80zHtS31p9BAjmTxVqTQDMpwlMolJZOFntUG2uwyj7DAqw== core-util-is@~1.0.0: version "1.0.3" @@ -3405,22 +3405,22 @@ cssesc@^3.0.0: resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee" integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg== -cssnano-preset-default@^5.2.13: - version "5.2.13" - resolved "https://registry.yarnpkg.com/cssnano-preset-default/-/cssnano-preset-default-5.2.13.tgz#e7353b0c57975d1bdd97ac96e68e5c1b8c68e990" - integrity sha512-PX7sQ4Pb+UtOWuz8A1d+Rbi+WimBIxJTRyBdgGp1J75VU0r/HFQeLnMYgHiCAp6AR4rqrc7Y4R+1Rjk3KJz6DQ== +cssnano-preset-default@^5.2.14: + version "5.2.14" + resolved "https://registry.yarnpkg.com/cssnano-preset-default/-/cssnano-preset-default-5.2.14.tgz#309def4f7b7e16d71ab2438052093330d9ab45d8" + integrity sha512-t0SFesj/ZV2OTylqQVOrFgEh5uanxbO6ZAdeCrNsUQ6fVuXwYTxJPNAGvGTxHbD68ldIJNec7PyYZDBrfDQ+6A== dependencies: css-declaration-sorter "^6.3.1" cssnano-utils "^3.1.0" postcss-calc "^8.2.3" - postcss-colormin "^5.3.0" + postcss-colormin "^5.3.1" postcss-convert-values "^5.1.3" postcss-discard-comments "^5.1.2" postcss-discard-duplicates "^5.1.0" postcss-discard-empty "^5.1.1" postcss-discard-overridden "^5.1.0" postcss-merge-longhand "^5.1.7" - postcss-merge-rules "^5.1.3" + postcss-merge-rules "^5.1.4" postcss-minify-font-values "^5.1.0" postcss-minify-gradients "^5.1.1" postcss-minify-params "^5.1.4" @@ -3435,7 +3435,7 @@ cssnano-preset-default@^5.2.13: postcss-normalize-url "^5.1.0" postcss-normalize-whitespace "^5.1.1" postcss-ordered-values "^5.1.3" - postcss-reduce-initial "^5.1.1" + postcss-reduce-initial "^5.1.2" postcss-reduce-transforms "^5.1.0" postcss-svgo "^5.1.0" postcss-unique-selectors "^5.1.1" @@ -3446,11 +3446,11 @@ cssnano-utils@^3.1.0: integrity sha512-JQNR19/YZhz4psLX/rQ9M83e3z2Wf/HdJbryzte4a3NSuafyp9w/I4U+hx5C2S9g41qlstH7DEWnZaaj83OuEA== cssnano@^5.0.6: - version "5.1.14" - resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-5.1.14.tgz#07b0af6da73641276fe5a6d45757702ebae2eb05" - integrity sha512-Oou7ihiTocbKqi0J1bB+TRJIQX5RMR3JghA8hcWSw9mjBLQ5Y3RWqEDoYG3sRNlAbCIXpqMoZGbq5KDR3vdzgw== + version "5.1.15" + resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-5.1.15.tgz#ded66b5480d5127fcb44dac12ea5a983755136bf" + integrity sha512-j+BKgDcLDQA+eDifLx0EO4XSA56b7uut3BQFH+wbSaSTuGLuiyTa/wbRYthUXX8LC9mLg+WWKe8h+qJuwTAbHw== dependencies: - cssnano-preset-default "^5.2.13" + cssnano-preset-default "^5.2.14" lilconfig "^2.0.3" yaml "^1.10.2" @@ -3643,10 +3643,10 @@ diff-sequences@^27.5.1: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-27.5.1.tgz#eaecc0d327fd68c8d9672a1e64ab8dccb2ef5327" integrity sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ== -diff-sequences@^29.4.2: - version "29.4.2" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.4.2.tgz#711fe6bd8a5869fe2539cee4a5152425ff671fda" - integrity sha512-R6P0Y6PrsH3n4hUXxL3nns0rbRk6Q33js3ygJBeEpbzLzgcNuJ61+u0RXasFpTKISw99TxUzFnumSnRLsjhLaw== +diff-sequences@^29.4.3: + version "29.4.3" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.4.3.tgz#9314bc1fabe09267ffeca9cbafc457d8499a13f2" + integrity sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA== dir-glob@^3.0.1: version "3.0.1" @@ -3792,9 +3792,9 @@ ejs@^3.1.6: jake "^10.8.5" electron-to-chromium@^1.4.284: - version "1.4.295" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.295.tgz#911d5df67542bf7554336142eb302c5ec90bba66" - integrity sha512-lEO94zqf1bDA3aepxwnWoHUjA8sZ+2owgcSZjYQy0+uOSEclJX0VieZC+r+wLpSxUHRd6gG32znTWmr+5iGzFw== + version "1.4.301" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.301.tgz#175d9fa1509a5b062752c6db321051e610fe2eae" + integrity sha512-bz00ASIIDjcgszZKuEA1JEFhbDjqUNbQ/PEhNEl1wbixzYpeTp2H2QWjsQvAL2T1wJBdOwCF5hE896BoMwYKrA== emittery@^0.10.2: version "0.10.2" @@ -4100,9 +4100,9 @@ eslint-plugin-react@^7.27.1: string.prototype.matchall "^4.0.8" eslint-plugin-testing-library@^5.0.1: - version "5.10.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-testing-library/-/eslint-plugin-testing-library-5.10.1.tgz#16ef8adb74d59a4dda24db1d5e750a0ee9b79471" - integrity sha512-GRy87AqUi2Ij69pe0YnOXm3oGBCgnFwfIv+Hu9q/kT3jL0pX1cXA7aO+oJnvdpbJy2+riOPqGsa3iAkL888NLg== + version "5.10.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-testing-library/-/eslint-plugin-testing-library-5.10.2.tgz#12f231ad9b52b6aef45c801fd00aa129a932e0c2" + integrity sha512-f1DmDWcz5SDM+IpCkEX0lbFqrrTs8HRsEElzDEqN/EBI0hpRj8Cns5+IVANXswE8/LeybIJqPAOQIFu2j5Y5sw== dependencies: "@typescript-eslint/utils" "^5.43.0" @@ -4210,9 +4210,9 @@ esprima@^4.0.0, esprima@^4.0.1: integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== esquery@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" - integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== + version "1.4.2" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.2.tgz#c6d3fee05dd665808e2ad870631f221f5617b1d1" + integrity sha512-JVSoLdTlTDkmjFmab7H/9SL9qGSyjElT3myyKp7krqjVFQCDLmj1QFaCLRFBszBKI0XVZaiiXvuPIX3ZwHe1Ng== dependencies: estraverse "^5.1.0" @@ -4289,15 +4289,15 @@ expect@^27.5.1: jest-message-util "^27.5.1" expect@^29.0.0: - version "29.4.2" - resolved "https://registry.yarnpkg.com/expect/-/expect-29.4.2.tgz#2ae34eb88de797c64a1541ad0f1e2ea8a7a7b492" - integrity sha512-+JHYg9O3hd3RlICG90OPVjRkPBoiUH7PxvDVMnRiaq1g6JUgZStX514erMl0v2Dc5SkfVbm7ztqbd6qHHPn+mQ== + version "29.4.3" + resolved "https://registry.yarnpkg.com/expect/-/expect-29.4.3.tgz#5e47757316df744fe3b8926c3ae8a3ebdafff7fe" + integrity sha512-uC05+Q7eXECFpgDrHdXA4k2rpMyStAYPItEDLyQDo5Ta7fVkJnNA/4zh/OIVkVVNZ1oOK1PipQoyNjuZ6sz6Dg== dependencies: - "@jest/expect-utils" "^29.4.2" - jest-get-type "^29.4.2" - jest-matcher-utils "^29.4.2" - jest-message-util "^29.4.2" - jest-util "^29.4.2" + "@jest/expect-utils" "^29.4.3" + jest-get-type "^29.4.3" + jest-matcher-utils "^29.4.3" + jest-message-util "^29.4.3" + jest-util "^29.4.3" express@^4.17.3: version "4.18.2" @@ -5425,15 +5425,15 @@ jest-diff@^27.5.1: jest-get-type "^27.5.1" pretty-format "^27.5.1" -jest-diff@^29.4.2: - version "29.4.2" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.4.2.tgz#b88502d5dc02d97f6512d73c37da8b36f49b4871" - integrity sha512-EK8DSajVtnjx9sa1BkjZq3mqChm2Cd8rIzdXkQMA8e0wuXq53ypz6s5o5V8HRZkoEt2ywJ3eeNWFKWeYr8HK4g== +jest-diff@^29.4.3: + version "29.4.3" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.4.3.tgz#42f4eb34d0bf8c0fb08b0501069b87e8e84df347" + integrity sha512-YB+ocenx7FZ3T5O9lMVMeLYV4265socJKtkwgk/6YUz/VsEzYDkiMuMhWzZmxm3wDRQvayJu/PjkjjSkjoHsCA== dependencies: chalk "^4.0.0" - diff-sequences "^29.4.2" - jest-get-type "^29.4.2" - pretty-format "^29.4.2" + diff-sequences "^29.4.3" + jest-get-type "^29.4.3" + pretty-format "^29.4.3" jest-docblock@^27.5.1: version "27.5.1" @@ -5483,10 +5483,10 @@ jest-get-type@^27.5.1: resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-27.5.1.tgz#3cd613c507b0f7ace013df407a1c1cd578bcb4f1" integrity sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw== -jest-get-type@^29.4.2: - version "29.4.2" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.4.2.tgz#7cb63f154bca8d8f57364d01614477d466fa43fe" - integrity sha512-vERN30V5i2N6lqlFu4ljdTqQAgrkTFMC9xaIIfOPYBw04pufjXRty5RuXBiB1d72tGbURa/UgoiHB90ruOSivg== +jest-get-type@^29.4.3: + version "29.4.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.4.3.tgz#1ab7a5207c995161100b5187159ca82dd48b3dd5" + integrity sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg== jest-haste-map@^27.5.1: version "27.5.1" @@ -5549,15 +5549,15 @@ jest-matcher-utils@^27.0.0, jest-matcher-utils@^27.5.1: jest-get-type "^27.5.1" pretty-format "^27.5.1" -jest-matcher-utils@^29.4.2: - version "29.4.2" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.4.2.tgz#08d0bf5abf242e3834bec92c7ef5071732839e85" - integrity sha512-EZaAQy2je6Uqkrm6frnxBIdaWtSYFoR8SVb2sNLAtldswlR/29JAgx+hy67llT3+hXBaLB0zAm5UfeqerioZyg== +jest-matcher-utils@^29.4.3: + version "29.4.3" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.4.3.tgz#ea68ebc0568aebea4c4213b99f169ff786df96a0" + integrity sha512-TTciiXEONycZ03h6R6pYiZlSkvYgT0l8aa49z/DLSGYjex4orMUcafuLXYyyEDWB1RKglq00jzwY00Ei7yFNVg== dependencies: chalk "^4.0.0" - jest-diff "^29.4.2" - jest-get-type "^29.4.2" - pretty-format "^29.4.2" + jest-diff "^29.4.3" + jest-get-type "^29.4.3" + pretty-format "^29.4.3" jest-message-util@^27.5.1: version "27.5.1" @@ -5589,18 +5589,18 @@ jest-message-util@^28.1.3: slash "^3.0.0" stack-utils "^2.0.3" -jest-message-util@^29.4.2: - version "29.4.2" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.4.2.tgz#309a2924eae6ca67cf7f25781a2af1902deee717" - integrity sha512-SElcuN4s6PNKpOEtTInjOAA8QvItu0iugkXqhYyguRvQoXapg5gN+9RQxLAkakChZA7Y26j6yUCsFWN+hlKD6g== +jest-message-util@^29.4.3: + version "29.4.3" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.4.3.tgz#65b5280c0fdc9419503b49d4f48d4999d481cb5b" + integrity sha512-1Y8Zd4ZCN7o/QnWdMmT76If8LuDv23Z1DRovBj/vcSFNlGCJGoO8D1nJDw1AdyAGUk0myDLFGN5RbNeJyCRGCw== dependencies: "@babel/code-frame" "^7.12.13" - "@jest/types" "^29.4.2" + "@jest/types" "^29.4.3" "@types/stack-utils" "^2.0.0" chalk "^4.0.0" graceful-fs "^4.2.9" micromatch "^4.0.4" - pretty-format "^29.4.2" + pretty-format "^29.4.3" slash "^3.0.0" stack-utils "^2.0.3" @@ -5767,12 +5767,12 @@ jest-util@^28.1.3: graceful-fs "^4.2.9" picomatch "^2.2.3" -jest-util@^29.4.2: - version "29.4.2" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.4.2.tgz#3db8580b295df453a97de4a1b42dd2578dabd2c2" - integrity sha512-wKnm6XpJgzMUSRFB7YF48CuwdzuDIHenVuoIb1PLuJ6F+uErZsuDkU+EiExkChf6473XcawBrSfDSnXl+/YG4g== +jest-util@^29.4.3: + version "29.4.3" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.4.3.tgz#851a148e23fc2b633c55f6dad2e45d7f4579f496" + integrity sha512-ToSGORAz4SSSoqxDSylWX8JzkOQR7zoBtNRsA7e+1WUX5F8jrOwaNpuh1YfJHJKDHXLHmObv5eOjejUd+/Ws+Q== dependencies: - "@jest/types" "^29.4.2" + "@jest/types" "^29.4.3" "@types/node" "*" chalk "^4.0.0" ci-info "^3.2.0" @@ -6769,12 +6769,12 @@ postcss-color-rebeccapurple@^7.1.1: dependencies: postcss-value-parser "^4.2.0" -postcss-colormin@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/postcss-colormin/-/postcss-colormin-5.3.0.tgz#3cee9e5ca62b2c27e84fce63affc0cfb5901956a" - integrity sha512-WdDO4gOFG2Z8n4P8TWBpshnL3JpmNmJwdnfP2gbk2qBA8PWwOYcmjmI/t3CmMeL72a7Hkd+x/Mg9O2/0rD54Pg== +postcss-colormin@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/postcss-colormin/-/postcss-colormin-5.3.1.tgz#86c27c26ed6ba00d96c79e08f3ffb418d1d1988f" + integrity sha512-UsWQG0AqTFQmpBegeLLc1+c3jIqBNB0zlDGRWR+dQ3pRKJL1oeMzyqmH3o2PIfn9MBdNrVPWhDbT769LxCTLJQ== dependencies: - browserslist "^4.16.6" + browserslist "^4.21.4" caniuse-api "^3.0.0" colord "^2.9.1" postcss-value-parser "^4.2.0" @@ -6950,10 +6950,10 @@ postcss-merge-longhand@^5.1.7: postcss-value-parser "^4.2.0" stylehacks "^5.1.1" -postcss-merge-rules@^5.1.3: - version "5.1.3" - resolved "https://registry.yarnpkg.com/postcss-merge-rules/-/postcss-merge-rules-5.1.3.tgz#8f97679e67cc8d08677a6519afca41edf2220894" - integrity sha512-LbLd7uFC00vpOuMvyZop8+vvhnfRGpp2S+IMQKeuOZZapPRY4SMq5ErjQeHbHsjCUgJkRNrlU+LmxsKIqPKQlA== +postcss-merge-rules@^5.1.4: + version "5.1.4" + resolved "https://registry.yarnpkg.com/postcss-merge-rules/-/postcss-merge-rules-5.1.4.tgz#2f26fa5cacb75b1402e213789f6766ae5e40313c" + integrity sha512-0R2IuYpgU93y9lhVbO/OylTtKMVcHb67zjWIfCiKR9rWL3GUk1677LAqD/BcHizukdZEjT8Ru3oHRoAYoJy44g== dependencies: browserslist "^4.21.4" caniuse-api "^3.0.0" @@ -7201,10 +7201,10 @@ postcss-pseudo-class-any-link@^7.1.6: dependencies: postcss-selector-parser "^6.0.10" -postcss-reduce-initial@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/postcss-reduce-initial/-/postcss-reduce-initial-5.1.1.tgz#c18b7dfb88aee24b1f8e4936541c29adbd35224e" - integrity sha512-//jeDqWcHPuXGZLoolFrUXBDyuEGbr9S2rMo19bkTIjBQ4PqkaO+oI8wua5BOUxpfi97i3PCoInsiFIEBfkm9w== +postcss-reduce-initial@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/postcss-reduce-initial/-/postcss-reduce-initial-5.1.2.tgz#798cd77b3e033eae7105c18c9d371d989e1382d6" + integrity sha512-dE/y2XRaqAi6OvjzD22pjTUQ8eOfc6m/natGHgKFBK9DxFmIm69YmaRVQrGgFlEfc1HePIurY0TmDeROK05rIg== dependencies: browserslist "^4.21.4" caniuse-api "^3.0.0" @@ -7315,12 +7315,12 @@ pretty-format@^28.1.3: ansi-styles "^5.0.0" react-is "^18.0.0" -pretty-format@^29.0.0, pretty-format@^29.4.2: - version "29.4.2" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.4.2.tgz#64bf5ccc0d718c03027d94ac957bdd32b3fb2401" - integrity sha512-qKlHR8yFVCbcEWba0H0TOC8dnLlO4vPlyEjRPw31FZ2Rupy9nLa8ZLbYny8gWEl8CkEhJqAE6IzdNELTBVcBEg== +pretty-format@^29.0.0, pretty-format@^29.4.3: + version "29.4.3" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.4.3.tgz#25500ada21a53c9e8423205cf0337056b201244c" + integrity sha512-cvpcHTc42lcsvOOAzd3XuNWTcvk1Jmnzqeu+WsOuiPmxUJTnkbAcFNsRKvEpBEUFVUgy/GTZLulZDcDEi+CIlA== dependencies: - "@jest/schemas" "^29.4.2" + "@jest/schemas" "^29.4.3" ansi-styles "^5.0.0" react-is "^18.0.0" @@ -7644,9 +7644,9 @@ regexpp@^3.2.0: integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== regexpu-core@^5.2.1: - version "5.3.0" - resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-5.3.0.tgz#4d0d044b76fedbad6238703ae84bfdedee2cf074" - integrity sha512-ZdhUQlng0RoscyW7jADnUZ25F5eVtHdMyXSb2PiwafvteRAOJUjFoUPEYZSIfP99fBIs3maLIRfpEddT78wAAQ== + version "5.3.1" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-5.3.1.tgz#66900860f88def39a5cb79ebd9490e84f17bcdfb" + integrity sha512-nCOzW2V/X15XpLsK2rlgdwrysrBq+AauCn+omItIz4R1pIcmeot5zvjdmOBRLzEH/CkC6IxMJVmxDe3QcMuNVQ== dependencies: "@babel/regjsgen" "^0.8.0" regenerate "^1.4.2" @@ -8348,9 +8348,9 @@ symbol-tree@^3.2.4: integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== tailwindcss@^3.0.2: - version "3.2.6" - resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.2.6.tgz#9bedbc744a4a85d6120ce0cc3db024c551a5c733" - integrity sha512-BfgQWZrtqowOQMC2bwaSNe7xcIjdDEgixWGYOd6AL0CbKHJlvhfdbINeAW76l1sO+1ov/MJ93ODJ9yluRituIw== + version "3.2.7" + resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.2.7.tgz#5936dd08c250b05180f0944500c01dce19188c07" + integrity sha512-B6DLqJzc21x7wntlH/GsZwEXTBttVSl1FtCzC8WP4oBc/NKef7kaax5jeihkkCEWc831/5NDJ9gRNDK6NEioQQ== dependencies: arg "^5.0.2" chokidar "^3.5.3" @@ -9183,9 +9183,9 @@ ws@^7.4.6: integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== ws@^8.4.2: - version "8.12.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.12.0.tgz#485074cc392689da78e1828a9ff23585e06cddd8" - integrity sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig== + version "8.12.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.12.1.tgz#c51e583d79140b5e42e39be48c934131942d4a8f" + integrity sha512-1qo+M9Ba+xNhPB+YTWUlK6M17brTut5EXbcBaMRN5pH5dFrXz7lzz1ChFSUq3bOUl8yEvSenhHmYUNJxFzdJew== xml-name-validator@^3.0.0: version "3.0.0" From 47d282f18a9ab3cbb43488754675229db5450519 Mon Sep 17 00:00:00 2001 From: dilane3 Date: Wed, 22 Feb 2023 17:52:00 +0100 Subject: [PATCH 3/5] Add: Upgrade the useAction hook to allow it to get the list of actions that we want. --- LICENCE => LICENSE | 0 README.md | 2 +- dist/hooks/useAction.d.ts | 2 +- dist/hooks/useAction.js | 42 +++++++++++++++++++++----- dist/hooks/useAction.js.map | 2 +- dist/providers/reducer.js | 11 +++---- dist/providers/reducer.js.map | 2 +- package.json | 2 +- src/hooks/useAction.ts | 57 ++++++++++++++++++++++++++--------- src/providers/reducer.ts | 10 ++---- 10 files changed, 89 insertions(+), 41 deletions(-) rename LICENCE => LICENSE (100%) diff --git a/LICENCE b/LICENSE similarity index 100% rename from LICENCE rename to LICENSE diff --git a/README.md b/README.md index 22ac632..9a82cfd 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![npm version](https://badge.fury.io/js/%40dilane3%2Fgx.svg)](https://badge.fury.io/js/%40dilane3%2Fgx) [![npm downloads](https://img.shields.io/npm/dm/%40dilane3%2Fgx)](https://www.npmjs.com/package/@dilane3/gx) -[![GitHub license](https://img.shields.io/github/license/react-gx/gx)](https://github.com/react-gx/gx/blob/main/LICENCE) +[![GitHub license](https://img.shields.io/github/license/react-gx/gx)](https://github.com/react-gx/gx/blob/main/LICENSE) ![logo](./assets/logo.png) diff --git a/dist/hooks/useAction.d.ts b/dist/hooks/useAction.d.ts index 2a10c7a..45fadf7 100644 --- a/dist/hooks/useAction.d.ts +++ b/dist/hooks/useAction.d.ts @@ -1,4 +1,4 @@ -declare const useAction: (signalName: string) => { +declare const useAction: (signalName: string, ...actions: string[]) => ((payload: any) => void) | { [key: string]: (payload: any) => void; }; export default useAction; diff --git a/dist/hooks/useAction.js b/dist/hooks/useAction.js index 122ef67..db013af 100644 --- a/dist/hooks/useAction.js +++ b/dist/hooks/useAction.js @@ -1,6 +1,6 @@ -import { useContext } from 'react'; +import { useContext } from "react"; import GXContext from "../contexts"; -const useAction = (signalName) => { +const useAction = (signalName, ...actions) => { // Get Global Context const { signals, dispatch } = useContext(GXContext); // Some handlers @@ -10,24 +10,52 @@ const useAction = (signalName) => { * @returns */ const handleGetActions = (signalName) => { - const signal = signals.find(signal => signal.name === signalName); + const signal = signals.find((signal) => signal.name === signalName); if (signal) { - return signal.actions; + console.log("actions", actions); + if (!actions || actions.length === 0) + return signal.actions; + const filteredActions = []; + for (let action of actions) { + const actionName = `${signalName}/${action}`; + const retrievedAction = signal.actions.find((act) => act.type === actionName); + if (retrievedAction) + filteredActions.push(retrievedAction); + else + throw new Error(`Action ${actionName} not found`); + } + return filteredActions; } - return []; + else + throw new Error(`Signal ${signalName} not found`); }; const handleFormatActions = () => { // Get actions const nonFormattedActions = handleGetActions(signalName); + // Get number of actions + const numberOfActions = nonFormattedActions.length; + // Check if actions are only one + if (numberOfActions === 1) { + const action = nonFormattedActions[0]; + // Return action as a function + return (payload) => { + dispatch({ + type: action.type, + payload, + }); + }; + } + console.log("nonFormattedActions", nonFormattedActions); + // If actions are more than one // Formatted actions const formattedActions = {}; for (const action of nonFormattedActions) { // Get action name - const actionName = action.type.split('/')[1]; + const actionName = action.type.split("/")[1]; formattedActions[actionName] = (payload) => { dispatch({ type: action.type, - payload + payload, }); }; } diff --git a/dist/hooks/useAction.js.map b/dist/hooks/useAction.js.map index cb0113a..9d434c6 100644 --- a/dist/hooks/useAction.js.map +++ b/dist/hooks/useAction.js.map @@ -1 +1 @@ -{"version":3,"file":"useAction.js","sourceRoot":"","sources":["../../src/hooks/useAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAuB,MAAM,OAAO,CAAC;AACxD,OAAO,SAAS,MAAM,aAAa,CAAC;AAGpC,MAAM,SAAS,GAAG,CAAC,UAAkB,EAAE,EAAE;IACvC,qBAAqB;IACrB,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IAEpD,gBAAgB;IAEhB;;;;OAIG;IACH,MAAM,gBAAgB,GAAG,CAAC,UAAkB,EAAE,EAAE;QAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;QAElE,IAAI,MAAM,EAAE;YACV,OAAO,MAAM,CAAC,OAAO,CAAC;SACvB;QAED,OAAO,EAAE,CAAC;IACZ,CAAC,CAAA;IAED,MAAM,mBAAmB,GAAG,GAAG,EAAE;QAC/B,cAAc;QACd,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAEzD,oBAAoB;QACpB,MAAM,gBAAgB,GAA8C,EAAE,CAAC;QAEvE,KAAK,MAAM,MAAM,IAAI,mBAAmB,EAAE;YACxC,kBAAkB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IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,OAAO;iBACR,CAAC,CAAC;YACL,CAAC,CAAC;SACH;QAED,OAAO,gBAAgB,CAAC;IAC1B,CAAC,CAAC;IAEF,OAAO,mBAAmB,EAAE,CAAC;AAC/B,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/dist/providers/reducer.js b/dist/providers/reducer.js index 49581eb..fbf86fb 100644 --- a/dist/providers/reducer.js +++ b/dist/providers/reducer.js @@ -5,10 +5,8 @@ const gxReducer = (signals, action) => { const signalName = action.type.split("/")[0]; // Get the signal const signal = prevSignals.find((signal) => signal.name === signalName); - if (!signal) { - console.warn(`Signal "${signalName}" not found`); - return prevSignals; - } + if (!signal) + throw new Error(`Signal "${signalName}" not found`); let actionToDispatch = null; // Get the action for (let act of signal.actions) { @@ -21,9 +19,8 @@ const gxReducer = (signals, action) => { // Dispatch the action signal.state = actionToDispatch.handler(signal.state, action.payload); } - else { - console.warn(`Action "${action.type}" not found`); - } + else + throw new Error(`Action "${action.type}" not found`); return prevSignals; }; export default gxReducer; diff --git a/dist/providers/reducer.js.map b/dist/providers/reducer.js.map index 84174f7..2ceae6d 100644 --- a/dist/providers/reducer.js.map +++ b/dist/providers/reducer.js.map @@ -1 +1 @@ -{"version":3,"file":"reducer.js","sourceRoot":"","sources":["../../src/providers/reducer.ts"],"names":[],"mappings":"AAGA,MAAM,SAAS,GAAG,CAAC,OAAuB,EAAE,MAAgB,EAAE,EAAE;IAC9D,eAAe;IACf,MAAM,WAAW,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;IAEjC,sBAAsB;IACtB,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAE7C,iBAAiB;IACjB,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC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AAC;IAE5B,iBAAiB;IACjB,KAAK,IAAI,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE;QAC9B,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,EAAE;YAC5B,gBAAgB,GAAG,GAAG,CAAC;YAEvB,MAAM;SACP;KACF;IAED,IAAI,gBAAgB,EAAE;QACpB,sBAAsB;QACtB,MAAM,CAAC,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;KACvE;;QAAM,MAAM,IAAI,KAAK,CAAC,WAAW,MAAM,CAAC,IAAI,aAAa,CAAC,CAAC;IAE5D,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/package.json b/package.json index cd37b1e..ff16523 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@dilane3/gx", + "name": "gx", "version": "1.0.1", "private": false, "license": "MIT", diff --git a/src/hooks/useAction.ts b/src/hooks/useAction.ts index 38a13d9..fa89143 100644 --- a/src/hooks/useAction.ts +++ b/src/hooks/useAction.ts @@ -1,8 +1,8 @@ -import { useContext, useState, useEffect } from 'react'; +import { useContext, useState, useEffect } from "react"; import GXContext from "../contexts"; +import { GXActionType } from "../contexts/types"; - -const useAction = (signalName: string) => { +const useAction = (signalName: string, ...actions: string[]) => { // Get Global Context const { signals, dispatch } = useContext(GXContext); @@ -10,40 +10,69 @@ const useAction = (signalName: string) => { /** * Get actions of a signal - * @param signalName - * @returns + * @param signalName + * @returns */ const handleGetActions = (signalName: string) => { - const signal = signals.find(signal => signal.name === signalName); + const signal = signals.find((signal) => signal.name === signalName); if (signal) { - return signal.actions; - } + if (!actions || actions.length === 0) return signal.actions; + + const filteredActions : GXActionType[] = []; + + for (let action of actions) { + const actionName = `${signalName}/${action}`; + + const retrievedAction = signal.actions.find((act) => act.type === actionName); + + if (retrievedAction) filteredActions.push(retrievedAction); + else throw new Error(`Action ${actionName} not found`); + } - return []; - } + return filteredActions; + } else throw new Error(`Signal ${signalName} not found`); + }; const handleFormatActions = () => { // Get actions const nonFormattedActions = handleGetActions(signalName); + // Get number of actions + const numberOfActions = nonFormattedActions.length; + + // Check if actions are only one + if (numberOfActions === 1) { + const action = nonFormattedActions[0]; + + // Return action as a function + return (payload: any) => { + dispatch({ + type: action.type, + payload, + }); + }; + } + + // If actions are more than one + // Formatted actions const formattedActions: { [key: string]: (payload: any) => void } = {}; for (const action of nonFormattedActions) { // Get action name - const actionName = action.type.split('/')[1]; + const actionName = action.type.split("/")[1]; formattedActions[actionName] = (payload: any) => { dispatch({ type: action.type, - payload + payload, }); - } + }; } return formattedActions; - } + }; return handleFormatActions(); }; diff --git a/src/providers/reducer.ts b/src/providers/reducer.ts index 699ea5c..5b4cdb9 100644 --- a/src/providers/reducer.ts +++ b/src/providers/reducer.ts @@ -11,11 +11,7 @@ const gxReducer = (signals: GXSignalType[], action: GXAction) => { // Get the signal const signal = prevSignals.find((signal) => signal.name === signalName); - if (!signal) { - console.warn(`Signal "${signalName}" not found`); - - return prevSignals; - } + if (!signal) throw new Error(`Signal "${signalName}" not found`); let actionToDispatch = null; @@ -31,9 +27,7 @@ const gxReducer = (signals: GXSignalType[], action: GXAction) => { if (actionToDispatch) { // Dispatch the action signal.state = actionToDispatch.handler(signal.state, action.payload); - } else { - console.warn(`Action "${action.type}" not found`); - } + } else throw new Error(`Action "${action.type}" not found`); return prevSignals; }; From 63de4ebf4f8e00df150bb54328c3ec77a98aa2e2 Mon Sep 17 00:00:00 2001 From: dilane3 Date: Wed, 22 Feb 2023 18:06:14 +0100 Subject: [PATCH 4/5] UPDATE: Update the documentation --- README.md | 29 ++++++++++++++++++++++++----- package.json | 18 ++++++++++++++++-- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9a82cfd..45849ad 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,8 @@ function App() { ); } + +export default App; ``` **After** @@ -63,6 +65,8 @@ function App() { ); } + +export default App; ``` ### Disabling strict mode on Next.js @@ -199,6 +203,8 @@ function Counter() { ); } + +export default Counter; ``` Note that the `useSignal` hook takes the name of the signal as a parameter and return the state contained inside that signal. @@ -268,12 +274,29 @@ const counter = useSignal("counter"); ### `useAction` -This hook takes the name of the signal as a parameter and returns an object that contains all the actions of this signal. +This hook takes the name of the signal as a the first parameter and returns an object that contains all the actions of this signal. ```js const { increment, decrement } = useAction("counter"); ``` +**`New in version 1.1.0`** + +Note that, the `useAction` hook can accept a second parameter which is the list of actions that you want to use. If you don't specify the second parameter, all the actions of the signal will be returned. + +There is another thing that you have to know. +If you provide only one action as a second parameter, the hook will return only the action itself and not an object that contains the action. + +```js +const increment = useAction("counter", "increment"); +``` + +And if you provide more than one action, the hook will return an object that contains all the actions provided. + +```js +const { increment, decrement } = useAction("counter", "increment", "decrement"); +``` + ## License [MIT](https://choosealicense.com/licenses/mit/) @@ -289,7 +312,3 @@ const { increment, decrement } = useAction("counter"); Contributions, issues and feature requests are welcome! See the [Contributing Guide](./CONTRIBUTING.md). - -## Keywords - -react, state, management, hooks, gx, dilane3 \ No newline at end of file diff --git a/package.json b/package.json index ff16523..ff06a9f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "gx", - "version": "1.0.1", + "name": "@dilane3/gx", + "version": "1.1.0", "private": false, "license": "MIT", "main": "dist/index.js", @@ -33,6 +33,20 @@ "build": "tsc", "test": "react-scripts test" }, + "keywords": [ + "react", + "react-gx", + "gx", + "redux", + "zustand", + "mobx", + "management", + "state", + "state-management", + "react-state-management", + "global", + "global-state" + ], "eslintConfig": { "extends": [ "react-app", From b200839d683036df036d2beafff12b0950d1225b Mon Sep 17 00:00:00 2001 From: dilane3 Date: Wed, 22 Feb 2023 18:07:18 +0100 Subject: [PATCH 5/5] Build version 1.1.0 --- dist/hooks/useAction.js | 2 -- dist/hooks/useAction.js.map | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/dist/hooks/useAction.js b/dist/hooks/useAction.js index db013af..c02ef1f 100644 --- a/dist/hooks/useAction.js +++ b/dist/hooks/useAction.js @@ -12,7 +12,6 @@ const useAction = (signalName, ...actions) => { const handleGetActions = (signalName) => { const signal = signals.find((signal) => signal.name === signalName); if (signal) { - console.log("actions", actions); if (!actions || actions.length === 0) return signal.actions; const filteredActions = []; @@ -45,7 +44,6 @@ const useAction = (signalName, ...actions) => { }); }; } - console.log("nonFormattedActions", nonFormattedActions); // If actions are more than one // Formatted actions const formattedActions = {}; diff --git a/dist/hooks/useAction.js.map b/dist/hooks/useAction.js.map index 9d434c6..f55632d 100644 --- a/dist/hooks/useAction.js.map +++ b/dist/hooks/useAction.js.map @@ -1 +1 @@ -{"version":3,"file":"useAction.js","sourceRoot":"","sources":["../../src/hooks/useAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAuB,MAAM,OAAO,CAAC;AACxD,OAAO,SAAS,MAAM,aAAa,CAAC;AAGpC,MAAM,SAAS,GAAG,CAAC,UAAkB,EAAE,GAAG,OAAiB,EAAE,EAAE;IAC7D,qBAAqB;IACrB,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IAEpD,gBAAgB;IAEhB;;;;OAIG;IACH,MAAM,gBAAgB,GAAG,CAAC,UAAkB,EAAE,EAAE;QAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;QAEpE,IAAI,MAAM,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;YAEhC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,MAAM,CAAC,OAAO,CAAC;YAE5D,MAAM,eAAe,GAAyB,EAAE,CAAC;YAEjD,KAAK,IA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