From 0e0ea413be1a54e17ecae9d92766d43d6e25c644 Mon Sep 17 00:00:00 2001 From: Yannick Goossens Date: Sun, 5 Nov 2023 21:02:02 +0100 Subject: [PATCH 01/12] prevent loading the pdf page twice, possible fix for https://github.com/teia-community/teia-ui/issues/220 --- src/components/media-types/pdf/index.tsx | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/components/media-types/pdf/index.tsx b/src/components/media-types/pdf/index.tsx index 7709afb78..afffcbf59 100644 --- a/src/components/media-types/pdf/index.tsx +++ b/src/components/media-types/pdf/index.tsx @@ -24,7 +24,6 @@ export const PdfComponent = memo(function ({ }: MediaTypeProps) { const [numPages, setNumPages] = useState() const [pageNumber, setPageNumber] = useState(1) - const [renderedPageNumber, setRenderedPageNumber] = useState() const [loading, setLoading] = useState(displayView) const [showDocument, setShowDocument] = useState(true) @@ -68,7 +67,6 @@ export const PdfComponent = memo(function ({ setLoading(false) setHeight(container.current?.clientHeight) } - setRenderedPageNumber(pageNumber) } function onPassword(callback, reason) { @@ -144,14 +142,6 @@ export const PdfComponent = memo(function ({ title={`PDF object ${nft.token_id}`} options={options} > - {renderedPageNumber && renderedPageNumber !== pageNumber && ( - - )} Date: Tue, 7 Nov 2023 17:12:25 +0100 Subject: [PATCH 02/12] update react-pdf to see if that fixes the flickering issue --- package-lock.json | 276 ++++++++++++++++++----- package.json | 2 +- src/components/media-types/pdf/index.tsx | 9 +- 3 files changed, 230 insertions(+), 57 deletions(-) diff --git a/package-lock.json b/package-lock.json index 99a9b22cd..dc3420464 100644 --- a/package-lock.json +++ b/package-lock.json @@ -75,7 +75,7 @@ "prettier": "^2.8.4", "process": "^0.11.10", "prop-types": "^15.8.1", - "react-pdf": "^6.2.2", + "react-pdf": "^7.5.1", "rollup-plugin-node-polyfills": "^0.2.1", "rollup-plugin-polyfill-node": "^0.12.0", "sass": "^1.58.1", @@ -3243,6 +3243,63 @@ "@lit-labs/ssr-dom-shim": "^1.0.0" } }, + "node_modules/@mapbox/node-pre-gyp": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz", + "integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==", + "dev": true, + "optional": true, + "dependencies": { + "detect-libc": "^2.0.0", + "https-proxy-agent": "^5.0.0", + "make-dir": "^3.1.0", + "node-fetch": "^2.6.7", + "nopt": "^5.0.0", + "npmlog": "^5.0.1", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.11" + }, + "bin": { + "node-pre-gyp": "bin/node-pre-gyp" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "optional": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "optional": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@mapbox/node-pre-gyp/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "optional": true + }, "node_modules/@mdx-js/react": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/@mdx-js/react/-/react-2.3.0.tgz", @@ -6576,6 +6633,13 @@ "esbuild": ">=0.10.0" } }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true, + "optional": true + }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -7709,6 +7773,22 @@ } ] }, + "node_modules/canvas": { + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/canvas/-/canvas-2.11.2.tgz", + "integrity": "sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "dependencies": { + "@mapbox/node-pre-gyp": "^1.0.0", + "nan": "^2.17.0", + "simple-get": "^3.0.3" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -7881,9 +7961,9 @@ } }, "node_modules/clsx": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz", - "integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.0.0.tgz", + "integrity": "sha512-rQ1+kcj+ttHG0MKVGBUXwayCCF1oh39BF5COIpRzuCEv8Mwjv0XucrI2ExNTOn9IlLifGClWQcU9BrZORvtw6Q==", "dev": true, "engines": { "node": ">=6" @@ -8602,6 +8682,19 @@ "node": ">=0.10.0" } }, + "node_modules/decompress-response": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", + "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==", + "dev": true, + "optional": true, + "dependencies": { + "mimic-response": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/deep-equal": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.0.tgz", @@ -8766,6 +8859,16 @@ "node": ">=8" } }, + "node_modules/detect-libc": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", + "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", + "dev": true, + "optional": true, + "engines": { + "node": ">=8" + } + }, "node_modules/detect-package-manager": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/detect-package-manager/-/detect-package-manager-2.0.1.tgz", @@ -8904,12 +9007,6 @@ "url": "https://github.com/fb55/domhandler?sponsor=1" } }, - "node_modules/dommatrix": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/dommatrix/-/dommatrix-1.0.3.tgz", - "integrity": "sha512-l32Xp/TLgWb8ReqbVJAFIvXmY7go4nTxxlWiAFyhoQw9RKEOHBZNnyGvJWqDVSPmq3Y9HlM4npqF/T6VMOXhww==", - "dev": true - }, "node_modules/domutils": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", @@ -13108,9 +13205,9 @@ } }, "node_modules/make-cancellable-promise": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/make-cancellable-promise/-/make-cancellable-promise-1.2.1.tgz", - "integrity": "sha512-nigEn7brgUhjUb2lEobWUW4ZiJdIZ/Wct0UsmDsqaZhgLMvY1OC6FGLa/5SU2RvnyuilkjM7g5JGxt6CJZQGNw==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/make-cancellable-promise/-/make-cancellable-promise-1.3.2.tgz", + "integrity": "sha512-GCXh3bq/WuMbS+Ky4JBPW1hYTOU+znU+Q5m9Pu+pI8EoUqIHk9+tviOKC6/qhHh8C4/As3tzJ69IF32kdz85ww==", "dev": true, "funding": { "url": "https://github.com/wojtekmaj/make-cancellable-promise?sponsor=1" @@ -13132,9 +13229,9 @@ } }, "node_modules/make-event-props": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/make-event-props/-/make-event-props-1.4.2.tgz", - "integrity": "sha512-ZOHqRpLn2htnMd9zqhE+wticVr31PdwrJXHcvEEdKgrfjCOuSDn8urG9SDzEIqzP1ayp1uTdDJcOiTlJhqWpEQ==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/make-event-props/-/make-event-props-1.6.2.tgz", + "integrity": "sha512-iDwf7mA03WPiR8QxvcVHmVWEPfMY1RZXerDVNCRYW7dUr2ppH3J58Rwb39/WG39yTZdRSxr3x+2v22tvI0VEvA==", "dev": true, "funding": { "url": "https://github.com/wojtekmaj/make-event-props?sponsor=1" @@ -13331,15 +13428,20 @@ "dev": true }, "node_modules/merge-refs": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/merge-refs/-/merge-refs-1.1.2.tgz", - "integrity": "sha512-t+FvJw2LXHnNTMRmNB2HY04uVdvCW8AbfwZi0DgUxFEoP20rnvXxZmePRML1nDiLO5KKE0p4GDu1qHhrig/Jpg==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/merge-refs/-/merge-refs-1.2.2.tgz", + "integrity": "sha512-RwcT7GsQR3KbuLw1rRuodq4Nt547BKEBkliZ0qqsrpyNne9bGTFtsFIsIpx82huWhcl3kOlOlH4H0xkPk/DqVw==", "dev": true, - "dependencies": { - "@types/react": "*" - }, "funding": { "url": "https://github.com/wojtekmaj/merge-refs?sponsor=1" + }, + "peerDependencies": { + "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } } }, "node_modules/merge-stream": { @@ -13432,6 +13534,19 @@ "node": ">=6" } }, + "node_modules/mimic-response": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz", + "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==", + "dev": true, + "optional": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/min-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", @@ -13561,6 +13676,13 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "node_modules/nan": { + "version": "2.18.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz", + "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==", + "dev": true, + "optional": true + }, "node_modules/nano-css": { "version": "5.3.5", "resolved": "https://registry.npmjs.org/nano-css/-/nano-css-5.3.5.tgz", @@ -13735,6 +13857,22 @@ "ieee754": "^1.1.13" } }, + "node_modules/nopt": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "dev": true, + "optional": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/normalize-package-data": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", @@ -14250,6 +14388,16 @@ "node": ">=8" } }, + "node_modules/path2d-polyfill": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path2d-polyfill/-/path2d-polyfill-2.0.1.tgz", + "integrity": "sha512-ad/3bsalbbWhmBo0D6FZ4RNMwsLsPpL6gnvhuSaU5Vm7b06Kr5ubSltQQ0T7YKsiJQO+g22zJ4dJKNTXIyOXtA==", + "dev": true, + "optional": true, + "engines": { + "node": ">=8" + } + }, "node_modules/pathe": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.0.tgz", @@ -14273,21 +14421,16 @@ } }, "node_modules/pdfjs-dist": { - "version": "2.16.105", - "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-2.16.105.tgz", - "integrity": "sha512-J4dn41spsAwUxCpEoVf6GVoz908IAA3mYiLmNxg8J9kfRXc2jxpbUepcP0ocp0alVNLFthTAM8DZ1RaHh8sU0A==", + "version": "3.11.174", + "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-3.11.174.tgz", + "integrity": "sha512-TdTZPf1trZ8/UFu5Cx/GXB7GZM30LT+wWUNfsi6Bq8ePLnb+woNKtDymI2mxZYBpMbonNFqKmiz684DIfnd8dA==", "dev": true, - "dependencies": { - "dommatrix": "^1.0.3", - "web-streams-polyfill": "^3.2.1" - }, - "peerDependencies": { - "worker-loader": "^3.0.8" + "engines": { + "node": ">=18" }, - "peerDependenciesMeta": { - "worker-loader": { - "optional": true - } + "optionalDependencies": { + "canvas": "^2.11.2", + "path2d-polyfill": "^2.0.1" } }, "node_modules/pend": { @@ -15935,17 +16078,16 @@ } }, "node_modules/react-pdf": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/react-pdf/-/react-pdf-6.2.2.tgz", - "integrity": "sha512-huNWhzzTAb3t1mWA6WOR9yQRCbcZ6uXCGC46cEAgEhGqvXTB6RcHm+1DS2r9OdPNUZ9SZTuR6jZ1BNOJIiEing==", + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/react-pdf/-/react-pdf-7.5.1.tgz", + "integrity": "sha512-NVno97L3wfX3RLGB3C+QtroOiQrgCKPHLMFKMSQaRqDlH3gkq2CB2NyXJ+IDQNLrT/gSMPPgtZQL8cOUySc/3w==", "dev": true, "dependencies": { - "@babel/runtime": "^7.0.0", - "clsx": "^1.2.1", - "make-cancellable-promise": "^1.0.0", - "make-event-props": "^1.1.0", - "merge-refs": "^1.0.0", - "pdfjs-dist": "2.16.105", + "clsx": "^2.0.0", + "make-cancellable-promise": "^1.3.1", + "make-event-props": "^1.6.0", + "merge-refs": "^1.2.1", + "pdfjs-dist": "3.11.174", "prop-types": "^15.6.2", "tiny-invariant": "^1.0.0", "tiny-warning": "^1.0.0" @@ -15954,12 +16096,12 @@ "url": "https://github.com/wojtekmaj/react-pdf?sponsor=1" }, "peerDependencies": { - "file-loader": "^6.0.0", + "@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0", "react": "^16.8.0 || ^17.0.0 || ^18.0.0", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" }, "peerDependenciesMeta": { - "file-loader": { + "@types/react": { "optional": true } } @@ -16978,6 +17120,39 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "optional": true + }, + "node_modules/simple-get": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.1.tgz", + "integrity": "sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==", + "dev": true, + "optional": true, + "dependencies": { + "decompress-response": "^4.2.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, "node_modules/simple-update-notifier": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz", @@ -19063,15 +19238,6 @@ "node": ">=10.13.0" } }, - "node_modules/web-streams-polyfill": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", diff --git a/package.json b/package.json index 29738b59a..b19674ec3 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "prettier": "^2.8.4", "process": "^0.11.10", "prop-types": "^15.8.1", - "react-pdf": "^6.2.2", + "react-pdf": "^7.5.1", "rollup-plugin-node-polyfills": "^0.2.1", "rollup-plugin-polyfill-node": "^0.12.0", "sass": "^1.58.1", diff --git a/src/components/media-types/pdf/index.tsx b/src/components/media-types/pdf/index.tsx index afffcbf59..2de0dcbe3 100644 --- a/src/components/media-types/pdf/index.tsx +++ b/src/components/media-types/pdf/index.tsx @@ -1,8 +1,15 @@ import { memo, useMemo, useRef, useState } from 'react' import styles from '@style' -import { Document, Page } from 'react-pdf/dist/esm/entry.vite' +import { Document, Page } from 'react-pdf' import 'react-pdf/dist/esm/Page/TextLayer.css' import 'react-pdf/dist/esm/Page/AnnotationLayer.css' +import { pdfjs } from 'react-pdf'; + +pdfjs.GlobalWorkerOptions.workerSrc = new URL( + 'pdfjs-dist/build/pdf.worker.min.js', + import.meta.url, +).toString(); + import { ImageComponent } from '../image' import { Button } from '@atoms/button' From 023009f3c05d7b49dcb1a9023d3c356d863fc2de Mon Sep 17 00:00:00 2001 From: Yannick Goossens Date: Tue, 7 Nov 2023 17:18:00 +0100 Subject: [PATCH 03/12] reorder like this? --- src/components/media-types/pdf/index.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/media-types/pdf/index.tsx b/src/components/media-types/pdf/index.tsx index 2de0dcbe3..b8bb7b3f7 100644 --- a/src/components/media-types/pdf/index.tsx +++ b/src/components/media-types/pdf/index.tsx @@ -5,17 +5,17 @@ import 'react-pdf/dist/esm/Page/TextLayer.css' import 'react-pdf/dist/esm/Page/AnnotationLayer.css' import { pdfjs } from 'react-pdf'; -pdfjs.GlobalWorkerOptions.workerSrc = new URL( - 'pdfjs-dist/build/pdf.worker.min.js', - import.meta.url, -).toString(); - - import { ImageComponent } from '../image' import { Button } from '@atoms/button' import { MediaTypeProps } from '@types' // pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js` // pdfjs.GlobalWorkerOptions.workerSrc = 'pdf.worker.min.js' + +pdfjs.GlobalWorkerOptions.workerSrc = new URL( + 'pdfjs-dist/build/pdf.worker.min.js', + import.meta.url, +).toString(); + const options = { cMapUrl: 'cmaps/', cMapPacked: true, From 508c03f3826ee11c814cfed8ef2e81082bb6465c Mon Sep 17 00:00:00 2001 From: Yannick Goossens Date: Tue, 21 Nov 2023 19:30:50 +0100 Subject: [PATCH 04/12] more trial & error --- src/components/media-types/pdf/index.tsx | 44 ++++++++++++++++++------ 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/src/components/media-types/pdf/index.tsx b/src/components/media-types/pdf/index.tsx index b8bb7b3f7..57d2d9135 100644 --- a/src/components/media-types/pdf/index.tsx +++ b/src/components/media-types/pdf/index.tsx @@ -1,9 +1,8 @@ -import { memo, useMemo, useRef, useState } from 'react' +import { memo, useMemo, useRef, useState, Component } from 'react' import styles from '@style' -import { Document, Page } from 'react-pdf' +import { Document, Page, pdfjs } from 'react-pdf' import 'react-pdf/dist/esm/Page/TextLayer.css' import 'react-pdf/dist/esm/Page/AnnotationLayer.css' -import { pdfjs } from 'react-pdf'; import { ImageComponent } from '../image' import { Button } from '@atoms/button' @@ -29,7 +28,7 @@ export const PdfComponent = memo(function ({ displayView, nft, }: MediaTypeProps) { - const [numPages, setNumPages] = useState() + const [numPages, setNumPages] = useState(0) const [pageNumber, setPageNumber] = useState(1) const [loading, setLoading] = useState(displayView) const [showDocument, setShowDocument] = useState(true) @@ -45,6 +44,11 @@ export const PdfComponent = memo(function ({ [previewUri, artifactUri] ) + const cachedPage = useMemo( + () => changePage, + [pageNumber] + ) + function onDocumentLoadSuccess({ numPages }: { numPages: number }) { setNumPages(numPages) } @@ -65,6 +69,29 @@ export const PdfComponent = memo(function ({ changePage(1) } + function getPage() { + return ( + <> + +
+ console.log("caching " + (pageNumber + 1))} + /> +
+ + ) + } + // function onItemClick(item) { // setPageNumber(item.pageNumber) // } @@ -74,6 +101,7 @@ export const PdfComponent = memo(function ({ setLoading(false) setHeight(container.current?.clientHeight) } + console.log(pageNumber) } function onPassword(callback, reason) { @@ -149,13 +177,7 @@ export const PdfComponent = memo(function ({ title={`PDF object ${nft.token_id}`} options={options} > - + {getPage()} )} {!loading && showDocument && ( From 7a0053c6e8aea7c5a77d3b839714d4ae9336674f Mon Sep 17 00:00:00 2001 From: Yannick Goossens Date: Tue, 21 Nov 2023 19:47:14 +0100 Subject: [PATCH 05/12] like this? --- src/components/media-types/pdf/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/media-types/pdf/index.tsx b/src/components/media-types/pdf/index.tsx index 57d2d9135..17b9921dd 100644 --- a/src/components/media-types/pdf/index.tsx +++ b/src/components/media-types/pdf/index.tsx @@ -45,7 +45,7 @@ export const PdfComponent = memo(function ({ ) const cachedPage = useMemo( - () => changePage, + () => getPage, [pageNumber] ) @@ -177,7 +177,7 @@ export const PdfComponent = memo(function ({ title={`PDF object ${nft.token_id}`} options={options} > - {getPage()} + {cachedPage()} )} {!loading && showDocument && ( From b1587741951856c60bf2bd0c2fe4b62a0068686c Mon Sep 17 00:00:00 2001 From: melMass Date: Tue, 28 Nov 2023 19:11:14 +0100 Subject: [PATCH 06/12] =?UTF-8?q?chore=20=F0=9F=A7=B9:=20update=20lock=20f?= =?UTF-8?q?ile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 243 +++++++++++++++++++++++++--------------------- 1 file changed, 131 insertions(+), 112 deletions(-) diff --git a/package-lock.json b/package-lock.json index dc3420464..12b42f291 100644 --- a/package-lock.json +++ b/package-lock.json @@ -117,12 +117,12 @@ "dev": true }, "node_modules/@airgap/beacon-core": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@airgap/beacon-core/-/beacon-core-3.3.3.tgz", - "integrity": "sha512-rBh8Bs8b9H5QmkAAeR97zzamOFTyl54WckYW9MR0/uFv1oUIwdvM3aSlspQ2BaNkEI8AueulQM858Orj1tQWpg==", + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-core/-/beacon-core-3.3.4.tgz", + "integrity": "sha512-9LqTDXdlliC2WsDzBr6sf1Xl9iegtvyWgb7tnZvIIx9iUdd7UjKseh0FFm9bdUt8hVLd8PD516HZQxrUokymHw==", "dependencies": { - "@airgap/beacon-types": "^3.3.3", - "@airgap/beacon-utils": "^3.3.3", + "@airgap/beacon-types": "^3.3.4", + "@airgap/beacon-utils": "^3.3.4", "@stablelib/ed25519": "^1.0.3", "@stablelib/nacl": "^1.0.4", "@stablelib/utf8": "^1.0.1", @@ -131,24 +131,24 @@ } }, "node_modules/@airgap/beacon-dapp": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@airgap/beacon-dapp/-/beacon-dapp-3.3.3.tgz", - "integrity": "sha512-icF+E6Zgq/fPiIFL6Mypc7a4jW+Cq7F7/pQvCmJU3yg1+G0psiDAe8hSi/yr3yBtJF+qSlluIpwB4+L8QGdgZw==", + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-dapp/-/beacon-dapp-3.3.4.tgz", + "integrity": "sha512-fMjRFN2r3S3uZpUuc9KEIhgFoesNdNN/NRIAEInyLC9AB41Z+C9UKd/mISQwd5hJips5CWpTXnuYHnfEk4+Erw==", "dependencies": { - "@airgap/beacon-core": "^3.3.3", - "@airgap/beacon-transport-matrix": "^3.3.3", - "@airgap/beacon-transport-postmessage": "^3.3.3", - "@airgap/beacon-ui": "^3.3.3", + "@airgap/beacon-core": "^3.3.4", + "@airgap/beacon-transport-matrix": "^3.3.4", + "@airgap/beacon-transport-postmessage": "^3.3.4", + "@airgap/beacon-ui": "^3.3.4", "qrcode-generator": "1.4.4" } }, "node_modules/@airgap/beacon-transport-matrix": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-matrix/-/beacon-transport-matrix-3.3.3.tgz", - "integrity": "sha512-j2hqMtVpV+d+HHFChuBEuXl38aXz1wAS3OS3RQCwyLsJRlEQRjM8dKvlcsVxT4p3KAeY9uIhhsHaNZgmebrLOg==", + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-matrix/-/beacon-transport-matrix-3.3.4.tgz", + "integrity": "sha512-bxTBFXcgKyP/n+yMSoL6L/3C4ZVso1DxK5XGxcOvOLLenA67wh4TnPMBasWzBi13BbMAVhiExuNNTWaytamgcw==", "dependencies": { - "@airgap/beacon-core": "^3.3.3", - "@airgap/beacon-utils": "^3.3.3", + "@airgap/beacon-core": "^3.3.4", + "@airgap/beacon-utils": "^3.3.4", "axios": "0.24.0" } }, @@ -161,13 +161,13 @@ } }, "node_modules/@airgap/beacon-transport-postmessage": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-postmessage/-/beacon-transport-postmessage-3.3.3.tgz", - "integrity": "sha512-Y6/EOQt4AuNP4i8/3/8sUsS5ay3OJ/F0quF6l3zIP4vqyFjEQuFPJoSWA1K/vA44YwnkDLh7viRdS/emutTjlg==", + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-postmessage/-/beacon-transport-postmessage-3.3.4.tgz", + "integrity": "sha512-Tlf8Tr7f1nzZOX8ag8aR9UBkxR9stTJXRBSrouQ0Ex8JIPHkrV6Noz+Xg7lziwUlbaJ7ukbElKHrXh17+iIjQQ==", "dependencies": { - "@airgap/beacon-core": "^3.3.3", - "@airgap/beacon-types": "^3.3.3", - "@airgap/beacon-utils": "^3.3.3" + "@airgap/beacon-core": "^3.3.4", + "@airgap/beacon-types": "^3.3.4", + "@airgap/beacon-utils": "^3.3.4" } }, "node_modules/@airgap/beacon-types": { @@ -179,20 +179,20 @@ } }, "node_modules/@airgap/beacon-ui": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@airgap/beacon-ui/-/beacon-ui-3.3.3.tgz", - "integrity": "sha512-HkCBD/04ZZJGs4PUrBMIvVg/Z2D3BEa9KmyesLFTW4z84mnOJNgSNbc8Qevhv1yzhnIvUMsT7Gcuy1xZwWZ1uA==", + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-ui/-/beacon-ui-3.3.4.tgz", + "integrity": "sha512-/J2r0wbH6xWHoni9HFF0ojrQaGKicRQZf3XTz2deI+x9glXJ2RC6J1V6uzIyUHfsgJwpe0vz6COzYA0wVdnUCw==", "dependencies": { - "@airgap/beacon-core": "^3.3.3", - "@airgap/beacon-transport-postmessage": "^3.3.3", - "@airgap/beacon-types": "^3.3.3", - "@airgap/beacon-utils": "^3.3.3" + "@airgap/beacon-core": "^3.3.4", + "@airgap/beacon-transport-postmessage": "^3.3.4", + "@airgap/beacon-types": "^3.3.4", + "@airgap/beacon-utils": "^3.3.4" } }, "node_modules/@airgap/beacon-utils": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@airgap/beacon-utils/-/beacon-utils-3.3.3.tgz", - "integrity": "sha512-IyvDC59POue/idTt5tV4abvSEqibtzGhoeGCI45oJ88n3F4/d6Lx6pr/9sSNEJe7Ue+T6Fmb9ATYCBRAZ2xh7g==", + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@airgap/beacon-utils/-/beacon-utils-3.3.4.tgz", + "integrity": "sha512-jxcbq5AbQU8eD4WnloTwvt5//kVjOW43yv+dznzpI+wZmYagOljPb8L/E93zuMhrXxP6plijD+Dn68RhLzfUSg==", "dependencies": { "@stablelib/nacl": "^1.0.3", "@stablelib/random": "^1.0.2", @@ -225,11 +225,12 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.4.tgz", + "integrity": "sha512-r1IONyb6Ia+jYR2vvIDhdWdlTGhqbBoFqLTQidzZ4kepUFH15ejXvFHxCVbtl7BOXIudsIubf4E81xeA3h3IXA==", "dependencies": { - "@babel/highlight": "^7.18.6" + "@babel/highlight": "^7.23.4", + "chalk": "^2.4.2" }, "engines": { "node": ">=6.9.0" @@ -300,12 +301,13 @@ } }, "node_modules/@babel/generator": { - "version": "7.20.14", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.20.14.tgz", - "integrity": "sha512-AEmuXHdcD3A52HHXxaTmYlb8q/xMEhoRP67B3T4Oq7lbmSoqroMZzjnGj3+i1io3pdnF8iBYVu4Ilj+c4hBxYg==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.4.tgz", + "integrity": "sha512-esuS49Cga3HcThFNebGhlgsrVLkvhqvYDTzgjfFFlHJcIfLe5jFmRRfCQ1KuBfc4Jrtn3ndLgKWAKjBE+IraYQ==", "dependencies": { - "@babel/types": "^7.20.7", + "@babel/types": "^7.23.4", "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" }, "engines": { @@ -424,9 +426,9 @@ } }, "node_modules/@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", "engines": { "node": ">=6.9.0" } @@ -444,23 +446,23 @@ } }, "node_modules/@babel/helper-function-name": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz", - "integrity": "sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dependencies": { - "@babel/template": "^7.18.10", - "@babel/types": "^7.19.0" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" }, "engines": { "node": ">=6.9.0" @@ -586,28 +588,28 @@ } }, "node_modules/@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-string-parser": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", - "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", + "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "engines": { "node": ">=6.9.0" } @@ -649,12 +651,12 @@ } }, "node_modules/@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", + "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", "dependencies": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", "js-tokens": "^4.0.0" }, "engines": { @@ -662,9 +664,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.20.15", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.15.tgz", - "integrity": "sha512-DI4a1oZuf8wC+oAJA9RW6ga3Zbe8RZFt7kD9i4qAspz3I/yHet1VvC3DiSy/fsUvv5pvJuNPh0LPOdCcqinDPg==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.4.tgz", + "integrity": "sha512-vf3Xna6UEprW+7t6EtOmFpHNAuxw3xqPZghy+brsnusscJRW5BMUzzHZc5ICjULee81WeUV2jjakG09MDglJXQ==", "bin": { "parser": "bin/babel-parser.js" }, @@ -2183,31 +2185,31 @@ } }, "node_modules/@babel/template": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", - "integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7" + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.20.13", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.20.13.tgz", - "integrity": "sha512-kMJXfF0T6DIS9E8cgdLCSAL+cuCK+YEZHWiLK0SXpTo8YRj5lpJu3CDNKiIBCne4m9hhTIqUg6SYTAI39tAiVQ==", - "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.20.7", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.19.0", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.20.13", - "@babel/types": "^7.20.7", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.4.tgz", + "integrity": "sha512-IYM8wSUwunWTB6tFC2dkKZhxbIjHoWemdK+3f8/wq8aKhbUscxD5MX72ubd90fxvFknaLPeGw5ycU84V1obHJg==", + "dependencies": { + "@babel/code-frame": "^7.23.4", + "@babel/generator": "^7.23.4", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.23.4", + "@babel/types": "^7.23.4", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -2216,12 +2218,12 @@ } }, "node_modules/@babel/types": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.20.7.tgz", - "integrity": "sha512-69OnhBxSSgK0OzTJai4kyPDiKTIe3j+ctaHdIGVbRahTLAT7L3R9oeXHC2aVSuGYt3cVnoAMDmOCgJ2yaiLMvg==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.4.tgz", + "integrity": "sha512-7uIFwVYpoplT5jp/kVv6EF93VaJ8H+Yn5IczYiaAi98ajzjfoZfslet/e0sLh+wVBjb2qqIut1b0S26VSafsSQ==", "dependencies": { - "@babel/helper-string-parser": "^7.19.4", - "@babel/helper-validator-identifier": "^7.19.1", + "@babel/helper-string-parser": "^7.23.4", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" }, "engines": { @@ -7505,20 +7507,23 @@ "dev": true }, "node_modules/browserify-sign": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", - "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.2.tgz", + "integrity": "sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg==", "dev": true, "dependencies": { - "bn.js": "^5.1.1", - "browserify-rsa": "^4.0.1", + "bn.js": "^5.2.1", + "browserify-rsa": "^4.1.0", "create-hash": "^1.2.0", "create-hmac": "^1.1.7", - "elliptic": "^6.5.3", + "elliptic": "^6.5.4", "inherits": "^2.0.4", - "parse-asn1": "^5.1.5", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" + "parse-asn1": "^5.1.6", + "readable-stream": "^3.6.2", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 4" } }, "node_modules/browserify-sign/node_modules/bn.js": { @@ -10665,6 +10670,20 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -11016,9 +11035,9 @@ "dev": true }, "node_modules/graphql": { - "version": "16.6.0", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.6.0.tgz", - "integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==", + "version": "16.8.1", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.8.1.tgz", + "integrity": "sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==", "engines": { "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" } @@ -14511,9 +14530,9 @@ } }, "node_modules/postcss": { - "version": "8.4.26", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.26.tgz", - "integrity": "sha512-jrXHFF8iTloAenySjM/ob3gSj7pCu0Ji49hnjqzsgSRa50hkWCKD0HQ+gMNJkW38jBI68MpAAg7ZWwHwX8NMMw==", + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", "dev": true, "funding": [ { @@ -16376,9 +16395,9 @@ } }, "node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", From e1b41fe48429429c941d97233a222c21d6932d88 Mon Sep 17 00:00:00 2001 From: melMass Date: Tue, 28 Nov 2023 19:15:30 +0100 Subject: [PATCH 07/12] =?UTF-8?q?chore=20=F0=9F=A7=B9:=20update=20lockfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit we might have updated deps in main since --- package-lock.json | 119 +++++++++++++++++++++++++++++++--------------- 1 file changed, 80 insertions(+), 39 deletions(-) diff --git a/package-lock.json b/package-lock.json index ec7618c12..476529ba5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -117,12 +117,12 @@ "dev": true }, "node_modules/@airgap/beacon-core": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/@airgap/beacon-core/-/beacon-core-3.3.4.tgz", - "integrity": "sha512-9LqTDXdlliC2WsDzBr6sf1Xl9iegtvyWgb7tnZvIIx9iUdd7UjKseh0FFm9bdUt8hVLd8PD516HZQxrUokymHw==", + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/@airgap/beacon-core/-/beacon-core-4.0.12.tgz", + "integrity": "sha512-Hg2xMug9mR0EdNuCfwrpHiQJlNzyJpFxqZdWsMEkQQ/AA9kdUGVAVV0BSb5GiJ7R1t3WE1pTr9+WrYm5O/xzJg==", "dependencies": { - "@airgap/beacon-types": "^3.3.4", - "@airgap/beacon-utils": "^3.3.4", + "@airgap/beacon-types": "4.0.12", + "@airgap/beacon-utils": "4.0.12", "@stablelib/ed25519": "^1.0.3", "@stablelib/nacl": "^1.0.4", "@stablelib/utf8": "^1.0.1", @@ -130,25 +130,33 @@ "bs58check": "2.1.2" } }, + "node_modules/@airgap/beacon-core/node_modules/@airgap/beacon-types": { + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/@airgap/beacon-types/-/beacon-types-4.0.12.tgz", + "integrity": "sha512-O2UurvlPvIYahcM5/17XxrTryLciZvIY1jRqx1QCdSo5nouCGYOSbMAVBFKeyClekVNZrHdvgUbWTYLWL7Dv9w==", + "dependencies": { + "@types/chrome": "0.0.163" + } + }, "node_modules/@airgap/beacon-dapp": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/@airgap/beacon-dapp/-/beacon-dapp-3.3.4.tgz", - "integrity": "sha512-fMjRFN2r3S3uZpUuc9KEIhgFoesNdNN/NRIAEInyLC9AB41Z+C9UKd/mISQwd5hJips5CWpTXnuYHnfEk4+Erw==", + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/@airgap/beacon-dapp/-/beacon-dapp-4.0.12.tgz", + "integrity": "sha512-UvkyctEqUx75W310YsQX9YVDf88tDdb4JRkkq98YoDyPLHJMncCXiXbYS5XfRk98Cc/gsKqWCyYJAo/xPqAPxQ==", "dependencies": { - "@airgap/beacon-core": "^3.3.4", - "@airgap/beacon-transport-matrix": "^3.3.4", - "@airgap/beacon-transport-postmessage": "^3.3.4", - "@airgap/beacon-ui": "^3.3.4", - "qrcode-generator": "1.4.4" + "@airgap/beacon-core": "4.0.12", + "@airgap/beacon-transport-matrix": "4.0.12", + "@airgap/beacon-transport-postmessage": "4.0.12", + "@airgap/beacon-transport-walletconnect": "4.0.12", + "@airgap/beacon-ui": "4.0.12" } }, "node_modules/@airgap/beacon-transport-matrix": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-matrix/-/beacon-transport-matrix-3.3.4.tgz", - "integrity": "sha512-bxTBFXcgKyP/n+yMSoL6L/3C4ZVso1DxK5XGxcOvOLLenA67wh4TnPMBasWzBi13BbMAVhiExuNNTWaytamgcw==", + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-matrix/-/beacon-transport-matrix-4.0.12.tgz", + "integrity": "sha512-BiTl8l0WQ1Hmtvw48HU0b43Vihm3I1J0H4mbV6PSrkPXMgwCitYg730sEdbyLiWx3yGcnf2Egbmt9RGDifE4HQ==", "dependencies": { - "@airgap/beacon-core": "^3.3.4", - "@airgap/beacon-utils": "^3.3.4", + "@airgap/beacon-core": "4.0.12", + "@airgap/beacon-utils": "4.0.12", "axios": "0.24.0" } }, @@ -161,13 +169,40 @@ } }, "node_modules/@airgap/beacon-transport-postmessage": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-postmessage/-/beacon-transport-postmessage-3.3.4.tgz", - "integrity": "sha512-Tlf8Tr7f1nzZOX8ag8aR9UBkxR9stTJXRBSrouQ0Ex8JIPHkrV6Noz+Xg7lziwUlbaJ7ukbElKHrXh17+iIjQQ==", + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-postmessage/-/beacon-transport-postmessage-4.0.12.tgz", + "integrity": "sha512-pHZJW5wHKLWiaUNpCBDUnHgyDZZIuZiDR0RDwmlN7VTbUzDukN/BJeCtWcEWSPhb3OpkvtMgeXIBG579hHgMaQ==", + "dependencies": { + "@airgap/beacon-core": "4.0.12", + "@airgap/beacon-types": "4.0.12", + "@airgap/beacon-utils": "4.0.12" + } + }, + "node_modules/@airgap/beacon-transport-postmessage/node_modules/@airgap/beacon-types": { + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/@airgap/beacon-types/-/beacon-types-4.0.12.tgz", + "integrity": "sha512-O2UurvlPvIYahcM5/17XxrTryLciZvIY1jRqx1QCdSo5nouCGYOSbMAVBFKeyClekVNZrHdvgUbWTYLWL7Dv9w==", + "dependencies": { + "@types/chrome": "0.0.163" + } + }, + "node_modules/@airgap/beacon-transport-walletconnect": { + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/@airgap/beacon-transport-walletconnect/-/beacon-transport-walletconnect-4.0.12.tgz", + "integrity": "sha512-1lRIrmJ1gAwUNskTy8GzLCWxPabCdWmf5fJoajHcLz9Sir0BmQYD13JMEHJ2uw43UuetVU8KaFd2KNtU/JLPMg==", "dependencies": { - "@airgap/beacon-core": "^3.3.4", - "@airgap/beacon-types": "^3.3.4", - "@airgap/beacon-utils": "^3.3.4" + "@airgap/beacon-core": "4.0.12", + "@airgap/beacon-types": "4.0.12", + "@airgap/beacon-utils": "4.0.12", + "@walletconnect/sign-client": "2.7.0" + } + }, + "node_modules/@airgap/beacon-transport-walletconnect/node_modules/@airgap/beacon-types": { + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/@airgap/beacon-types/-/beacon-types-4.0.12.tgz", + "integrity": "sha512-O2UurvlPvIYahcM5/17XxrTryLciZvIY1jRqx1QCdSo5nouCGYOSbMAVBFKeyClekVNZrHdvgUbWTYLWL7Dv9w==", + "dependencies": { + "@types/chrome": "0.0.163" } }, "node_modules/@airgap/beacon-types": { @@ -180,20 +215,30 @@ } }, "node_modules/@airgap/beacon-ui": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/@airgap/beacon-ui/-/beacon-ui-3.3.4.tgz", - "integrity": "sha512-/J2r0wbH6xWHoni9HFF0ojrQaGKicRQZf3XTz2deI+x9glXJ2RC6J1V6uzIyUHfsgJwpe0vz6COzYA0wVdnUCw==", + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/@airgap/beacon-ui/-/beacon-ui-4.0.12.tgz", + "integrity": "sha512-mF0lIx1r3Nc0OyHLhTX2Gg1MR9atRYZKz1cA3PQ+2c5Abvkr5no49kXSxCsOh2/5tEIW7mUzrNblqYp+ed/QMg==", + "dependencies": { + "@airgap/beacon-core": "4.0.12", + "@airgap/beacon-transport-postmessage": "4.0.12", + "@airgap/beacon-types": "4.0.12", + "@airgap/beacon-utils": "4.0.12", + "qrcode-svg": "^1.1.0", + "solid-js": "^1.6.6" + } + }, + "node_modules/@airgap/beacon-ui/node_modules/@airgap/beacon-types": { + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/@airgap/beacon-types/-/beacon-types-4.0.12.tgz", + "integrity": "sha512-O2UurvlPvIYahcM5/17XxrTryLciZvIY1jRqx1QCdSo5nouCGYOSbMAVBFKeyClekVNZrHdvgUbWTYLWL7Dv9w==", "dependencies": { - "@airgap/beacon-core": "^3.3.4", - "@airgap/beacon-transport-postmessage": "^3.3.4", - "@airgap/beacon-types": "^3.3.4", - "@airgap/beacon-utils": "^3.3.4" + "@types/chrome": "0.0.163" } }, "node_modules/@airgap/beacon-utils": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/@airgap/beacon-utils/-/beacon-utils-3.3.4.tgz", - "integrity": "sha512-jxcbq5AbQU8eD4WnloTwvt5//kVjOW43yv+dznzpI+wZmYagOljPb8L/E93zuMhrXxP6plijD+Dn68RhLzfUSg==", + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/@airgap/beacon-utils/-/beacon-utils-4.0.12.tgz", + "integrity": "sha512-Djki1/CcJRhp8RhQhPAAY6oHATqJ1rsowTriRg4aAMEVqqaq3rvAbebVHgvjNMQdF2gtGJgnX4adQFLLNCAFrg==", "dependencies": { "@stablelib/ed25519": "^1.0.3", "@stablelib/nacl": "^1.0.3", @@ -9640,8 +9685,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", - "dev": true, - "optional": true, "engines": { "node": ">=8" } @@ -11478,7 +11521,6 @@ "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -18211,8 +18253,7 @@ "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, "node_modules/simple-concat": { "version": "1.0.1", From 669d1f1a47a767d2e03133cecc93a753bc58ba35 Mon Sep 17 00:00:00 2001 From: melMass Date: Tue, 28 Nov 2023 19:17:21 +0100 Subject: [PATCH 08/12] =?UTF-8?q?chore=20=F0=9F=A7=B9:=20...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bruh --- package-lock.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/package-lock.json b/package-lock.json index 476529ba5..408740261 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3792,6 +3792,17 @@ "url": "https://opencollective.com/parcel" } }, + "node_modules/@parcel/watcher/node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/@playwright/test": { "version": "1.30.0", "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.30.0.tgz", @@ -9487,6 +9498,14 @@ "node": ">=0.10.0" } }, + "node_modules/decode-uri-component": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", + "engines": { + "node": ">=0.10" + } + }, "node_modules/decompress-response": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", @@ -9685,6 +9704,8 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", + "dev": true, + "optional": true, "engines": { "node": ">=8" } @@ -14680,6 +14701,11 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "node_modules/multiformats": { + "version": "9.9.0", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz", + "integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg==" + }, "node_modules/nan": { "version": "2.18.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz", From 027305c9e9f3eb5e89307b7e0ec68b495258e3e1 Mon Sep 17 00:00:00 2001 From: Yannick Goossens Date: Sun, 3 Dec 2023 17:10:53 +0100 Subject: [PATCH 09/12] POC with pdf iframe setup --- .env | 1 + src/components/media-types/html/index.jsx | 5 +- .../media-types/pdf/index.module.scss | 39 ---- src/components/media-types/pdf/index.tsx | 201 +----------------- src/components/media-types/vector/index.jsx | 2 +- 5 files changed, 13 insertions(+), 235 deletions(-) delete mode 100644 src/components/media-types/pdf/index.module.scss diff --git a/.env b/.env index 133b8fb42..6d8a3b1f0 100644 --- a/.env +++ b/.env @@ -18,3 +18,4 @@ VITE_IPFS_UPLOAD_PROXY='https://ipfsproxy.teia.rocks' VITE_IPFS_DEFAULT_GATEWAY='CDN' VITE_TEZOS_RPC='https://mainnet.teia.rocks' +VITE_IFRAME_URL='https://iframe.teia.art' diff --git a/src/components/media-types/html/index.jsx b/src/components/media-types/html/index.jsx index d2e886718..eb7ae458b 100644 --- a/src/components/media-types/html/index.jsx +++ b/src/components/media-types/html/index.jsx @@ -122,7 +122,10 @@ export const HTMLComponent = (props) => {