From d2e97d5c96323647d5f2b1eb9c1c34681b66fee9 Mon Sep 17 00:00:00 2001 From: Mai Trung Duc Date: Fri, 2 Jun 2023 23:19:23 +0800 Subject: [PATCH] feat: add popup UI, change ext icon with background script, handle host app reload for devtools page --- manifest.ts | 35 ++-- package.json | 12 +- public/icon128_black.png | Bin 0 -> 3597 bytes public/icon16_black.png | Bin 0 -> 213 bytes public/icon32_black.png | Bin 0 -> 526 bytes public/icon48_black.png | Bin 0 -> 814 bytes public/konva_logo_black.svg | 1 + public/konva_logo_blue.svg | 1 + src/assets/images/check-mark-icon.svg | 1 + src/assets/images/icon128.png | Bin 0 -> 4538 bytes src/pages/background/index.ts | 9 + .../content/components/Demo/app.test.tsx | 15 -- src/pages/content/components/Demo/app.tsx | 9 - src/pages/content/components/Demo/index.tsx | 11 -- src/pages/content/detector.ts | 15 ++ src/pages/content/index.ts | 43 ++++- src/pages/content/style.scss | 3 - src/pages/devtools/index.html | 2 +- src/pages/newtab/Newtab.css | 38 ---- src/pages/newtab/Newtab.scss | 10 - src/pages/newtab/Newtab.tsx | 26 --- src/pages/newtab/index.css | 13 -- src/pages/newtab/index.html | 12 -- src/pages/newtab/index.tsx | 18 -- src/pages/options/Options.css | 8 - src/pages/options/Options.tsx | 8 - src/pages/options/index.css | 0 src/pages/options/index.html | 12 -- src/pages/options/index.tsx | 18 -- src/pages/panel/components/Panel.tsx | 37 +++- src/pages/panel/devtools/connect.ts | 5 - .../panel/devtools/konvaDevtoolsOutline.ts | 4 + .../panel/devtools/konvaDevtoolsViewport.ts | 23 --- src/pages/panel/index.html | 2 +- src/pages/panel/index.tsx | 47 ++--- src/pages/panel/types.ts | 3 - src/pages/popup/Popup.css | 48 ++--- src/pages/popup/Popup.tsx | 85 +++++++-- src/pages/popup/index.css | 12 +- src/pages/popup/index.html | 4 +- src/pages/popup/index.tsx | 5 +- vite.config.ts | 13 +- yarn.lock | 172 +++++++++--------- 43 files changed, 335 insertions(+), 445 deletions(-) create mode 100644 public/icon128_black.png create mode 100644 public/icon16_black.png create mode 100644 public/icon32_black.png create mode 100644 public/icon48_black.png create mode 100644 public/konva_logo_black.svg create mode 100644 public/konva_logo_blue.svg create mode 100644 src/assets/images/check-mark-icon.svg create mode 100644 src/assets/images/icon128.png delete mode 100644 src/pages/content/components/Demo/app.test.tsx delete mode 100644 src/pages/content/components/Demo/app.tsx delete mode 100644 src/pages/content/components/Demo/index.tsx create mode 100644 src/pages/content/detector.ts delete mode 100644 src/pages/content/style.scss delete mode 100644 src/pages/newtab/Newtab.css delete mode 100644 src/pages/newtab/Newtab.scss delete mode 100644 src/pages/newtab/Newtab.tsx delete mode 100644 src/pages/newtab/index.css delete mode 100644 src/pages/newtab/index.html delete mode 100644 src/pages/newtab/index.tsx delete mode 100644 src/pages/options/Options.css delete mode 100644 src/pages/options/Options.tsx delete mode 100644 src/pages/options/index.css delete mode 100644 src/pages/options/index.html delete mode 100644 src/pages/options/index.tsx delete mode 100644 src/pages/panel/devtools/konvaDevtoolsViewport.ts diff --git a/manifest.ts b/manifest.ts index 0a2551d..f9a96b7 100755 --- a/manifest.ts +++ b/manifest.ts @@ -9,14 +9,14 @@ const manifest: chrome.runtime.ManifestV3 = { version: packageJson.version, description: packageJson.description, // options_page: "src/pages/options/index.html", - // background: { - // service_worker: "src/pages/background/index.js", - // type: "module", - // }, - // action: { - // default_popup: "src/pages/popup/index.html", - // default_icon: "icon-34.png", - // }, + background: { + service_worker: "src/pages/background/index.js", + type: "module", + }, + action: { + default_popup: "src/pages/popup/index.html", + default_icon: "icon32_black.png", + }, // chrome_url_overrides: { // newtab: "src/pages/newtab/index.html", // }, @@ -27,12 +27,13 @@ const manifest: chrome.runtime.ManifestV3 = { "128": "icon128.png", }, content_scripts: [ - // { - // matches: ["http://*/*", "https://*/*", ""], - // js: ["src/pages/content/index.js"], - // // KEY for cache invalidation - // css: ["assets/css/contentStyle.chunk.css"], - // }, + { + matches: ["http://*/*", "https://*/*", ""], + js: ["src/pages/content/index.js"], + css: [], + // KEY for cache invalidation + // css: ["assets/css/contentStyle.chunk.css"], + }, ], devtools_page: "src/pages/devtools/index.html", web_accessible_resources: [ @@ -40,11 +41,7 @@ const manifest: chrome.runtime.ManifestV3 = { resources: [ "assets/js/*.js", "assets/css/*.css", - "icon-16.png", - "icon-19.png", - "icon-38.png", - "icon-48.png", - "icon-128.png", + "src/pages/detector/index.js", ], matches: ["*://*/*"], }, diff --git a/package.json b/package.json index 3556ee2..c14126d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "konva-inspector", - "version": "0.0.2", + "version": "0.0.4", "description": "Devtools for your Konva App", "license": "MIT", "repository": { @@ -23,19 +23,19 @@ }, "devDependencies": { "@rollup/plugin-typescript": "^8.5.0", - "@testing-library/react": "13.4.0", - "@types/chrome": "0.0.224", + "@testing-library/react": "^13.4.0", + "@types/chrome": "^0.0.224", "@types/jest": "29.0.3", "@types/node": "18.15.11", "@types/react": "18.0.21", "@types/react-dom": "18.0.11", "@types/ws": "^8.5.4", - "@typescript-eslint/eslint-plugin": "5.56.0", + "@typescript-eslint/eslint-plugin": "^5.56.0", "@typescript-eslint/parser": "5.38.1", "@vitejs/plugin-react": "2.2.0", "chokidar": "^3.5.3", "cross-env": "^7.0.3", - "eslint": "8.36.0", + "eslint": "^8.36.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-prettier": "4.2.1", "eslint-plugin-react": "7.32.2", @@ -46,7 +46,7 @@ "prettier": "2.8.8", "rollup": "2.79.1", "sass": "1.55.0", - "ts-jest": "29.0.2", + "ts-jest": "^29.0.2", "ts-loader": "9.4.2", "typescript": "4.8.3", "vite": "3.1.3", diff --git a/public/icon128_black.png b/public/icon128_black.png new file mode 100644 index 0000000000000000000000000000000000000000..63e536a9facaffc20a0153fa005cf6bfb7f59c24 GIT binary patch literal 3597 zcmWlcX*|@A6US$FS*-ikVktL~BO>HJbIVz-+(hn{w7%s^h?G$4ND+lXD5bXKK2we) zHlbBHevVwl-~YkPJedbGuh(a0-jily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=AWSb?-=t1daQouJfS zTXt5a!@QRE?kL8YPPhB)hfjUxFNmWs_|RJ9uuGlcw?wCGhr;90VSf%6tKJtsrEo%- z&v>|-zx=oUU@HrTgxk* zKA;#E{$NqcDn>-N=>%y+0!5krHEr7M&6_lhqB|KaZ=r(d!Bef+G(*gdb68Ii?>v)V zr0FwclygnYYY`M6Boy$Ysjsm{?tO5>Jws4fwl>*qUOQm8%6B84ruIssSPRrD{ zn2>NxZFAH4DZE|_US+@nUG_&V)KSoP|dLPZgg@J)AoisVtgpX7qVGJO_Bn~ z+M5|t()b_`1=V*LsRqC1l5ygz6mfXPYIxNLrCa_g%;x-`r0kzw_tgoWXOmBjJQjgd ze-wmSQYrgDwleTb*>wvATkQ0TCdM{njxQOW8{Z^wzkw3fCCsMtOP71V$sWHCgQl%x zYI>mS?g5+kMBaLd_!6k{&N|CI^3ouk_a!q!g}v()Lq0`-rYz12C7-pzW&I|1_2vId zyLQvn0jMmL0#Wfu0`;bdda?^I1gO~u7C3X|kl0_L5hlWAGYP0*@kjF&vFrn3s-yzO zYDY_l?eEOR2?q@2d+^~D-K^rm89ebV|A4F;lpLNUk9C_ll^5GFL~rd2oi-O%FReZn ze}3ia)e%>C)Vdv0a#nh~mc|k4S>D<$9X`jracb;k19)qLu_gWa_)QzlZLOFj$tM_ZZ~8+5Ns7h^+4acVK2@Wmu!{dF6kq CFj@Hk literal 0 HcmV?d00001 diff --git a/public/icon16_black.png b/public/icon16_black.png new file mode 100644 index 0000000000000000000000000000000000000000..141ed99323dee5091c4a10ea9c9da1ff763302ee GIT binary patch literal 213 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|`aNA7LoEEa zPQJ~1K!L+Gk$-woaC;H|?0|(0i_Cm~pL|^LFsS9{^(Kp7JNR9C6X&zdF*EL|l2kam z)>h_-wQYB)*LnsErYCb2PFZwZv0>uApaWeziL4%)j%!0-#WSzDcF@sF-(6zQPx$$Vo&&R9HvNmqBjAFc3w5QlWz29PM4W0SgYm5x7B)kUbm3h81GTIocbrjDiGJ z)TSC!2Pcd@c1T3MOzip3j^+5fB-~$?Ga!^0OGcD0oV%gIz7o~uQkvLV6|FdKA&56n~%6I!d3t_ zW%3MHRycp|41k0QAf&Zk0!gIzB`AtQ*|V$pK(x+)4*s-VV9xGzI$=B>JMG$aA!%hq zi^T$InpSZov$6mvBcc{;#mnUqNs>4L*6TH9vzfb0{{99ZMm_+78`7j>@iT1hCm`u-$H}bnf?iWLd^8flmA3aKQ0+Px%=t)FDRA@upn!m0RK@`S6sEk(=s3>SDcmcUmXiRLhgMx%tpo8dr3N?X_SAYiS zw9%*q_gkOoXNEAL|2YziUTX&1MtR>68l~wla0E+XZT{vhS(|Gy#0=5_#^??*>}|f1^~y2>o1a1fbn>YR;!iRz!wWZbvJ)nQLG(|F74Ig90N~$QKCdP z%jGiG>or5e(ZsL?wgNz_`*6me5QEvtTgbe%NvG{7L9^KmjYi|d<$k|M zKA%qvV*uc0GpAalCX-17Dok@R0AAk=ZO&W+SUu333E(w=k4}!1Du7C*g4Jr3I0kyX z9{T-0cQ|_5ogC^_0NzYN+$Y7=QxGW+_3YWmRETLk1%UEeMc7%n*jg+WsMTtbxD>!} zI7Fw@p}J7w#TL62s3;DE^YX=Y7(X#d zh${d;({$Vvbstl)le$niuGWqPLKng9R* literal 0 HcmV?d00001 diff --git a/public/konva_logo_black.svg b/public/konva_logo_black.svg new file mode 100644 index 0000000..ebdbf8b --- /dev/null +++ b/public/konva_logo_black.svg @@ -0,0 +1 @@ +Konva \ No newline at end of file diff --git a/public/konva_logo_blue.svg b/public/konva_logo_blue.svg new file mode 100644 index 0000000..1bb0275 --- /dev/null +++ b/public/konva_logo_blue.svg @@ -0,0 +1 @@ +Konva \ No newline at end of file diff --git a/src/assets/images/check-mark-icon.svg b/src/assets/images/check-mark-icon.svg new file mode 100644 index 0000000..879031c --- /dev/null +++ b/src/assets/images/check-mark-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/images/icon128.png b/src/assets/images/icon128.png new file mode 100644 index 0000000000000000000000000000000000000000..54705ebf1b5ce9ff553a0110c428e3aca2f1ddfc GIT binary patch literal 4538 zcmV;r5k>BaP)Px`bV)=(RCr$Poqc!|)xF2RXLgeqlI-RU5);Ir1TXI-yMmY7YE>-PQbeC#wOV`> zZ7--;t+YjvY&IK&(o)5jdc`Z%N~@3B)~63wEl_Q>)f%$9yjBeY0+H|%5_UK5WOvSe zCa^%rZg$ShoS8|o^B?T*{d{uf%$ak}5DcgB5S)^X)r#MDi*&di z`J`D$IPm*nf~7mD5u3!LqG_~qeazyXl$-kN>YWm#E&`yzOdM?sX@oae|Xd3$#- zxc^6G0i`yK&>JuST($OJH*Y`MxrP!HfWl%#u@dDHVm5Co0J1&)yD8{8<}3z~f`y3RZ(8R3H6etWA#76sU~|__BZ5$4hJxr7 z0~N*TA@}85^zs+akD&nMRC-5=7P23Jp>Y`12q^-gmu04veDu%+!=7jiE4;nhzYmm- zHmdk$@=JjI0hhy&TIdddt;%=5ML@Mkkz=MtFglhr3kh_F>9SCz<5zmdqALI+misq% ziFBr(2@W)0g&Eer)-9fLjb3r<0zk%c|7|IhuA>y`dL=fn{m{;-c^P+qaR0d1c;~?# z0Gr2q9|6&|TjO0cz3fxa`$I10b3Fa=1AtPJ>GA!}Ldb1A6Bz8aOKfRxZhvsXt>83o zzzqPq$9Doi_F!)yJ@T^>5@@O@=Q3#K0)XA)YX*{|e2w8a5p+3nHMXhk1WeYWHF-k1 zo1>{Z?uLC8HU4&=%neq<`rQ563XiVK*Au-5qRkBgLv7`cg~DbERwsjNHzd=k8clvOIea-k=?Rj9LA2& z{?0NK0k9DAWphROC35O73jn*vw-W8oZ?sZ>3#p4kAn^UZzu)91Qu zAKVvoITHTCCIrB~az_rjyQSB=T(95XdMRd(wQKGpr`ivep__#OP0QHE04zb5{$e{C zc@G3m2SmjS@~8n`g`A1QuO(udJJUF}^cd`&s4jPwqrRYq#tguDG@c z_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VaRz)auYK>0MSI!-Jgt15mIUh zV3SU?lbfK7h`4Iu+8S{fal}+`uv2QD6ha zuDddk+L>rGrWxWrH--TR!1)DCbJvVbM@nHgq0_AdKi8+g;u0cSK8d6XM_QIn-K~#L zK3)bq0I|xFyL{(GVX { - test("render text", () => { - // given - const text = "content view"; - - // when - render(); - - // then - screen.getByText(text); - }); -}); diff --git a/src/pages/content/components/Demo/app.tsx b/src/pages/content/components/Demo/app.tsx deleted file mode 100644 index 11ae3ff..0000000 --- a/src/pages/content/components/Demo/app.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { useEffect } from "react"; - -export default function App() { - useEffect(() => { - console.log("content view loaded"); - }, []); - - return
content view
; -} diff --git a/src/pages/content/components/Demo/index.tsx b/src/pages/content/components/Demo/index.tsx deleted file mode 100644 index 55bd3d9..0000000 --- a/src/pages/content/components/Demo/index.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createRoot } from "react-dom/client"; -import App from "@src/pages/content/components/Demo/app"; -import refreshOnUpdate from "virtual:reload-on-update-in-view"; - -refreshOnUpdate("pages/content"); - -const root = document.createElement("div"); -root.id = "chrome-extension-boilerplate-react-vite-content-view-root"; -document.body.append(root); - -createRoot(root).render(); diff --git a/src/pages/content/detector.ts b/src/pages/content/detector.ts new file mode 100644 index 0000000..da62dcf --- /dev/null +++ b/src/pages/content/detector.ts @@ -0,0 +1,15 @@ +import type Konva from "konva"; + +declare global { + interface Window { + Konva: typeof Konva; + } +} + +document.addEventListener("__KONVA_DEVTOOLS__DETECT_KONVA", function (e) { + document.dispatchEvent( + new CustomEvent("__KONVA_DEVTOOLS__DETECTION_RESULT", { + detail: !!window.Konva, + }) + ); +}); diff --git a/src/pages/content/index.ts b/src/pages/content/index.ts index 3a75809..5b29209 100644 --- a/src/pages/content/index.ts +++ b/src/pages/content/index.ts @@ -1,7 +1,38 @@ -console.log("content loaded"); +let lastResult = false; -/** - * @description - * Chrome extensions don't support modules in content scripts. - */ -import("./components/Demo"); +detect(); +const interval = setInterval(detect, 5000); + +function detect() { + try { + const s = document.createElement("script"); + s.src = chrome.runtime.getURL("src/pages/detector/index.js"); + document.body.appendChild(s); + s.onload = () => { + document.addEventListener( + "__KONVA_DEVTOOLS__DETECTION_RESULT", + function (e: CustomEvent) { + lastResult = e.detail; + + chrome.runtime.sendMessage({ + type: "__KONVA_DEVTOOLS__BROADCAST_RESULT", + result: lastResult, + }); + s.remove(); + } + ); + + document.dispatchEvent(new CustomEvent("__KONVA_DEVTOOLS__DETECT_KONVA")); + }; + } catch (error) { + clearInterval(interval); + console.log(error); + } +} + +chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) { + if (request["type"] == "__KONVA_DEVTOOLS__REQUEST_DETECTION") { + sendResponse(lastResult); + } + return true; // this make sure sendResponse will work asynchronously +}); diff --git a/src/pages/content/style.scss b/src/pages/content/style.scss deleted file mode 100644 index a206a8e..0000000 --- a/src/pages/content/style.scss +++ /dev/null @@ -1,3 +0,0 @@ -.content-view { - font-size: 30px; -} diff --git a/src/pages/devtools/index.html b/src/pages/devtools/index.html index a9e7f3a..0100980 100644 --- a/src/pages/devtools/index.html +++ b/src/pages/devtools/index.html @@ -1,5 +1,5 @@ - + Devtools diff --git a/src/pages/newtab/Newtab.css b/src/pages/newtab/Newtab.css deleted file mode 100644 index 74b5e05..0000000 --- a/src/pages/newtab/Newtab.css +++ /dev/null @@ -1,38 +0,0 @@ -.App { - text-align: center; -} - -.App-logo { - height: 40vmin; - pointer-events: none; -} - -@media (prefers-reduced-motion: no-preference) { - .App-logo { - animation: App-logo-spin infinite 20s linear; - } -} - -.App-header { - background-color: #282c34; - min-height: 100vh; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; -} - -.App-link { - color: #61dafb; -} - -@keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} diff --git a/src/pages/newtab/Newtab.scss b/src/pages/newtab/Newtab.scss deleted file mode 100644 index 8960c7b..0000000 --- a/src/pages/newtab/Newtab.scss +++ /dev/null @@ -1,10 +0,0 @@ -$myColor: red; - -h1, -h2, -h3, -h4, -h5, -h6 { - color: $myColor; -} diff --git a/src/pages/newtab/Newtab.tsx b/src/pages/newtab/Newtab.tsx deleted file mode 100644 index 55e514f..0000000 --- a/src/pages/newtab/Newtab.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import React from "react"; -import "@pages/newtab/Newtab.css"; -import "@pages/newtab/Newtab.scss"; - -const Newtab = () => { - return ( -
-
-

- Edit src/pages/newtab/Newtab.tsx and save to reload. -

- - Learn React! - -
The color of this paragraph is defined using SASS.
-
-
- ); -}; - -export default Newtab; diff --git a/src/pages/newtab/index.css b/src/pages/newtab/index.css deleted file mode 100644 index ec2585e..0000000 --- a/src/pages/newtab/index.css +++ /dev/null @@ -1,13 +0,0 @@ -body { - margin: 0; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', - 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', - sans-serif; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -code { - font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', - monospace; -} diff --git a/src/pages/newtab/index.html b/src/pages/newtab/index.html deleted file mode 100644 index 0d5481b..0000000 --- a/src/pages/newtab/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - New tab - - - -
- - - diff --git a/src/pages/newtab/index.tsx b/src/pages/newtab/index.tsx deleted file mode 100644 index 950551b..0000000 --- a/src/pages/newtab/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from "react"; -import { createRoot } from "react-dom/client"; -import Newtab from "@pages/newtab/Newtab"; -import "@pages/newtab/index.css"; -import refreshOnUpdate from "virtual:reload-on-update-in-view"; - -refreshOnUpdate("pages/newtab"); - -function init() { - const appContainer = document.querySelector("#app-container"); - if (!appContainer) { - throw new Error("Can not find #app-container"); - } - const root = createRoot(appContainer); - root.render(); -} - -init(); diff --git a/src/pages/options/Options.css b/src/pages/options/Options.css deleted file mode 100644 index 08a2ee4..0000000 --- a/src/pages/options/Options.css +++ /dev/null @@ -1,8 +0,0 @@ -.OptionsContainer { - width: 100%; - height: 50vh; - font-size: 2rem; - display: flex; - align-items: center; - justify-content: center; -} diff --git a/src/pages/options/Options.tsx b/src/pages/options/Options.tsx deleted file mode 100644 index 28d8fe9..0000000 --- a/src/pages/options/Options.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import React from "react"; -import "@pages/options/Options.css"; - -const Options: React.FC = () => { - return
Options
; -}; - -export default Options; diff --git a/src/pages/options/index.css b/src/pages/options/index.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/pages/options/index.html b/src/pages/options/index.html deleted file mode 100644 index 2f6cc08..0000000 --- a/src/pages/options/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - Options - - - -
- - - diff --git a/src/pages/options/index.tsx b/src/pages/options/index.tsx deleted file mode 100644 index a6959b6..0000000 --- a/src/pages/options/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from "react"; -import { createRoot } from "react-dom/client"; -import Options from "@pages/options/Options"; -import "@pages/options/index.css"; -import refreshOnUpdate from "virtual:reload-on-update-in-view"; - -refreshOnUpdate("pages/options"); - -function init() { - const appContainer = document.querySelector("#app-container"); - if (!appContainer) { - throw new Error("Can not find #app-container"); - } - const root = createRoot(appContainer); - root.render(); -} - -init(); diff --git a/src/pages/panel/components/Panel.tsx b/src/pages/panel/components/Panel.tsx index 7ec381b..12a43ce 100644 --- a/src/pages/panel/components/Panel.tsx +++ b/src/pages/panel/components/Panel.tsx @@ -6,6 +6,7 @@ import { OutlineNode } from "../types"; import InspectedElement from "./InspectedElement"; import ToggleOff from "./ToggleOff"; import SearchIcon from "./SearchIcon"; +import connect from "../devtools/connect"; const Panel: React.FC = () => { const [trees, setTrees] = useState([]); @@ -29,22 +30,42 @@ const Panel: React.FC = () => { }; }, []); + useEffect(() => { + function handleReload() { + setTrees([]); + setSelectedNode(null); + setSearchText(""); + setAlwaysInspect(false); + connect(bridge); + } + // listen on host page reload + chrome.devtools.network.onNavigated.addListener(handleReload); + + return () => { + chrome.devtools.network.onNavigated.removeListener(handleReload); + }; + }, []); + useEffect(() => { if (alwaysInspect) { // below we have && 1, to make the evaluation return a number // otherwise it'll return a Stage instance and the bridge will fail + // we also check for window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.Konva() is undefined or not to prevent the case when we reload at that time Konva is not initialized yet bridge(` - Konva.stages[0].addEventListener("mouseover", window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.selection.selectShapeAtCursor) && 1 + window.__KONVA_DEVTOOLS_GLOBAL_HOOK__ && + window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.Konva() && + window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.Konva().stages[0].addEventListener("mouseover", window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.selection.selectShapeAtCursor) && 1 `); } return () => { // below we need to assign result to a const // otherwise it'll return a Stage instance and the bridge will fail + // we also check for window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.Konva() is undefined or not to prevent the case when we reload at that time Konva is not initialized yet bridge(` - if (window.__KONVA_DEVTOOLS_GLOBAL_HOOK__) { - Konva.stages[0].removeEventListener("mouseover", window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.selection.selectShapeAtCursor) && 1 - } + window.__KONVA_DEVTOOLS_GLOBAL_HOOK__ && + window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.Konva() && + window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.Konva().stages[0].removeEventListener("mouseover", window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.selection.selectShapeAtCursor) && 1 `); }; }, [alwaysInspect]); @@ -54,7 +75,13 @@ const Panel: React.FC = () => { const data = await bridge( "window.__KONVA_DEVTOOLS_GLOBAL_HOOK__ && window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.outline.trees()" ); - setTrees(data); + if (data) { + setTrees(data); + } else { + // in case __KONVA_DEVTOOLS_GLOBAL_HOOK__ is undefined + // can happen during host page reload + setTrees([]); + } } catch (error) { console.log(error); } diff --git a/src/pages/panel/devtools/connect.ts b/src/pages/panel/devtools/connect.ts index 559a886..76a4fdb 100644 --- a/src/pages/panel/devtools/connect.ts +++ b/src/pages/panel/devtools/connect.ts @@ -3,7 +3,6 @@ import konvaDevtools from "./konvaDevtools"; import konvaDevtoolsOutline from "./konvaDevtoolsOutline"; import konvaDevtoolsOverlay from "./konvaDevtoolsOverlay"; import konvaDevtoolsSelection from "./konvaDevtoolsSelection"; -import konvaDevtoolsViewport from "./konvaDevtoolsViewport"; export default function connect(bridge: BridgeFn) { bridge(`(() => { @@ -11,9 +10,5 @@ export default function connect(bridge: BridgeFn) { window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.outline = (${konvaDevtoolsOutline.toString()}(window.__KONVA_DEVTOOLS_GLOBAL_HOOK__)); window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.selection = (${konvaDevtoolsSelection.toString()}(window.__KONVA_DEVTOOLS_GLOBAL_HOOK__)); window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.overlay = (${konvaDevtoolsOverlay.toString()}(window.__KONVA_DEVTOOLS_GLOBAL_HOOK__)); - window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.viewport = (${konvaDevtoolsViewport.toString()}(window.__KONVA_DEVTOOLS_GLOBAL_HOOK__)); })();`); } - -// window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.properties = (${pixiDevtoolsProperties.toString()}(window.__KONVA_DEVTOOLS_GLOBAL_HOOK__)); -// window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.clickToSelect = (${pixiDevtoolsClickToSelect.toString()}(window.__KONVA_DEVTOOLS_GLOBAL_HOOK__)); diff --git a/src/pages/panel/devtools/konvaDevtoolsOutline.ts b/src/pages/panel/devtools/konvaDevtoolsOutline.ts index 9eb3b74..657f379 100644 --- a/src/pages/panel/devtools/konvaDevtoolsOutline.ts +++ b/src/pages/panel/devtools/konvaDevtoolsOutline.ts @@ -23,7 +23,9 @@ export default function konvaDevtoolsOutline(devtools: KonvaDevtools) { // we create our own version of toObject based on toObject function from Konva // the purpose of this is to allows us add any custom fields as we want function toObject(node: Konva.Node): OutlineNode { + // eslint-disable-next-line prefer-const let obj = {} as any, + // eslint-disable-next-line prefer-const attrs = node.getAttrs(), key, val, @@ -63,6 +65,8 @@ export default function konvaDevtoolsOutline(devtools: KonvaDevtools) { return { trees(): OutlineNode[] { + if (!devtools.Konva()) return []; + const results = []; for (const stage of devtools.Konva().stages) { diff --git a/src/pages/panel/devtools/konvaDevtoolsViewport.ts b/src/pages/panel/devtools/konvaDevtoolsViewport.ts deleted file mode 100644 index 85f1e71..0000000 --- a/src/pages/panel/devtools/konvaDevtoolsViewport.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { KonvaDevtools } from "../types"; - -export default function konvaDevtoolsViewport(devtools: KonvaDevtools) { - return { - size(stageIndex = 0) { - const stage = devtools.Konva().stages[stageIndex]; - if (stage) { - return { - width: stage.width(), - height: stage.height(), - }; - } - return undefined; - }, - scale(stageIndex = 0) { - const stage = devtools.Konva().stages[stageIndex]; - if (stage) { - return stage.scale(); - } - return undefined; - }, - }; -} diff --git a/src/pages/panel/index.html b/src/pages/panel/index.html index 5d93379..f7d7294 100644 --- a/src/pages/panel/index.html +++ b/src/pages/panel/index.html @@ -1,5 +1,5 @@ - + Devtools Panel diff --git a/src/pages/panel/index.tsx b/src/pages/panel/index.tsx index 152b19c..d25bf9b 100644 --- a/src/pages/panel/index.tsx +++ b/src/pages/panel/index.tsx @@ -6,8 +6,26 @@ import Panel from "./components/Panel"; refreshOnUpdate("pages/panel"); +const bridge: BridgeFn = (code: string) => { + return new Promise((resolve, reject) => { + chrome.devtools.inspectedWindow.eval(code, (result, err) => { + if (err) { + if (err instanceof Error) { + reject(err); + } + console.log(code); + reject(new Error(err.value || err.description || err.code)); + } + resolve(result as any); + }); + }); +}; + let root: Root; function init() { + connect(bridge); + + if (root) return; const appContainer = document.getElementById("app") as HTMLDivElement; if (!appContainer) { throw new Error("Can not find #app"); @@ -19,31 +37,16 @@ function init() { "window.__KONVA_DEVTOOLS_GLOBAL_HOOK__ && window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.selection.deactivate()" ); }); + + chrome.windows.onFocusChanged.addListener(() => { + bridge( + "window.__KONVA_DEVTOOLS_GLOBAL_HOOK__ && window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.selection.deactivate()" + ); + }); } init(); export type BridgeFn = (code: string) => Promise; -export const bridge: BridgeFn = (code: string) => { - return new Promise((resolve, reject) => { - chrome.devtools.inspectedWindow.eval(code, (result, err) => { - if (err) { - if (err instanceof Error) { - reject(err); - } - console.log(code); - reject(new Error(err.value || err.description || err.code)); - } - resolve(result as any); - }); - }); -}; - -connect(bridge); - -chrome.windows.onFocusChanged.addListener((window) => { - bridge( - "window.__KONVA_DEVTOOLS_GLOBAL_HOOK__ && window.__KONVA_DEVTOOLS_GLOBAL_HOOK__.selection.deactivate()" - ); -}); +export { bridge }; diff --git a/src/pages/panel/types.ts b/src/pages/panel/types.ts index 6f5f3bf..f3981c1 100644 --- a/src/pages/panel/types.ts +++ b/src/pages/panel/types.ts @@ -2,14 +2,11 @@ import konvaDevtools from "./devtools/konvaDevtools"; import konvaDevtoolsOutline from "./devtools/konvaDevtoolsOutline"; import konvaDevtoolsOverlay from "./devtools/konvaDevtoolsOverlay"; import konvaDevtoolsSelection from "./devtools/konvaDevtoolsSelection"; -import konvaDevtoolsViewport from "./devtools/konvaDevtoolsViewport"; export type KonvaDevtools = ReturnType & { selection: ReturnType; - viewport: ReturnType; overlay: ReturnType; outline: ReturnType; - // properties: ReturnType; }; export type OutlineNode = { diff --git a/src/pages/popup/Popup.css b/src/pages/popup/Popup.css index e7ce476..666bac0 100644 --- a/src/pages/popup/Popup.css +++ b/src/pages/popup/Popup.css @@ -1,45 +1,25 @@ .App { - position: absolute; - top: 0px; - bottom: 0px; - left: 0px; - right: 0px; text-align: center; height: 100%; padding: 10px; - background-color: #282c34; + font-size: 16px; } - -.App-logo { - height: 30vmin; - pointer-events: none; -} - -@media (prefers-reduced-motion: no-preference) { - .App-logo { - animation: App-logo-spin infinite 20s linear; - } +.check-icon { + width: 20px; + margin-right: 4px; } -.App-header { - height: 100%; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; -} - -.App-link { - color: #61dafb; +.pulse { + border-radius: 50%; + margin-right: 5px; + animation: pulse-animation 2s infinite; } -@keyframes App-logo-spin { - from { - transform: rotate(0deg); +@keyframes pulse-animation { + 0% { + box-shadow: 0 0 0 0px rgb(15, 131, 205, 0.2); } - to { - transform: rotate(360deg); + 100% { + box-shadow: 0 0 0 20px rgb(15, 131, 205, 0); } -} +} \ No newline at end of file diff --git a/src/pages/popup/Popup.tsx b/src/pages/popup/Popup.tsx index 7753976..a1f4b79 100644 --- a/src/pages/popup/Popup.tsx +++ b/src/pages/popup/Popup.tsx @@ -1,22 +1,79 @@ -import React from "react"; +import { useEffect, useState } from "react"; import "@pages/popup/Popup.css"; +import checkIcon from "@assets/images/check-mark-icon.svg"; +import logoIcon from "@assets/images/icon128.png"; const Popup = () => { + const [isKonva, setIsKonva] = useState(false); + useEffect(() => { + detect(); + const timeout = setInterval(detect, 3000); + + function detect() { + chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) { + chrome.tabs.sendMessage( + tabs[0].id, + { type: "__KONVA_DEVTOOLS__REQUEST_DETECTION" }, + function (response) { + setIsKonva(response); + if (response) { + clearInterval(timeout); + } + } + ); + }); + } + + return () => { + clearInterval(timeout); + }; + }, []); + return (
-
-

- Edit src/pages/popup/Popup.tsx and save to reload. -

- - Learn React! - -
+ {isKonva ? ( + <> + + + Konva is detected +
+
+ Open DevTools and look for the Konva panel. + + ) : ( +
+
+ + Looking for Konva... +
+
+ Using Konva? +
+
+ After creating Konva app. Make sure to set it to Window object. Try + to log it to console: +
+
+ + console.log(window.Konva) + +
+
+ )}
); }; diff --git a/src/pages/popup/index.css b/src/pages/popup/index.css index 800a9cb..44f4924 100644 --- a/src/pages/popup/index.css +++ b/src/pages/popup/index.css @@ -1,17 +1,9 @@ body { - width: 300px; - height: 260px; + min-width: 300px; margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; - - position: relative; -} - -code { - font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', - monospace; -} +} \ No newline at end of file diff --git a/src/pages/popup/index.html b/src/pages/popup/index.html index 887788a..4f90b96 100644 --- a/src/pages/popup/index.html +++ b/src/pages/popup/index.html @@ -1,12 +1,12 @@ - + Popup -
+
diff --git a/src/pages/popup/index.tsx b/src/pages/popup/index.tsx index 87abf70..7c128a9 100644 --- a/src/pages/popup/index.tsx +++ b/src/pages/popup/index.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { createRoot } from "react-dom/client"; import "@pages/popup/index.css"; import Popup from "@pages/popup/Popup"; @@ -7,9 +6,9 @@ import refreshOnUpdate from "virtual:reload-on-update-in-view"; refreshOnUpdate("pages/popup"); function init() { - const appContainer = document.querySelector("#app-container"); + const appContainer = document.querySelector("#app"); if (!appContainer) { - throw new Error("Can not find #app-container"); + throw new Error("Can not find #app"); } const root = createRoot(appContainer); root.render(); diff --git a/vite.config.ts b/vite.config.ts index f83c046..fee2ffa 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -48,10 +48,11 @@ export default defineConfig({ panel: resolve(pagesDir, "panel", "index.html"), content: resolve(pagesDir, "content", "index.ts"), background: resolve(pagesDir, "background", "index.ts"), - contentStyle: resolve(pagesDir, "content", "style.scss"), + // contentStyle: resolve(pagesDir, "content", "style.scss"), popup: resolve(pagesDir, "popup", "index.html"), - newtab: resolve(pagesDir, "newtab", "index.html"), - options: resolve(pagesDir, "options", "index.html"), + detector: resolve(pagesDir, "content", "detector.ts"), + // newtab: resolve(pagesDir, "newtab", "index.html"), + // options: resolve(pagesDir, "options", "index.html"), }, watch: { include: ["src/**", "vite.config.ts"], @@ -66,9 +67,9 @@ export default defineConfig({ const { dir, name: _name } = path.parse(assetInfo.name); const assetFolder = dir.split("/").at(-1); const name = assetFolder + firstUpperCase(_name); - if (name === "contentStyle") { - return `assets/css/contentStyle${cacheInvalidationKey}.chunk.css`; - } + // if (name === "contentStyle") { + // return `assets/css/contentStyle${cacheInvalidationKey}.chunk.css`; + // } return `assets/[ext]/${name}.chunk.[ext]`; }, }, diff --git a/yarn.lock b/yarn.lock index 81e5065..9f797ef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -442,14 +442,14 @@ resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.4.0.tgz#3e61c564fcd6b921cb789838631c5ee44df09403" integrity sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ== -"@eslint/eslintrc@^2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.0.1.tgz#7888fe7ec8f21bc26d646dbd2c11cd776e21192d" - integrity sha512-eFRmABvW2E5Ho6f5fHLqgena46rOj7r7OKHYfLElqcBfGFHHpjBhivyi5+jOEQuSpdc/1phIZJlbC2te+tZNIw== +"@eslint/eslintrc@^2.0.3": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.0.3.tgz#4910db5505f4d503f27774bf356e3704818a0331" + integrity sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ== dependencies: ajv "^6.12.4" debug "^4.3.2" - espree "^9.5.0" + espree "^9.5.2" globals "^13.19.0" ignore "^5.2.0" import-fresh "^3.2.1" @@ -457,10 +457,10 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.36.0": - version "8.36.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.36.0.tgz#9837f768c03a1e4a30bd304a64fb8844f0e72efe" - integrity sha512-lxJ9R5ygVm8ZWgYdUweoq5ownDlJ4upvoWmO4eLxBYHdMo+vZ/Rx0EN6MbKWDJOSUGrqJy2Gt+Dyv/VKml0fjg== +"@eslint/js@8.41.0": + version "8.41.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.41.0.tgz#080321c3b68253522f7646b55b577dd99d2950b3" + integrity sha512-LxcyMGxwmTh2lY9FwHPGWOHmYFCZvbrFCBZL4FzSSsxsRPuhrYUg/49/0KDfW8tnIEaEHtfmn6+NPN+1DqaNmA== "@humanwhocodes/config-array@^0.11.8": version "0.11.8" @@ -839,9 +839,9 @@ lz-string "^1.4.4" pretty-format "^27.0.2" -"@testing-library/react@13.4.0": +"@testing-library/react@^13.4.0": version "13.4.0" - resolved "https://registry.npmmirror.com/@testing-library/react/-/react-13.4.0.tgz#6a31e3bf5951615593ad984e96b9e5e2d9380966" + resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-13.4.0.tgz#6a31e3bf5951615593ad984e96b9e5e2d9380966" integrity sha512-sXOGON+WNTh3MLE9rve97ftaZukN3oNf2KjDy7YTx6hcTO2uuLHuCGynMDhFwGw/jYf4OJ2Qk0i4i79qMNNkyw== dependencies: "@babel/runtime" "^7.12.5" @@ -891,7 +891,7 @@ dependencies: "@babel/types" "^7.3.0" -"@types/chrome@0.0.224": +"@types/chrome@^0.0.224": version "0.0.224" resolved "https://registry.yarnpkg.com/@types/chrome/-/chrome-0.0.224.tgz#0138497299eaaf261d61ece62d7d6af3868ce856" integrity sha512-YkL7q3KDV7OAKgVCBNIfH73rnjNMbIzAYHzTa2DKhSK/2z0Wf/n8yJnK/UoW+lvuYJJR4LtAkG3YvsIZTy7BOA== @@ -1039,15 +1039,15 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@5.56.0": - version "5.56.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.56.0.tgz#e4fbb4d6dd8dab3e733485c1a44a02189ae75364" - integrity sha512-ZNW37Ccl3oMZkzxrYDUX4o7cnuPgU+YrcaYXzsRtLB16I1FR5SHMqga3zGsaSliZADCWo2v8qHWqAYIj8nWCCg== +"@typescript-eslint/eslint-plugin@^5.56.0": + version "5.59.8" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.8.tgz#1e7a3e5318ece22251dfbc5c9c6feeb4793cc509" + integrity sha512-JDMOmhXteJ4WVKOiHXGCoB96ADWg9q7efPWHRViT/f09bA8XOMLAVHHju3l0MkZnG1izaWXYmgvQcUjTRcpShQ== dependencies: "@eslint-community/regexpp" "^4.4.0" - "@typescript-eslint/scope-manager" "5.56.0" - "@typescript-eslint/type-utils" "5.56.0" - "@typescript-eslint/utils" "5.56.0" + "@typescript-eslint/scope-manager" "5.59.8" + "@typescript-eslint/type-utils" "5.59.8" + "@typescript-eslint/utils" "5.59.8" debug "^4.3.4" grapheme-splitter "^1.0.4" ignore "^5.2.0" @@ -1073,21 +1073,21 @@ "@typescript-eslint/types" "5.38.1" "@typescript-eslint/visitor-keys" "5.38.1" -"@typescript-eslint/scope-manager@5.56.0": - version "5.56.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.56.0.tgz#62b4055088903b5254fa20403010e1c16d6ab725" - integrity sha512-jGYKyt+iBakD0SA5Ww8vFqGpoV2asSjwt60Gl6YcO8ksQ8s2HlUEyHBMSa38bdLopYqGf7EYQMUIGdT/Luw+sw== +"@typescript-eslint/scope-manager@5.59.8": + version "5.59.8" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.8.tgz#ff4ad4fec6433647b817c4a7d4b4165d18ea2fa8" + integrity sha512-/w08ndCYI8gxGf+9zKf1vtx/16y8MHrZs5/tnjHhMLNSixuNcJavSX4wAiPf4aS5x41Es9YPCn44MIe4cxIlig== dependencies: - "@typescript-eslint/types" "5.56.0" - "@typescript-eslint/visitor-keys" "5.56.0" + "@typescript-eslint/types" "5.59.8" + "@typescript-eslint/visitor-keys" "5.59.8" -"@typescript-eslint/type-utils@5.56.0": - version "5.56.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.56.0.tgz#e6f004a072f09c42e263dc50e98c70b41a509685" - integrity sha512-8WxgOgJjWRy6m4xg9KoSHPzBNZeQbGlQOH7l2QEhQID/+YseaFxg5J/DLwWSsi9Axj4e/cCiKx7PVzOq38tY4A== +"@typescript-eslint/type-utils@5.59.8": + version "5.59.8" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.59.8.tgz#aa6c029a9d7706d26bbd25eb4666398781df6ea2" + integrity sha512-+5M518uEIHFBy3FnyqZUF3BMP+AXnYn4oyH8RF012+e7/msMY98FhGL5SrN29NQ9xDgvqCgYnsOiKp1VjZ/fpA== dependencies: - "@typescript-eslint/typescript-estree" "5.56.0" - "@typescript-eslint/utils" "5.56.0" + "@typescript-eslint/typescript-estree" "5.59.8" + "@typescript-eslint/utils" "5.59.8" debug "^4.3.4" tsutils "^3.21.0" @@ -1096,10 +1096,10 @@ resolved "https://registry.npmmirror.com/@typescript-eslint/types/-/types-5.38.1.tgz#74f9d6dcb8dc7c58c51e9fbc6653ded39e2e225c" integrity sha512-QTW1iHq1Tffp9lNfbfPm4WJabbvpyaehQ0SrvVK2yfV79SytD9XDVxqiPvdrv2LK7DGSFo91TB2FgWanbJAZXg== -"@typescript-eslint/types@5.56.0": - version "5.56.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.56.0.tgz#b03f0bfd6fa2afff4e67c5795930aff398cbd834" - integrity sha512-JyAzbTJcIyhuUhogmiu+t79AkdnqgPUEsxMTMc/dCZczGMJQh1MK2wgrju++yMN6AWroVAy2jxyPcPr3SWCq5w== +"@typescript-eslint/types@5.59.8": + version "5.59.8" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.8.tgz#212e54414733618f5d0fd50b2da2717f630aebf8" + integrity sha512-+uWuOhBTj/L6awoWIg0BlWy0u9TyFpCHrAuQ5bNfxDaZ1Ppb3mx6tUigc74LHcbHpOHuOTOJrBoAnhdHdaea1w== "@typescript-eslint/typescript-estree@5.38.1": version "5.38.1" @@ -1114,30 +1114,30 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/typescript-estree@5.56.0": - version "5.56.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.56.0.tgz#48342aa2344649a03321e74cab9ccecb9af086c3" - integrity sha512-41CH/GncsLXOJi0jb74SnC7jVPWeVJ0pxQj8bOjH1h2O26jXN3YHKDT1ejkVz5YeTEQPeLCCRY0U2r68tfNOcg== +"@typescript-eslint/typescript-estree@5.59.8": + version "5.59.8" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.8.tgz#801a7b1766481629481b3b0878148bd7a1f345d7" + integrity sha512-Jy/lPSDJGNow14vYu6IrW790p7HIf/SOV1Bb6lZ7NUkLc2iB2Z9elESmsaUtLw8kVqogSbtLH9tut5GCX1RLDg== dependencies: - "@typescript-eslint/types" "5.56.0" - "@typescript-eslint/visitor-keys" "5.56.0" + "@typescript-eslint/types" "5.59.8" + "@typescript-eslint/visitor-keys" "5.59.8" 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.56.0": - version "5.56.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.56.0.tgz#db64705409b9a15546053fb4deb2888b37df1f41" - integrity sha512-XhZDVdLnUJNtbzaJeDSCIYaM+Tgr59gZGbFuELgF7m0IY03PlciidS7UQNKLE0+WpUTn1GlycEr6Ivb/afjbhA== +"@typescript-eslint/utils@5.59.8": + version "5.59.8" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.8.tgz#34d129f35a2134c67fdaf024941e8f96050dca2b" + integrity sha512-Tr65630KysnNn9f9G7ROF3w1b5/7f6QVCJ+WK9nhIocWmx9F+TmCAcglF26Vm7z8KCTwoKcNEBZrhlklla3CKg== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@types/json-schema" "^7.0.9" "@types/semver" "^7.3.12" - "@typescript-eslint/scope-manager" "5.56.0" - "@typescript-eslint/types" "5.56.0" - "@typescript-eslint/typescript-estree" "5.56.0" + "@typescript-eslint/scope-manager" "5.59.8" + "@typescript-eslint/types" "5.59.8" + "@typescript-eslint/typescript-estree" "5.59.8" eslint-scope "^5.1.1" semver "^7.3.7" @@ -1149,12 +1149,12 @@ "@typescript-eslint/types" "5.38.1" eslint-visitor-keys "^3.3.0" -"@typescript-eslint/visitor-keys@5.56.0": - version "5.56.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.56.0.tgz#f19eb297d972417eb13cb69b35b3213e13cc214f" - integrity sha512-1mFdED7u5bZpX6Xxf5N9U2c18sb+8EvU3tyOIj6LQZ5OOvnmj8BVeNNP603OFPm5KkS1a7IvCIcwrdHXaEMG/Q== +"@typescript-eslint/visitor-keys@5.59.8": + version "5.59.8" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.8.tgz#aa6a7ef862add919401470c09e1609392ef3cc40" + integrity sha512-pJhi2ms0x0xgloT7xYabil3SGGlojNNKjK/q6dB3Ey0uJLMjK2UDGJvHieiyJVW/7C3KI+Z4Q3pEHkm4ejA+xQ== dependencies: - "@typescript-eslint/types" "5.56.0" + "@typescript-eslint/types" "5.59.8" eslint-visitor-keys "^3.3.0" "@vitejs/plugin-react@2.2.0": @@ -2064,10 +2064,10 @@ eslint-scope@^5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-scope@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.1.tgz#fff34894c2f65e5226d3041ac480b4513a163642" - integrity sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw== +eslint-scope@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.0.tgz#f21ebdafda02352f103634b96dd47d9f81ca117b" + integrity sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" @@ -2077,15 +2077,20 @@ eslint-visitor-keys@^3.3.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -eslint@8.36.0: - version "8.36.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.36.0.tgz#1bd72202200a5492f91803b113fb8a83b11285cf" - integrity sha512-Y956lmS7vDqomxlaaQAHVmeb4tNMp2FWIvU/RnU5BD3IKMD/MJPr76xdyr68P8tV1iNMvN2mRK0yy3c+UjL+bw== +eslint-visitor-keys@^3.4.1: + version "3.4.1" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994" + integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== + +eslint@^8.36.0: + version "8.41.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.41.0.tgz#3062ca73363b4714b16dbc1e60f035e6134b6f1c" + integrity sha512-WQDQpzGBOP5IrXPo4Hc0814r4/v2rrIsB0rhT7jtunIalgg6gYXWhRMOejVO8yH21T/FGaxjmFjBMNqcIlmH1Q== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.4.0" - "@eslint/eslintrc" "^2.0.1" - "@eslint/js" "8.36.0" + "@eslint/eslintrc" "^2.0.3" + "@eslint/js" "8.41.0" "@humanwhocodes/config-array" "^0.11.8" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" @@ -2095,9 +2100,9 @@ eslint@8.36.0: debug "^4.3.2" doctrine "^3.0.0" escape-string-regexp "^4.0.0" - eslint-scope "^7.1.1" - eslint-visitor-keys "^3.3.0" - espree "^9.5.0" + eslint-scope "^7.2.0" + eslint-visitor-keys "^3.4.1" + espree "^9.5.2" esquery "^1.4.2" esutils "^2.0.2" fast-deep-equal "^3.1.3" @@ -2105,13 +2110,12 @@ eslint@8.36.0: find-up "^5.0.0" glob-parent "^6.0.2" globals "^13.19.0" - grapheme-splitter "^1.0.4" + graphemer "^1.4.0" ignore "^5.2.0" import-fresh "^3.0.0" imurmurhash "^0.1.4" is-glob "^4.0.0" is-path-inside "^3.0.3" - js-sdsl "^4.1.4" js-yaml "^4.1.0" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" @@ -2123,14 +2127,14 @@ eslint@8.36.0: strip-json-comments "^3.1.0" text-table "^0.2.0" -espree@^9.5.0: - version "9.5.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.5.0.tgz#3646d4e3f58907464edba852fa047e6a27bdf113" - integrity sha512-JPbJGhKc47++oo4JkEoTe2wjy4fmMwvFpgJT9cQzmfXKp22Dr6Hf1tdCteLz1h0P3t+mGvWZ+4Uankvh8+c6zw== +espree@^9.5.2: + version "9.5.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.5.2.tgz#e994e7dc33a082a7a82dceaf12883a829353215b" + integrity sha512-7OASN1Wma5fum5SrNhFMAMJxOUAbhyfQ8dQ//PJaJbNw0URTPWqIghHWt1MmAANKhHZIYOHruW4Kw4ruUWOdGw== dependencies: acorn "^8.8.0" acorn-jsx "^5.3.2" - eslint-visitor-keys "^3.3.0" + eslint-visitor-keys "^3.4.1" esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" @@ -2456,6 +2460,11 @@ grapheme-splitter@^1.0.4: resolved "https://registry.npmmirror.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== + has-bigints@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.1.tgz#64fe6acb020673e3b78db035a5af69aa9d07b113" @@ -3178,11 +3187,6 @@ jest@29.0.3: import-local "^3.0.2" jest-cli "^29.0.3" -js-sdsl@^4.1.4: - version "4.1.4" - resolved "https://registry.npmmirror.com/js-sdsl/-/js-sdsl-4.1.4.tgz#78793c90f80e8430b7d8dc94515b6c77d98a26a6" - integrity sha512-Y2/yD55y5jteOAmY50JbUZYwk3CP3wnLPEZnlR1w9oKhITrBEtAxwuWKebFf8hMrPMgbYwFoWK/lH2sBkErELw== - "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -3261,7 +3265,7 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= -json5@^2.2.1, json5@^2.2.2: +json5@^2.2.2, json5@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== @@ -4382,15 +4386,15 @@ tr46@^3.0.0: dependencies: punycode "^2.1.1" -ts-jest@29.0.2: - version "29.0.2" - resolved "https://registry.npmmirror.com/ts-jest/-/ts-jest-29.0.2.tgz#0c45a1ac45d14f8b3bf89bca9048a2840c7bd5ad" - integrity sha512-P03IUItnAjG6RkJXtjjD5pu0TryQFOwcb1YKmW63rO19V0UFqL3wiXZrmR5D7qYjI98btzIOAcYafLZ0GHAcQg== +ts-jest@^29.0.2: + version "29.1.0" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.0.tgz#4a9db4104a49b76d2b368ea775b6c9535c603891" + integrity sha512-ZhNr7Z4PcYa+JjMl62ir+zPiNJfXJN6E8hSLnaUKhOgqcn8vb3e537cpkd0FuAfRK3sR1LSqM1MOhliXNgOFPA== dependencies: bs-logger "0.x" fast-json-stable-stringify "2.x" jest-util "^29.0.0" - json5 "^2.2.1" + json5 "^2.2.3" lodash.memoize "4.x" make-error "1.x" semver "7.x"