From 61df9f65f961f372685120eb66a3b3b4ee54e282 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Wed, 22 Nov 2023 20:43:51 +0100 Subject: [PATCH] [client] Move timeline to vue-virtual-scroller --- .pnp.cjs | 79 ++++++++ .../mitt-npm-2.1.0-77f3c96db4-d4087f8678.zip | 3 + ...pm-2.0.0-alpha.1-2336a276e1-251948d4bd.zip | 3 + ...pm-2.0.0-alpha.1-b3eb21b45c-d6e66472cd.zip | 3 + ...npm-2.0.0-beta.8-02cf134969-78047d2281.zip | 3 + packages/client/package.json | 1 + .../src/components/MkImgWithBlurhash.vue | 1 + packages/client/src/components/MkMention.vue | 2 +- packages/client/src/components/MkNotes.vue | 122 +++++++++--- .../client/src/components/MkPagination.vue | 15 +- .../client/src/components/MkUrlPreview.vue | 187 +++++++++--------- .../client/src/components/global/MkAvatar.vue | 4 +- .../client/src/components/global/MkEmoji.vue | 2 + yarn.lock | 39 ++++ 14 files changed, 335 insertions(+), 129 deletions(-) create mode 100644 .yarn/cache/mitt-npm-2.1.0-77f3c96db4-d4087f8678.zip create mode 100644 .yarn/cache/vue-observe-visibility-npm-2.0.0-alpha.1-2336a276e1-251948d4bd.zip create mode 100644 .yarn/cache/vue-resize-npm-2.0.0-alpha.1-b3eb21b45c-d6e66472cd.zip create mode 100644 .yarn/cache/vue-virtual-scroller-npm-2.0.0-beta.8-02cf134969-78047d2281.zip diff --git a/.pnp.cjs b/.pnp.cjs index 60165bf75..f119c00c1 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -8446,6 +8446,7 @@ const RAW_RUNTIME_STATE = ["vue-isyourpasswordsafe", "npm:2.0.0"],\ ["vue-plyr", "npm:7.0.0"],\ ["vue-prism-editor", "virtual:658502eb4296e93abedc18b6aa9b26978f434f08d98e21ebb0e725354b8bb54b62db9c4a1893e460c694ff7500ff5cbafa4457b0dfd26b5838868666c861e990#npm:2.0.0-alpha.2"],\ + ["vue-virtual-scroller", "virtual:658502eb4296e93abedc18b6aa9b26978f434f08d98e21ebb0e725354b8bb54b62db9c4a1893e460c694ff7500ff5cbafa4457b0dfd26b5838868666c861e990#npm:2.0.0-beta.8"],\ ["vuedraggable", "virtual:658502eb4296e93abedc18b6aa9b26978f434f08d98e21ebb0e725354b8bb54b62db9c4a1893e460c694ff7500ff5cbafa4457b0dfd26b5838868666c861e990#npm:4.1.0"]\ ],\ "linkType": "SOFT"\ @@ -17837,6 +17838,15 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ + ["mitt", [\ + ["npm:2.1.0", {\ + "packageLocation": "./.yarn/cache/mitt-npm-2.1.0-77f3c96db4-d4087f8678.zip/node_modules/mitt/",\ + "packageDependencies": [\ + ["mitt", "npm:2.1.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["mixin-deep", [\ ["npm:1.3.2", {\ "packageLocation": "./.yarn/cache/mixin-deep-npm-1.3.2-29b528e571-820d5a51fc.zip/node_modules/mixin-deep/",\ @@ -24912,6 +24922,28 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ + ["vue-observe-visibility", [\ + ["npm:2.0.0-alpha.1", {\ + "packageLocation": "./.yarn/cache/vue-observe-visibility-npm-2.0.0-alpha.1-2336a276e1-251948d4bd.zip/node_modules/vue-observe-visibility/",\ + "packageDependencies": [\ + ["vue-observe-visibility", "npm:2.0.0-alpha.1"]\ + ],\ + "linkType": "SOFT"\ + }],\ + ["virtual:1ff70a214f776664ffdd69e6c80dedbacd96b8cdab401980bd5ea13591b1cea0033ea9ca782fc6be0c2a7cbd792aa0bd2ba47d82b6b45a27a55d439ae67b26e0#npm:2.0.0-alpha.1", {\ + "packageLocation": "./.yarn/__virtual__/vue-observe-visibility-virtual-38a3aa5843/0/cache/vue-observe-visibility-npm-2.0.0-alpha.1-2336a276e1-251948d4bd.zip/node_modules/vue-observe-visibility/",\ + "packageDependencies": [\ + ["vue-observe-visibility", "virtual:1ff70a214f776664ffdd69e6c80dedbacd96b8cdab401980bd5ea13591b1cea0033ea9ca782fc6be0c2a7cbd792aa0bd2ba47d82b6b45a27a55d439ae67b26e0#npm:2.0.0-alpha.1"],\ + ["@types/vue", null],\ + ["vue", "npm:3.3.4"]\ + ],\ + "packagePeers": [\ + "@types/vue",\ + "vue"\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["vue-plyr", [\ ["npm:7.0.0", {\ "packageLocation": "./.yarn/cache/vue-plyr-npm-7.0.0-aab8325658-09f1cdd290.zip/node_modules/vue-plyr/",\ @@ -24945,6 +24977,53 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ + ["vue-resize", [\ + ["npm:2.0.0-alpha.1", {\ + "packageLocation": "./.yarn/cache/vue-resize-npm-2.0.0-alpha.1-b3eb21b45c-d6e66472cd.zip/node_modules/vue-resize/",\ + "packageDependencies": [\ + ["vue-resize", "npm:2.0.0-alpha.1"]\ + ],\ + "linkType": "SOFT"\ + }],\ + ["virtual:1ff70a214f776664ffdd69e6c80dedbacd96b8cdab401980bd5ea13591b1cea0033ea9ca782fc6be0c2a7cbd792aa0bd2ba47d82b6b45a27a55d439ae67b26e0#npm:2.0.0-alpha.1", {\ + "packageLocation": "./.yarn/__virtual__/vue-resize-virtual-7d46fa71e5/0/cache/vue-resize-npm-2.0.0-alpha.1-b3eb21b45c-d6e66472cd.zip/node_modules/vue-resize/",\ + "packageDependencies": [\ + ["vue-resize", "virtual:1ff70a214f776664ffdd69e6c80dedbacd96b8cdab401980bd5ea13591b1cea0033ea9ca782fc6be0c2a7cbd792aa0bd2ba47d82b6b45a27a55d439ae67b26e0#npm:2.0.0-alpha.1"],\ + ["@types/vue", null],\ + ["vue", "npm:3.3.4"]\ + ],\ + "packagePeers": [\ + "@types/vue",\ + "vue"\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ + ["vue-virtual-scroller", [\ + ["npm:2.0.0-beta.8", {\ + "packageLocation": "./.yarn/cache/vue-virtual-scroller-npm-2.0.0-beta.8-02cf134969-78047d2281.zip/node_modules/vue-virtual-scroller/",\ + "packageDependencies": [\ + ["vue-virtual-scroller", "npm:2.0.0-beta.8"]\ + ],\ + "linkType": "SOFT"\ + }],\ + ["virtual:658502eb4296e93abedc18b6aa9b26978f434f08d98e21ebb0e725354b8bb54b62db9c4a1893e460c694ff7500ff5cbafa4457b0dfd26b5838868666c861e990#npm:2.0.0-beta.8", {\ + "packageLocation": "./.yarn/__virtual__/vue-virtual-scroller-virtual-1ff70a214f/0/cache/vue-virtual-scroller-npm-2.0.0-beta.8-02cf134969-78047d2281.zip/node_modules/vue-virtual-scroller/",\ + "packageDependencies": [\ + ["vue-virtual-scroller", "virtual:658502eb4296e93abedc18b6aa9b26978f434f08d98e21ebb0e725354b8bb54b62db9c4a1893e460c694ff7500ff5cbafa4457b0dfd26b5838868666c861e990#npm:2.0.0-beta.8"],\ + ["@types/vue", null],\ + ["mitt", "npm:2.1.0"],\ + ["vue", "npm:3.3.4"],\ + ["vue-observe-visibility", "virtual:1ff70a214f776664ffdd69e6c80dedbacd96b8cdab401980bd5ea13591b1cea0033ea9ca782fc6be0c2a7cbd792aa0bd2ba47d82b6b45a27a55d439ae67b26e0#npm:2.0.0-alpha.1"],\ + ["vue-resize", "virtual:1ff70a214f776664ffdd69e6c80dedbacd96b8cdab401980bd5ea13591b1cea0033ea9ca782fc6be0c2a7cbd792aa0bd2ba47d82b6b45a27a55d439ae67b26e0#npm:2.0.0-alpha.1"]\ + ],\ + "packagePeers": [\ + "@types/vue",\ + "vue"\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["vuedraggable", [\ ["npm:4.1.0", {\ "packageLocation": "./.yarn/cache/vuedraggable-npm-4.1.0-785593d488-87d4faba83.zip/node_modules/vuedraggable/",\ diff --git a/.yarn/cache/mitt-npm-2.1.0-77f3c96db4-d4087f8678.zip b/.yarn/cache/mitt-npm-2.1.0-77f3c96db4-d4087f8678.zip new file mode 100644 index 000000000..eb1c1d82f --- /dev/null +++ b/.yarn/cache/mitt-npm-2.1.0-77f3c96db4-d4087f8678.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:efc6e63e060c8dd03b365bb9bdc0ebc016cb56e7132c038fbc433db8322fbdca +size 12659 diff --git a/.yarn/cache/vue-observe-visibility-npm-2.0.0-alpha.1-2336a276e1-251948d4bd.zip b/.yarn/cache/vue-observe-visibility-npm-2.0.0-alpha.1-2336a276e1-251948d4bd.zip new file mode 100644 index 000000000..07fae99e3 --- /dev/null +++ b/.yarn/cache/vue-observe-visibility-npm-2.0.0-alpha.1-2336a276e1-251948d4bd.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9d81c9139b7d0d8ffbd9689c5b215f2cb7fde89c74dcab4b01f42b41502deba +size 72409 diff --git a/.yarn/cache/vue-resize-npm-2.0.0-alpha.1-b3eb21b45c-d6e66472cd.zip b/.yarn/cache/vue-resize-npm-2.0.0-alpha.1-b3eb21b45c-d6e66472cd.zip new file mode 100644 index 000000000..f81eb6a2e --- /dev/null +++ b/.yarn/cache/vue-resize-npm-2.0.0-alpha.1-b3eb21b45c-d6e66472cd.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59a3cc492a00a11c3ade579bdd24b84a2405f486ddd451cab17d4ceb5bb2249e +size 20411 diff --git a/.yarn/cache/vue-virtual-scroller-npm-2.0.0-beta.8-02cf134969-78047d2281.zip b/.yarn/cache/vue-virtual-scroller-npm-2.0.0-beta.8-02cf134969-78047d2281.zip new file mode 100644 index 000000000..219db735a --- /dev/null +++ b/.yarn/cache/vue-virtual-scroller-npm-2.0.0-beta.8-02cf134969-78047d2281.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68ccd79527ab0af40531a33fdb9492e4c02c05d0bdd0b90b644e4d2a1462d0c4 +size 110334 diff --git a/packages/client/package.json b/packages/client/package.json index be1b232d5..b80d40b1b 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -98,6 +98,7 @@ "vue-isyourpasswordsafe": "^2.0.0", "vue-plyr": "^7.0.0", "vue-prism-editor": "2.0.0-alpha.2", + "vue-virtual-scroller": "next", "vuedraggable": "next" }, "dependencies": { diff --git a/packages/client/src/components/MkImgWithBlurhash.vue b/packages/client/src/components/MkImgWithBlurhash.vue index 5a0cefec2..791151418 100644 --- a/packages/client/src/components/MkImgWithBlurhash.vue +++ b/packages/client/src/components/MkImgWithBlurhash.vue @@ -15,6 +15,7 @@ :class="{ cover }" :style="{ 'object-fit': cover ? 'cover' : null }" loading="lazy" + decoding="async" @load="onLoad" /> diff --git a/packages/client/src/components/MkMention.vue b/packages/client/src/components/MkMention.vue index 59e0fb92e..dbbe9ea49 100644 --- a/packages/client/src/components/MkMention.vue +++ b/packages/client/src/components/MkMention.vue @@ -7,7 +7,7 @@ :to="url" @click.stop > - + @{{ username }} @@ -37,11 +46,12 @@ import { ref } from "vue"; import type { Paging } from "@/components/MkPagination.vue"; import XNote from "@/components/MkNote.vue"; -import XList from "@/components/MkDateSeparatedList.vue"; import MkPagination from "@/components/MkPagination.vue"; import { i18n } from "@/i18n"; import { scroll } from "@/scripts/scroll"; -import {instance} from "@/instance"; +import { instance } from "@/instance"; +import { DynamicScroller, DynamicScrollerItem } from 'vue-virtual-scroller' +import 'vue-virtual-scroller/dist/vue-virtual-scroller.css' const tlEl = ref(); @@ -60,21 +70,89 @@ defineExpose({ pagingComponent, scrollTop, }); + +setInterval(() => { + if (!tlEl.value) return; + const viewport = document.documentElement.clientHeight; + const left = document.documentElement.scrollHeight - document.documentElement.scrollTop; + if (left <= viewport * 3) pagingComponent.value.fetchMore(); +}, 100);