From 9744ece0a823c866ca240db7ed88567310e30954 Mon Sep 17 00:00:00 2001 From: qwqcode Date: Wed, 19 Jun 2024 21:23:36 +0800 Subject: [PATCH] fix(plugin_lightbox): fix lightbox plugin import for non-browser env --- docs/docs/.vitepress/config.ts | 27 -- docs/docs/.vitepress/theme/Artalk.vue | 29 +- docs/docs/guide/frontend/lightbox.md | 48 +-- docs/docs/package.json | 3 + pnpm-lock.yaml | 425 +++++++------------------- ui/plugin-lightbox/index.html | 76 ----- ui/plugin-lightbox/main.ts | 85 ------ ui/plugin-lightbox/package.json | 52 +++- ui/plugin-lightbox/src/helper.ts | 35 +++ ui/plugin-lightbox/src/main.ts | 109 +++++++ ui/plugin-lightbox/tsconfig.json | 3 +- ui/plugin-lightbox/vite.config.ts | 25 +- 12 files changed, 342 insertions(+), 575 deletions(-) delete mode 100644 ui/plugin-lightbox/index.html delete mode 100644 ui/plugin-lightbox/main.ts create mode 100644 ui/plugin-lightbox/src/helper.ts create mode 100644 ui/plugin-lightbox/src/main.ts diff --git a/docs/docs/.vitepress/config.ts b/docs/docs/.vitepress/config.ts index 05ba50a0b..7d5357edc 100644 --- a/docs/docs/.vitepress/config.ts +++ b/docs/docs/.vitepress/config.ts @@ -17,29 +17,6 @@ export default defineConfig({ 'width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi', }, ], - // light gallery - [ - 'link', - { - href: 'https://cdnjs.cloudflare.com/ajax/libs/lightgallery/2.3.0/css/lightgallery.css', - rel: 'stylesheet', - }, - ], - [ - 'script', - { - src: 'https://cdnjs.cloudflare.com/ajax/libs/lightgallery/2.3.0/lightgallery.min.js', - }, - ], - // katex - [ - 'link', - { - href: 'https://unpkg.com/katex@0.15.3/dist/katex.min.css', - rel: 'stylesheet', - }, - ], - ['script', { src: 'https://unpkg.com/katex@0.15.3/dist/katex.min.js' }], ], lastUpdated: true, @@ -168,10 +145,6 @@ export default defineConfig({ text: 'HTTP API', link: 'https://artalk.js.org/http-api.html', }, - { - text: '贡献指南', - link: 'https://github.com/ArtalkJS/Artalk/blob/master/CONTRIBUTING.md', - }, ], }, ], diff --git a/docs/docs/.vitepress/theme/Artalk.vue b/docs/docs/.vitepress/theme/Artalk.vue index 3ef6c73f9..7ff4a55de 100644 --- a/docs/docs/.vitepress/theme/Artalk.vue +++ b/docs/docs/.vitepress/theme/Artalk.vue @@ -7,6 +7,9 @@ import { watch, nextTick, ref, onMounted, onUnmounted } from 'vue' import { useData, useRouter } from 'vitepress' import Artalk from 'artalk' import { ArtalkKatexPlugin } from '@artalk/plugin-katex' +import { ArtalkLightboxPlugin } from '@artalk/plugin-lightbox' +import 'lightgallery/css/lightgallery.css' +import 'katex/dist/katex.min.css' import 'artalk/dist/Artalk.css' const el = ref(null) @@ -38,6 +41,11 @@ onUnmounted(() => { function initArtalk(conf: any) { Artalk.use(ArtalkKatexPlugin) + Artalk.use(ArtalkLightboxPlugin, { + lightGallery: { + lib: async () => (await import('lightgallery')).default + } + }) artalk = Artalk.init({ el: el.value, @@ -58,27 +66,6 @@ function getConfByPage() { } function loadExtraFuncs() { - // 图片灯箱插件 - artalk.on('list-loaded', () => { - document - .querySelectorAll('.atk-comment .atk-content') - .forEach(($content) => { - const imgEls = $content.querySelectorAll( - 'img:not([atk-emoticon]):not([atk-lightbox])', - ) - imgEls.forEach((imgEl) => { - imgEl.setAttribute('atk-lightbox', '') - const linkEl = document.createElement('a') - linkEl.setAttribute('class', 'atk-img-link') - linkEl.setAttribute('href', imgEl.src) - linkEl.setAttribute('data-src', imgEl.src) - linkEl.append(imgEl.cloneNode()) - imgEl.replaceWith(linkEl) - }) - if (imgEls.length && typeof window !== 'undefined' && typeof (window).lightGallery !== 'undefined') (window).lightGallery($content, { selector: '.atk-img-link' }) - }) - }) - // 夜间模式 const darkMode = document.querySelector('html').classList.contains('dark') artalk.setDarkMode(darkMode) diff --git a/docs/docs/guide/frontend/lightbox.md b/docs/docs/guide/frontend/lightbox.md index 86ea9b0f2..f0b8aa61a 100644 --- a/docs/docs/guide/frontend/lightbox.md +++ b/docs/docs/guide/frontend/lightbox.md @@ -2,7 +2,9 @@ Artalk LightBox 插件能帮助你将网站**现有的图片灯箱**功能自动集成到 Artalk 中。 -```html +::: code-group + +```html [浏览器引入] @@ -14,24 +16,38 @@ Artalk LightBox 插件能帮助你将网站**现有的图片灯箱**功能自动 ``` -如上所示,额外引入一个 `artalk-plugin-lightbox.js` 文件即可。 +```ts [Node 引入] +// pnpm add lightgallery @artalk/plugin-lightbox +import Artalk from 'artalk' +import { ArtalkLightboxPlugin } from '@artalk/plugin-lightbox' +import 'lightgallery/css/lightgallery.css' + +Artalk.use(ArtalkLightboxPlugin, { + // 手动配置引入灯箱库 + lightGallery: { + lib: async () => (await import('lightgallery')).default + } +}) +``` + +::: -目前自动集成支持:[LightGallery](https://github.com/sachinchoolur/lightGallery) [v2.5.0] / [FancyBox](https://github.com/fancyapps/fancybox) [v4.0.27] / [lightbox2](https://github.com/lokesh/lightbox2) [v2.11.3] +目前自动集成支持:[LightGallery](https://github.com/sachinchoolur/lightGallery) • [FancyBox](https://github.com/fancyapps/fancybox) • [lightbox2](https://github.com/lokesh/lightbox2) • [PhotoSwipe](https://photoswipe.com/) -对于还未适配的图片灯箱,欢迎提交 PR -> [查看代码](https://github.com/ArtalkJS/Artalk/blob/master/ui/plugin-lightbox/main.ts) +对于暂未适配的灯箱库,我们期待你的 PR 😉:[@artalk/plugin-lightbox](https://github.com/ArtalkJS/Artalk/blob/master/ui/plugin-lightbox/src/main.ts)。 ::: details 附:图片灯箱依赖 CDN 资源 -注:通常一个博客主题本来就是有图片灯箱插件的,所以无需重复引入。 +注:一个博客主题可能包含现成的图片灯箱插件,无需重复引入。 #### LightGallery ```html - + ``` #### FancyBox @@ -39,23 +55,9 @@ Artalk LightBox 插件能帮助你将网站**现有的图片灯箱**功能自动 ```html - + ``` ::: - -### 配置灯箱 - -在引入 `artalk-plugin-lightbox.js` 之前对全局变量 `ATK_LIGHTBOX_CONF` 进行设置,如下: - -```html - - -``` diff --git a/docs/docs/package.json b/docs/docs/package.json index 20eb5fa83..c4759d2e7 100644 --- a/docs/docs/package.json +++ b/docs/docs/package.json @@ -22,6 +22,9 @@ }, "dependencies": { "@artalk/plugin-katex": "^0.1.9", + "@artalk/plugin-lightbox": "^0.2.1", + "katex": "^0.16.10", + "lightgallery": "^2.7.2", "vue": "^3.4.26" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9da769b9d..2213716f9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -112,7 +112,7 @@ importers: version: 5.2.13(@types/node@20.14.2)(sass@1.77.4)(terser@5.31.1) vite-plugin-checker: specifier: 0.6.4 - version: 0.6.4(eslint@9.4.0)(optionator@0.9.4)(stylelint@16.6.1(typescript@5.4.5))(typescript@5.4.5)(vite@5.2.13(@types/node@20.14.2)(sass@1.77.4)(terser@5.31.1))(vue-tsc@2.0.20(typescript@5.4.5)) + version: 0.6.4(eslint@9.4.0)(optionator@0.9.4)(stylelint@16.6.1(typescript@5.4.5))(typescript@5.4.5)(vite@5.2.13(@types/node@20.14.2)(sass@1.77.4)(terser@5.31.1))(vue-tsc@2.0.16(typescript@5.4.5)) vite-plugin-dts: specifier: 3.9.1 version: 3.9.1(@types/node@20.14.2)(rollup@4.18.0)(typescript@5.4.5)(vite@5.2.13(@types/node@20.14.2)(sass@1.77.4)(terser@5.31.1)) @@ -131,6 +131,15 @@ importers: '@artalk/plugin-katex': specifier: ^0.1.9 version: 0.1.9 + '@artalk/plugin-lightbox': + specifier: ^0.2.1 + version: 0.2.1(fancybox@3.0.1)(lightbox2@2.11.4)(lightgallery@2.7.2)(photoswipe@5.4.4) + katex: + specifier: ^0.16.10 + version: 0.16.10 + lightgallery: + specifier: ^2.7.2 + version: 2.7.2 vue: specifier: ^3.4.26 version: 3.4.26(typescript@5.4.5) @@ -146,7 +155,7 @@ importers: version: 1.76.0 vitepress: specifier: 1.1.4 - version: 1.1.4(@algolia/client-search@4.23.3)(@types/node@20.14.2)(@types/react@18.3.3)(postcss@8.4.38)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.76.0)(search-insights@2.14.0)(terser@5.31.1)(typescript@5.4.5) + version: 1.1.4(@algolia/client-search@4.23.2)(@types/node@20.14.2)(@types/react@18.3.1)(postcss@8.4.38)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.76.0)(search-insights@2.14.0)(terser@5.31.1)(typescript@5.4.5) docs/landing: dependencies: @@ -202,7 +211,7 @@ importers: devDependencies: vitepress: specifier: 1.0.2 - version: 1.0.2(@algolia/client-search@4.23.3)(@types/node@20.14.2)(@types/react@18.3.3)(postcss@8.4.38)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4)(search-insights@2.14.0)(terser@5.31.1)(typescript@5.4.5) + version: 1.0.2(@algolia/client-search@4.23.2)(@types/node@20.14.2)(@types/react@18.3.1)(postcss@8.4.38)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4)(search-insights@2.14.0)(terser@5.31.1)(typescript@5.4.5) test/vue-test: dependencies: @@ -300,7 +309,7 @@ importers: version: 5.4.5 unplugin-auto-import: specifier: ^0.17.5 - version: 0.17.5(@vueuse/core@10.10.0(vue@3.4.26(typescript@5.4.5)))(rollup@4.18.0) + version: 0.17.5(@vueuse/core@10.9.0(vue@3.4.26(typescript@5.4.5)))(rollup@4.18.0) unplugin-vue-components: specifier: ^0.27.0 version: 0.27.0(@babel/parser@7.24.7)(rollup@4.18.0)(vue@3.4.26(typescript@5.4.5)) @@ -366,13 +375,29 @@ importers: version: 0.1.8(esbuild@0.19.12) tsup: specifier: ^8.0.2 - version: 8.0.2(@microsoft/api-extractor@7.46.2(@types/node@20.14.2))(@swc/core@1.5.25)(postcss@8.4.38)(typescript@5.4.5) + version: 8.0.2(@microsoft/api-extractor@7.46.2(@types/node@20.14.2))(@swc/core@1.4.17)(postcss@8.4.38)(typescript@5.4.5) ui/plugin-lightbox: dependencies: artalk: specifier: workspace:^ version: link:../artalk + devDependencies: + '@artalk/plugin-kit': + specifier: workspace:^ + version: link:../plugin-kit + fancybox: + specifier: ^3.0.1 + version: 3.0.1 + lightbox2: + specifier: ^2.11.4 + version: 2.11.4 + lightgallery: + specifier: ^2.7.2 + version: 2.7.2 + photoswipe: + specifier: ^5.4.4 + version: 5.4.4 packages: @@ -402,9 +427,6 @@ packages: '@algolia/cache-common@4.23.2': resolution: {integrity: sha512-OUK/6mqr6CQWxzl/QY0/mwhlGvS6fMtvEPyn/7AHUx96NjqDA4X4+Ju7aXFQKh+m3jW9VPB0B9xvEQgyAnRPNw==} - '@algolia/cache-common@4.23.3': - resolution: {integrity: sha512-h9XcNI6lxYStaw32pHpB1TMm0RuxphF+Ik4o7tcQiodEdpKK+wKufY6QXtba7t3k8eseirEMVB83uFFF3Nu54A==} - '@algolia/cache-in-memory@4.23.2': resolution: {integrity: sha512-rfbi/SnhEa3MmlqQvgYz/9NNJ156NkU6xFxjbxBtLWnHbpj+qnlMoKd+amoiacHRITpajg6zYbLM9dnaD3Bczw==} @@ -417,24 +439,15 @@ packages: '@algolia/client-common@4.23.2': resolution: {integrity: sha512-Q2K1FRJBern8kIfZ0EqPvUr3V29ICxCm/q42zInV+VJRjldAD9oTsMGwqUQ26GFMdFYmqkEfCbY4VGAiQhh22g==} - '@algolia/client-common@4.23.3': - resolution: {integrity: sha512-l6EiPxdAlg8CYhroqS5ybfIczsGUIAC47slLPOMDeKSVXYG1n0qGiz4RjAHLw2aD0xzh2EXZ7aRguPfz7UKDKw==} - '@algolia/client-personalization@4.23.2': resolution: {integrity: sha512-vwPsgnCGhUcHhhQG5IM27z8q7dWrN9itjdvgA6uKf2e9r7vB+WXt4OocK0CeoYQt3OGEAExryzsB8DWqdMK5wg==} '@algolia/client-search@4.23.2': resolution: {integrity: sha512-CxSB29OVGSE7l/iyoHvamMonzq7Ev8lnk/OkzleODZ1iBcCs3JC/XgTIKzN/4RSTrJ9QybsnlrN/bYCGufo7qw==} - '@algolia/client-search@4.23.3': - resolution: {integrity: sha512-P4VAKFHqU0wx9O+q29Q8YVuaowaZ5EM77rxfmGnkHUJggh28useXQdopokgwMeYw2XUht49WX5RcTQ40rZIabw==} - '@algolia/logger-common@4.23.2': resolution: {integrity: sha512-jGM49Q7626cXZ7qRAWXn0jDlzvoA1FvN4rKTi1g0hxKsTTSReyYk0i1ADWjChDPl3Q+nSDhJuosM2bBUAay7xw==} - '@algolia/logger-common@4.23.3': - resolution: {integrity: sha512-y9kBtmJwiZ9ZZ+1Ek66P0M68mHQzKRxkW5kAAXYN/rdzgDN0d2COsViEFufxJ0pb45K4FRcfC7+33YB4BLrZ+g==} - '@algolia/logger-console@4.23.2': resolution: {integrity: sha512-oo+lnxxEmlhTBTFZ3fGz1O8PJ+G+8FiAoMY2Qo3Q4w23xocQev6KqDTA1JQAGPDxAewNA2VBwWOsVXeXFjrI/Q==} @@ -447,18 +460,12 @@ packages: '@algolia/requester-common@4.23.2': resolution: {integrity: sha512-3EfpBS0Hri0lGDB5H/BocLt7Vkop0bTTLVUBB844HH6tVycwShmsV6bDR7yXbQvFP1uNpgePRD3cdBCjeHmk6Q==} - '@algolia/requester-common@4.23.3': - resolution: {integrity: sha512-xloIdr/bedtYEGcXCiF2muajyvRhwop4cMZo+K2qzNht0CMzlRkm8YsDdj5IaBhshqfgmBb3rTg4sL4/PpvLYw==} - '@algolia/requester-node-http@4.23.2': resolution: {integrity: sha512-SVzgkZM/malo+2SB0NWDXpnT7nO5IZwuDTaaH6SjLeOHcya1o56LSWXk+3F3rNLz2GVH+I/rpYKiqmHhSOjerw==} '@algolia/transporter@4.23.2': resolution: {integrity: sha512-GY3aGKBy+8AK4vZh8sfkatDciDVKad5rTY2S10Aefyjh7e7UGBP4zigf42qVXwU8VOPwi7l/L7OACGMOFcjB0Q==} - '@algolia/transporter@4.23.3': - resolution: {integrity: sha512-Wjl5gttqnf/gQKJA+dafnD0Y6Yw97yvfY8R9h0dQltX1GXTgNs1zWgvtWW0tHl1EgMdhAyw189uWiZMnL3QebQ==} - '@ampproject/remapping@2.3.0': resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} engines: {node: '>=6.0.0'} @@ -469,6 +476,23 @@ packages: '@artalk/plugin-katex@0.1.9': resolution: {integrity: sha512-/5GqIMPkQmJq+d5Jwt8z/Otc5/VawnQH1j/wNQU1epEc4sIr7DtHpZ6V3rO4QrN/IbGVJ2xN3BC2V+WlVvA3LA==} + '@artalk/plugin-lightbox@0.2.1': + resolution: {integrity: sha512-6Uw2xxWbZwgfWbZFk23859HLeNczPlBkxIrZQpyjnWseTOM56odomrur8lqZ7VApxCPVMeP4mZWC0wBvYP03kg==} + peerDependencies: + fancybox: ^3.0.1 + lightbox2: ^2.11.4 + lightgallery: ^2.7.2 + photoswipe: ^5.4.4 + peerDependenciesMeta: + fancybox: + optional: true + lightbox2: + optional: true + lightgallery: + optional: true + photoswipe: + optional: true + '@babel/code-frame@7.24.2': resolution: {integrity: sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==} engines: {node: '>=6.9.0'} @@ -1278,120 +1302,60 @@ packages: cpu: [arm64] os: [darwin] - '@swc/core-darwin-arm64@1.5.25': - resolution: {integrity: sha512-YbD0SBgVJS2DM0vwJTU5m7+wOyCjHPBDMf3nCBJQzFZzOLzK11eRW7SzU2jhJHr9HI9sKcNFfN4lIC2Sj+4inA==} - engines: {node: '>=10'} - cpu: [arm64] - os: [darwin] - '@swc/core-darwin-x64@1.4.17': resolution: {integrity: sha512-WYRO9Fdzq4S/he8zjW5I95G1zcvyd9yyD3Tgi4/ic84P5XDlSMpBDpBLbr/dCPjmSg7aUXxNQqKqGkl6dQxYlA==} engines: {node: '>=10'} cpu: [x64] os: [darwin] - '@swc/core-darwin-x64@1.5.25': - resolution: {integrity: sha512-OhP4TROT6gQuozn+ah0Y4UidSdgDmxwtQq3lgCUIAxJYErJAQ82/Y0kve2UaNmkSGjOHU+/b4siHPrYTkXOk0Q==} - engines: {node: '>=10'} - cpu: [x64] - os: [darwin] - '@swc/core-linux-arm-gnueabihf@1.4.17': resolution: {integrity: sha512-cgbvpWOvtMH0XFjvwppUCR+Y+nf6QPaGu6AQ5hqCP+5Lv2zO5PG0RfasC4zBIjF53xgwEaaWmGP5/361P30X8Q==} engines: {node: '>=10'} cpu: [arm] os: [linux] - '@swc/core-linux-arm-gnueabihf@1.5.25': - resolution: {integrity: sha512-tNmUfrAHxN2gvYPyYNnHx2CYlPO7DGAUuK/bZrqawu++djcg+atAV3eI3XYJgmHId7/sYAlDQ9wjkrOLofFjVg==} - engines: {node: '>=10'} - cpu: [arm] - os: [linux] - '@swc/core-linux-arm64-gnu@1.4.17': resolution: {integrity: sha512-l7zHgaIY24cF9dyQ/FOWbmZDsEj2a9gRFbmgx2u19e3FzOPuOnaopFj0fRYXXKCmtdx+anD750iBIYnTR+pq/Q==} engines: {node: '>=10'} cpu: [arm64] os: [linux] - '@swc/core-linux-arm64-gnu@1.5.25': - resolution: {integrity: sha512-stzpke+bRaNFM/HrZPRjX0aQZ86S/2DChVCwb8NAV1n5lu9mz1CS750y7WbbtX/KZjk92FsCeRy2qwkvjI0gWw==} - engines: {node: '>=10'} - cpu: [arm64] - os: [linux] - '@swc/core-linux-arm64-musl@1.4.17': resolution: {integrity: sha512-qhH4gr9gAlVk8MBtzXbzTP3BJyqbAfUOATGkyUtohh85fPXQYuzVlbExix3FZXTwFHNidGHY8C+ocscI7uDaYw==} engines: {node: '>=10'} cpu: [arm64] os: [linux] - '@swc/core-linux-arm64-musl@1.5.25': - resolution: {integrity: sha512-UckUfDYedish/bj2V1jgQDGgouLhyRpG7jgF3mp8jHir11V2K6JiTyjFoz99eOiclS3+hNdr4QLJ+ifrQMJNZw==} - engines: {node: '>=10'} - cpu: [arm64] - os: [linux] - '@swc/core-linux-x64-gnu@1.4.17': resolution: {integrity: sha512-vRDFATL1oN5oZMImkwbgSHEkp8xG1ofEASBypze01W1Tqto8t+yo6gsp69wzCZBlxldsvPpvFZW55Jq0Rn+UnA==} engines: {node: '>=10'} cpu: [x64] os: [linux] - '@swc/core-linux-x64-gnu@1.5.25': - resolution: {integrity: sha512-LwbJEgNT3lXbvz4WFzVNXNvs8DvxpoXjMZk9K9Hig8tmZQJKHC2qZTGomcyK5EFzfj2HBuBXZnAEW8ZT9PcEaA==} - engines: {node: '>=10'} - cpu: [x64] - os: [linux] - '@swc/core-linux-x64-musl@1.4.17': resolution: {integrity: sha512-zQNPXAXn3nmPqv54JVEN8k2JMEcMTQ6veVuU0p5O+A7KscJq+AGle/7ZQXzpXSfUCXlLMX4wvd+rwfGhh3J4cw==} engines: {node: '>=10'} cpu: [x64] os: [linux] - '@swc/core-linux-x64-musl@1.5.25': - resolution: {integrity: sha512-rsepMTgml0EkswWkBpg3Wrjj5eqjwTzZN5omAn1klzXSZnClTrfeHvBuoIJYVr1yx+jmBkqySgME2p7+magUAw==} - engines: {node: '>=10'} - cpu: [x64] - os: [linux] - '@swc/core-win32-arm64-msvc@1.4.17': resolution: {integrity: sha512-z86n7EhOwyzxwm+DLE5NoLkxCTme2lq7QZlDjbQyfCxOt6isWz8rkW5QowTX8w9Rdmk34ncrjSLvnHOeLY17+w==} engines: {node: '>=10'} cpu: [arm64] os: [win32] - '@swc/core-win32-arm64-msvc@1.5.25': - resolution: {integrity: sha512-DJDsLBsRBV3uQBShRK2x6fqzABp9RLNVxDUpTTvUjc7qywJ8vS/yn+POK/zCyVEqLagf1z/8D5CEQ+RAIJq1NA==} - engines: {node: '>=10'} - cpu: [arm64] - os: [win32] - '@swc/core-win32-ia32-msvc@1.4.17': resolution: {integrity: sha512-JBwuSTJIgiJJX6wtr4wmXbfvOswHFj223AumUrK544QV69k60FJ9q2adPW9Csk+a8wm1hLxq4HKa2K334UHJ/g==} engines: {node: '>=10'} cpu: [ia32] os: [win32] - '@swc/core-win32-ia32-msvc@1.5.25': - resolution: {integrity: sha512-BARL1ulHol53MEKC1ZVWM3A3FP757UUgG5Q8v97za+4a1SaIgbwvAQyHDxMYWi9+ij+OapK8YnWjJcFa17g8dw==} - engines: {node: '>=10'} - cpu: [ia32] - os: [win32] - '@swc/core-win32-x64-msvc@1.4.17': resolution: {integrity: sha512-jFkOnGQamtVDBm3MF5Kq1lgW8vx4Rm1UvJWRUfg+0gx7Uc3Jp3QMFeMNw/rDNQYRDYPG3yunCC+2463ycd5+dg==} engines: {node: '>=10'} cpu: [x64] os: [win32] - '@swc/core-win32-x64-msvc@1.5.25': - resolution: {integrity: sha512-o+MHUWrQI9iR6EusEV8eNU2Ezi3KtlhUR4gfptQN5MbVzlgjTvQbhiKpE1GYOxp+0BLBbKRwITKOcdhxfEJ2Uw==} - engines: {node: '>=10'} - cpu: [x64] - os: [win32] - '@swc/core@1.4.17': resolution: {integrity: sha512-tq+mdWvodMBNBBZbwFIMTVGYHe9N7zvEaycVVjfvAx20k1XozHbHhRv+9pEVFJjwRxLdXmtvFZd3QZHRAOpoNQ==} engines: {node: '>=10'} @@ -1401,24 +1365,12 @@ packages: '@swc/helpers': optional: true - '@swc/core@1.5.25': - resolution: {integrity: sha512-qdGEIdLVoTjEQ7w72UyyQ0wLFY4XbHfZiidmPHKJQsvSXzdpHXxPdlTCea/mY4AhMqo/M+pvkJSXJAxZnFl7qw==} - engines: {node: '>=10'} - peerDependencies: - '@swc/helpers': '*' - peerDependenciesMeta: - '@swc/helpers': - optional: true - '@swc/counter@0.1.3': resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} '@swc/types@0.1.6': resolution: {integrity: sha512-/JLo/l2JsT/LRd80C3HfbmVpxOAJ11FO2RCEslFrgzLltoP9j8XIbsyDcfCt2WWyX+CM96rBoNM+IToAkFOugg==} - '@swc/types@0.1.7': - resolution: {integrity: sha512-scHWahbHF0eyj3JsxG9CFJgFdFNaVQCNAimBlT6PzS3n/HptxqREjsm4OH6AN3lYcffZYSPxXW8ua2BEHp0lJQ==} - '@tootallnate/once@2.0.0': resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==} engines: {node: '>= 10'} @@ -1510,9 +1462,6 @@ packages: '@types/react@18.3.1': resolution: {integrity: sha512-V0kuGBX3+prX+DQ/7r2qsv1NsdfnCLnTgnRJ1pYnxykBhGMz+qj+box5lq7XsO5mtZsBqpjwwTu/7wszPfMBcw==} - '@types/react@18.3.3': - resolution: {integrity: sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==} - '@types/stack-utils@2.0.3': resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} @@ -1630,9 +1579,6 @@ packages: '@volar/language-core@2.2.0-alpha.6': resolution: {integrity: sha512-GmT28LX2w4x82uuQqNN/P94VOCsZRHBbGcGe+5bFtA2hbIbH6f8tFdMfgXFtyhbft/pj6f3xl37xe+t+nomLIA==} - '@volar/language-core@2.3.0-alpha.14': - resolution: {integrity: sha512-80HmdD27fPHs+EB9s5RIdRFdvKil2xXMbsKSPYcPFOLP3iysOJ/i9OKnG83Rhgn6rTLJdfM97WOdx/dsBwJtag==} - '@volar/source-map@1.11.1': resolution: {integrity: sha512-hJnOnwZ4+WT5iupLRnuzbULZ42L7BWWPMmruzwtLhJfpDVoZLjNBxHDi2sY2bgZXCKlpU5XcsMFoYrsQmPhfZg==} @@ -1642,9 +1588,6 @@ packages: '@volar/source-map@2.2.0-alpha.6': resolution: {integrity: sha512-EztD2zoUopETY+ZCUZAGUHKgj4gOkY/2WnaOS+RSTc56xm85miSA4qOBS8Lt1Ruu5vV52WIZKHW/R9PbjkZWFA==} - '@volar/source-map@2.3.0-alpha.14': - resolution: {integrity: sha512-la0CSIfo593WRga2r9STkCtObECX/3xZs4cQKlygU8G13zCtYP8uOQc/jgBQEQK3ne50i7X4Z0ZRLj9ht8+Ppg==} - '@volar/typescript@1.11.1': resolution: {integrity: sha512-iU+t2mas/4lYierSnoFOeRFQUhAEMgsFuQxoxvwn5EdQopw43j+J27a4lt9LMInx1gLJBC6qL14WYGlgymaSMQ==} @@ -1654,9 +1597,6 @@ packages: '@volar/typescript@2.2.0-alpha.6': resolution: {integrity: sha512-wTr0jO3wVXQ9FjBbWE2iX8GgDoiHp1Nttsb+tKk5IeUUb6f1uOjyeIXuS4KfeMBpCufthRO2st2O2uatAs/UXQ==} - '@volar/typescript@2.3.0-alpha.14': - resolution: {integrity: sha512-YnaivvHu/HlVgFRUFPh3X42GXYawSIXPvkIGND/RZXJ1iyrj9CB/UEtsMUV55TOULbfJyc92F2EpOMn/lMyqwA==} - '@vue-macros/common@1.10.2': resolution: {integrity: sha512-WC66NPVh2mJWqm4L0l/u/cOqm4pNOIwVdMGnDYAH2rHcOWy5x68GkhpkYTBu1+xwCSeHWOQn1TCGGbD+98fFpA==} engines: {node: '>=16.14.0'} @@ -1745,14 +1685,6 @@ packages: typescript: optional: true - '@vue/language-core@2.0.20': - resolution: {integrity: sha512-PudZnVVhZV9++4xndha6K8G1P+pa5WB4H926IK6Pn82EKD+7MEnBJ858t+cI5jpXqx1X/72+NfzRrgsocN5LrA==} - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - '@vue/reactivity@3.4.21': resolution: {integrity: sha512-UhenImdc0L0/4ahGCyEzc/pZNwVgcglGy9HVzJ1Bq2Mm9qXOpP8RyNTjookw/gOCUlXSEtuZ2fUg5nrHcoqJcw==} @@ -1793,9 +1725,6 @@ packages: '@vue/tsconfig@0.5.1': resolution: {integrity: sha512-VcZK7MvpjuTPx2w6blwnwZAu5/LgBUtejFOi3pPGQFXQN5Ela03FUtd2Qtg4yWGGissVL0dr6Ro1LfOFh+PCuQ==} - '@vueuse/core@10.10.0': - resolution: {integrity: sha512-vexJ/YXYs2S42B783rI95lMt3GzEwkxzC8Hb0Ndpd8rD+p+Lk/Za4bd797Ym7yq4jXqdSyj3JLChunF/vyYjUw==} - '@vueuse/core@10.9.0': resolution: {integrity: sha512-/1vjTol8SXnx6xewDEKfS0Ra//ncg4Hb0DaZiwKf7drgfMsKFExQ+FnnENcN6efPen+1kIzhLQoGSy0eDUVOMg==} @@ -1840,15 +1769,9 @@ packages: universal-cookie: optional: true - '@vueuse/metadata@10.10.0': - resolution: {integrity: sha512-UNAo2sTCAW5ge6OErPEHb5z7NEAg3XcO9Cj7OK45aZXfLLH1QkexDcZD77HBi5zvEiLOm1An+p/4b5K3Worpug==} - '@vueuse/metadata@10.9.0': resolution: {integrity: sha512-iddNbg3yZM0X7qFY2sAotomgdHK7YJ6sKUvQqbvwnf7TmaVPxS4EJydcNsVejNdS8iWCtDk+fYXr7E32nyTnGA==} - '@vueuse/shared@10.10.0': - resolution: {integrity: sha512-2aW33Ac0Uk0U+9yo3Ypg9s5KcR42cuehRWl7vnUHadQyFvCktseyxxEPBi1Eiq4D2yBGACOnqLZpx1eMc7g5Og==} - '@vueuse/shared@10.9.0': resolution: {integrity: sha512-Uud2IWncmAfJvRaFYzv5OHDli+FbOzxiVEQdLCKQKLyhz94PIyFC3CHcH7EDMwIn8NPtD06+PNbC/PiO0LGLtw==} @@ -1999,8 +1922,8 @@ packages: resolution: {integrity: sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==} engines: {node: '>= 0.4'} - artalk@2.8.6: - resolution: {integrity: sha512-Wt6x9F6A9l7Bw6y8tZayheHkJJ2tF0T3yZVxtqHTpDgZOKlOI91UzBvZ2bSjScayy7JH9ZSAkTC/qVDODeUhbA==} + artalk@2.8.7: + resolution: {integrity: sha512-Pl6oKnG0mLf6/c0X93SEmUm7RqqO1zsfvf4j8EzO25pvcDn9pJdYQqLrWKupaHwO7JLvEcgq5pBBrJCLmBKGpw==} assertion-error@1.1.0: resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} @@ -2650,6 +2573,9 @@ packages: resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} engines: {node: '>=16.17'} + fancybox@3.0.1: + resolution: {integrity: sha512-HZ57O6j5Zk4Uvusd5pNUgWi7CCjKx+HFlCzjMPeRJ//0bQWUK+xVpkn3EzXWJate4ZSKNFP9kU2l49MP1g+oow==} + fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} @@ -3282,6 +3208,13 @@ packages: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} engines: {node: '>= 0.8.0'} + lightbox2@2.11.4: + resolution: {integrity: sha512-Fof7RJFWV3Fe4CWTjpto30h04Led97nRStFNLaUD/VrlEs72r7LF9WMndENYvU2e4o8WboSuy+dmetXSKSnQ2Q==} + + lightgallery@2.7.2: + resolution: {integrity: sha512-Ewdcg9UPDqV0HGZeD7wNE4uYejwH2u0fMo5VAr6GHzlPYlhItJvjhLTR0cL0V1HjhMsH39PAom9iv69ewitLWw==} + engines: {node: '>=6.0.0'} + lilconfig@3.1.1: resolution: {integrity: sha512-O18pf7nyvHTckunPWCV1XUNXU1piu01y2b7ATJ0ppkUkk8ocqVWBrYjJBCwHDjD/ZWcfyrA0P4gKhzWGi5EINQ==} engines: {node: '>=14'} @@ -3698,6 +3631,10 @@ packages: perfect-scrollbar@1.5.5: resolution: {integrity: sha512-dzalfutyP3e/FOpdlhVryN4AJ5XDVauVWxybSkLZmakFE2sS3y3pc4JnSprw8tGmHvkaG5Edr5T7LBTZ+WWU2g==} + photoswipe@5.4.4: + resolution: {integrity: sha512-WNFHoKrkZNnvFFhbHL93WDkW3ifwVOXSW3w1UuZZelSmgXpIGiZSNlZJq37rR8YejqME2rHs9EhH9ZvlvFH2NA==} + engines: {node: '>= 0.12.0'} + picocolors@1.0.1: resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} @@ -4763,17 +4700,6 @@ packages: '@vue/composition-api': optional: true - vue-demi@0.14.8: - resolution: {integrity: sha512-Uuqnk9YE9SsWeReYqK2alDI5YzciATE0r2SkA6iMAtuXvNTMNACJLJEXNXaEy94ECuBe4Sk6RzRU80kjdbIo1Q==} - engines: {node: '>=12'} - hasBin: true - peerDependencies: - '@vue/composition-api': ^1.0.0-rc.1 - vue: ^3.0.0-0 || ^2.6.0 - peerDependenciesMeta: - '@vue/composition-api': - optional: true - vue-eslint-parser@9.4.3: resolution: {integrity: sha512-2rYRLWlIpaiN8xbPiDyXZXRgLGOtWxERV7ND5fFAv5qo1D2N9Fu9MNajBNc6o13lZ+24DAWCkQCvj4klgmcITg==} engines: {node: ^14.17.0 || >=16.0.0} @@ -4817,12 +4743,6 @@ packages: peerDependencies: typescript: '*' - vue-tsc@2.0.20: - resolution: {integrity: sha512-FlyW/vtf9mfUfOSMnPma2USaWwdZQKCHSTgtJwlt6q471ZaVzx9Wy4UiSCFW4bQHjExMzwmjbCbkYoYdiNFv0w==} - hasBin: true - peerDependencies: - typescript: '*' - vue@3.4.21: resolution: {integrity: sha512-5hjyV/jLEIKD/jYl4cavMcnzKwjMKohureP8ejn3hhEjwhWIhWeuzL2kJAjzl/WyVsgPY56Sy4Z40C3lVshxXA==} peerDependencies: @@ -5025,32 +4945,32 @@ packages: snapshots: - '@algolia/autocomplete-core@1.9.3(@algolia/client-search@4.23.3)(algoliasearch@4.23.2)(search-insights@2.14.0)': + '@algolia/autocomplete-core@1.9.3(@algolia/client-search@4.23.2)(algoliasearch@4.23.2)(search-insights@2.14.0)': dependencies: - '@algolia/autocomplete-plugin-algolia-insights': 1.9.3(@algolia/client-search@4.23.3)(algoliasearch@4.23.2)(search-insights@2.14.0) - '@algolia/autocomplete-shared': 1.9.3(@algolia/client-search@4.23.3)(algoliasearch@4.23.2) + '@algolia/autocomplete-plugin-algolia-insights': 1.9.3(@algolia/client-search@4.23.2)(algoliasearch@4.23.2)(search-insights@2.14.0) + '@algolia/autocomplete-shared': 1.9.3(@algolia/client-search@4.23.2)(algoliasearch@4.23.2) transitivePeerDependencies: - '@algolia/client-search' - algoliasearch - search-insights - '@algolia/autocomplete-plugin-algolia-insights@1.9.3(@algolia/client-search@4.23.3)(algoliasearch@4.23.2)(search-insights@2.14.0)': + '@algolia/autocomplete-plugin-algolia-insights@1.9.3(@algolia/client-search@4.23.2)(algoliasearch@4.23.2)(search-insights@2.14.0)': dependencies: - '@algolia/autocomplete-shared': 1.9.3(@algolia/client-search@4.23.3)(algoliasearch@4.23.2) + '@algolia/autocomplete-shared': 1.9.3(@algolia/client-search@4.23.2)(algoliasearch@4.23.2) search-insights: 2.14.0 transitivePeerDependencies: - '@algolia/client-search' - algoliasearch - '@algolia/autocomplete-preset-algolia@1.9.3(@algolia/client-search@4.23.3)(algoliasearch@4.23.2)': + '@algolia/autocomplete-preset-algolia@1.9.3(@algolia/client-search@4.23.2)(algoliasearch@4.23.2)': dependencies: - '@algolia/autocomplete-shared': 1.9.3(@algolia/client-search@4.23.3)(algoliasearch@4.23.2) - '@algolia/client-search': 4.23.3 + '@algolia/autocomplete-shared': 1.9.3(@algolia/client-search@4.23.2)(algoliasearch@4.23.2) + '@algolia/client-search': 4.23.2 algoliasearch: 4.23.2 - '@algolia/autocomplete-shared@1.9.3(@algolia/client-search@4.23.3)(algoliasearch@4.23.2)': + '@algolia/autocomplete-shared@1.9.3(@algolia/client-search@4.23.2)(algoliasearch@4.23.2)': dependencies: - '@algolia/client-search': 4.23.3 + '@algolia/client-search': 4.23.2 algoliasearch: 4.23.2 '@algolia/cache-browser-local-storage@4.23.2': @@ -5059,8 +4979,6 @@ snapshots: '@algolia/cache-common@4.23.2': {} - '@algolia/cache-common@4.23.3': {} - '@algolia/cache-in-memory@4.23.2': dependencies: '@algolia/cache-common': 4.23.2 @@ -5083,11 +5001,6 @@ snapshots: '@algolia/requester-common': 4.23.2 '@algolia/transporter': 4.23.2 - '@algolia/client-common@4.23.3': - dependencies: - '@algolia/requester-common': 4.23.3 - '@algolia/transporter': 4.23.3 - '@algolia/client-personalization@4.23.2': dependencies: '@algolia/client-common': 4.23.2 @@ -5100,16 +5013,8 @@ snapshots: '@algolia/requester-common': 4.23.2 '@algolia/transporter': 4.23.2 - '@algolia/client-search@4.23.3': - dependencies: - '@algolia/client-common': 4.23.3 - '@algolia/requester-common': 4.23.3 - '@algolia/transporter': 4.23.3 - '@algolia/logger-common@4.23.2': {} - '@algolia/logger-common@4.23.3': {} - '@algolia/logger-console@4.23.2': dependencies: '@algolia/logger-common': 4.23.2 @@ -5134,8 +5039,6 @@ snapshots: '@algolia/requester-common@4.23.2': {} - '@algolia/requester-common@4.23.3': {} - '@algolia/requester-node-http@4.23.2': dependencies: '@algolia/requester-common': 4.23.2 @@ -5146,12 +5049,6 @@ snapshots: '@algolia/logger-common': 4.23.2 '@algolia/requester-common': 4.23.2 - '@algolia/transporter@4.23.3': - dependencies: - '@algolia/cache-common': 4.23.3 - '@algolia/logger-common': 4.23.3 - '@algolia/requester-common': 4.23.3 - '@ampproject/remapping@2.3.0': dependencies: '@jridgewell/gen-mapping': 0.3.5 @@ -5161,9 +5058,18 @@ snapshots: '@artalk/plugin-katex@0.1.9': dependencies: - artalk: 2.8.6 + artalk: 2.8.7 katex: 0.16.10 + '@artalk/plugin-lightbox@0.2.1(fancybox@3.0.1)(lightbox2@2.11.4)(lightgallery@2.7.2)(photoswipe@5.4.4)': + dependencies: + artalk: 2.8.7 + optionalDependencies: + fancybox: 3.0.1 + lightbox2: 2.11.4 + lightgallery: 2.7.2 + photoswipe: 5.4.4 + '@babel/code-frame@7.24.2': dependencies: '@babel/highlight': 7.24.2 @@ -5362,9 +5268,9 @@ snapshots: '@docsearch/css@3.6.0': {} - '@docsearch/js@3.6.0(@algolia/client-search@4.23.3)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.14.0)': + '@docsearch/js@3.6.0(@algolia/client-search@4.23.2)(@types/react@18.3.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.14.0)': dependencies: - '@docsearch/react': 3.6.0(@algolia/client-search@4.23.3)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.14.0) + '@docsearch/react': 3.6.0(@algolia/client-search@4.23.2)(@types/react@18.3.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.14.0) preact: 10.20.1 transitivePeerDependencies: - '@algolia/client-search' @@ -5373,14 +5279,14 @@ snapshots: - react-dom - search-insights - '@docsearch/react@3.6.0(@algolia/client-search@4.23.3)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.14.0)': + '@docsearch/react@3.6.0(@algolia/client-search@4.23.2)(@types/react@18.3.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.14.0)': dependencies: - '@algolia/autocomplete-core': 1.9.3(@algolia/client-search@4.23.3)(algoliasearch@4.23.2)(search-insights@2.14.0) - '@algolia/autocomplete-preset-algolia': 1.9.3(@algolia/client-search@4.23.3)(algoliasearch@4.23.2) + '@algolia/autocomplete-core': 1.9.3(@algolia/client-search@4.23.2)(algoliasearch@4.23.2)(search-insights@2.14.0) + '@algolia/autocomplete-preset-algolia': 1.9.3(@algolia/client-search@4.23.2)(algoliasearch@4.23.2) '@docsearch/css': 3.6.0 algoliasearch: 4.23.2 optionalDependencies: - '@types/react': 18.3.3 + '@types/react': 18.3.1 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) search-insights: 2.14.0 @@ -5945,63 +5851,33 @@ snapshots: '@swc/core-darwin-arm64@1.4.17': optional: true - '@swc/core-darwin-arm64@1.5.25': - optional: true - '@swc/core-darwin-x64@1.4.17': optional: true - '@swc/core-darwin-x64@1.5.25': - optional: true - '@swc/core-linux-arm-gnueabihf@1.4.17': optional: true - '@swc/core-linux-arm-gnueabihf@1.5.25': - optional: true - '@swc/core-linux-arm64-gnu@1.4.17': optional: true - '@swc/core-linux-arm64-gnu@1.5.25': - optional: true - '@swc/core-linux-arm64-musl@1.4.17': optional: true - '@swc/core-linux-arm64-musl@1.5.25': - optional: true - '@swc/core-linux-x64-gnu@1.4.17': optional: true - '@swc/core-linux-x64-gnu@1.5.25': - optional: true - '@swc/core-linux-x64-musl@1.4.17': optional: true - '@swc/core-linux-x64-musl@1.5.25': - optional: true - '@swc/core-win32-arm64-msvc@1.4.17': optional: true - '@swc/core-win32-arm64-msvc@1.5.25': - optional: true - '@swc/core-win32-ia32-msvc@1.4.17': optional: true - '@swc/core-win32-ia32-msvc@1.5.25': - optional: true - '@swc/core-win32-x64-msvc@1.4.17': optional: true - '@swc/core-win32-x64-msvc@1.5.25': - optional: true - '@swc/core@1.4.17': dependencies: '@swc/counter': 0.1.3 @@ -6018,34 +5894,12 @@ snapshots: '@swc/core-win32-ia32-msvc': 1.4.17 '@swc/core-win32-x64-msvc': 1.4.17 - '@swc/core@1.5.25': - dependencies: - '@swc/counter': 0.1.3 - '@swc/types': 0.1.7 - optionalDependencies: - '@swc/core-darwin-arm64': 1.5.25 - '@swc/core-darwin-x64': 1.5.25 - '@swc/core-linux-arm-gnueabihf': 1.5.25 - '@swc/core-linux-arm64-gnu': 1.5.25 - '@swc/core-linux-arm64-musl': 1.5.25 - '@swc/core-linux-x64-gnu': 1.5.25 - '@swc/core-linux-x64-musl': 1.5.25 - '@swc/core-win32-arm64-msvc': 1.5.25 - '@swc/core-win32-ia32-msvc': 1.5.25 - '@swc/core-win32-x64-msvc': 1.5.25 - optional: true - '@swc/counter@0.1.3': {} '@swc/types@0.1.6': dependencies: '@swc/counter': 0.1.3 - '@swc/types@0.1.7': - dependencies: - '@swc/counter': 0.1.3 - optional: true - '@tootallnate/once@2.0.0': {} '@tsconfig/node18@18.2.4': {} @@ -6151,12 +6005,6 @@ snapshots: '@types/prop-types': 15.7.12 csstype: 3.1.3 - '@types/react@18.3.3': - dependencies: - '@types/prop-types': 15.7.12 - csstype: 3.1.3 - optional: true - '@types/stack-utils@2.0.3': {} '@types/stylis@4.2.0': {} @@ -6339,11 +6187,6 @@ snapshots: dependencies: '@volar/source-map': 2.2.0-alpha.6 - '@volar/language-core@2.3.0-alpha.14': - dependencies: - '@volar/source-map': 2.3.0-alpha.14 - optional: true - '@volar/source-map@1.11.1': dependencies: muggle-string: 0.3.1 @@ -6356,11 +6199,6 @@ snapshots: dependencies: muggle-string: 0.4.1 - '@volar/source-map@2.3.0-alpha.14': - dependencies: - muggle-string: 0.4.1 - optional: true - '@volar/typescript@1.11.1': dependencies: '@volar/language-core': 1.11.1 @@ -6376,13 +6214,6 @@ snapshots: '@volar/language-core': 2.2.0-alpha.6 path-browserify: 1.0.1 - '@volar/typescript@2.3.0-alpha.14': - dependencies: - '@volar/language-core': 2.3.0-alpha.14 - path-browserify: 1.0.1 - vscode-uri: 3.0.8 - optional: true - '@vue-macros/common@1.10.2(rollup@4.18.0)(vue@3.4.26(typescript@5.4.5))': dependencies: '@babel/types': 7.24.5 @@ -6547,19 +6378,6 @@ snapshots: optionalDependencies: typescript: 5.4.5 - '@vue/language-core@2.0.20(typescript@5.4.5)': - dependencies: - '@volar/language-core': 2.3.0-alpha.14 - '@vue/compiler-dom': 3.4.27 - '@vue/shared': 3.4.27 - computeds: 0.0.1 - minimatch: 9.0.4 - path-browserify: 1.0.1 - vue-template-compiler: 2.7.16 - optionalDependencies: - typescript: 5.4.5 - optional: true - '@vue/reactivity@3.4.21': dependencies: '@vue/shared': 3.4.21 @@ -6616,17 +6434,6 @@ snapshots: '@vue/tsconfig@0.5.1': {} - '@vueuse/core@10.10.0(vue@3.4.26(typescript@5.4.5))': - dependencies: - '@types/web-bluetooth': 0.0.20 - '@vueuse/metadata': 10.10.0 - '@vueuse/shared': 10.10.0(vue@3.4.26(typescript@5.4.5)) - vue-demi: 0.14.8(vue@3.4.26(typescript@5.4.5)) - transitivePeerDependencies: - - '@vue/composition-api' - - vue - optional: true - '@vueuse/core@10.9.0(vue@3.4.21(typescript@5.4.5))': dependencies: '@types/web-bluetooth': 0.0.20 @@ -6669,19 +6476,8 @@ snapshots: - '@vue/composition-api' - vue - '@vueuse/metadata@10.10.0': - optional: true - '@vueuse/metadata@10.9.0': {} - '@vueuse/shared@10.10.0(vue@3.4.26(typescript@5.4.5))': - dependencies: - vue-demi: 0.14.8(vue@3.4.26(typescript@5.4.5)) - transitivePeerDependencies: - - '@vue/composition-api' - - vue - optional: true - '@vueuse/shared@10.9.0(vue@3.4.21(typescript@5.4.5))': dependencies: vue-demi: 0.14.7(vue@3.4.21(typescript@5.4.5)) @@ -6890,7 +6686,7 @@ snapshots: is-array-buffer: 3.0.4 is-shared-array-buffer: 1.0.3 - artalk@2.8.6: + artalk@2.8.7: dependencies: abortcontroller-polyfill: 1.7.5 hanabi: 0.4.0 @@ -7715,6 +7511,8 @@ snapshots: signal-exit: 4.1.0 strip-final-newline: 3.0.0 + fancybox@3.0.1: {} + fast-deep-equal@3.1.3: {} fast-glob@3.3.2: @@ -8392,6 +8190,10 @@ snapshots: prelude-ls: 1.2.1 type-check: 0.4.0 + lightbox2@2.11.4: {} + + lightgallery@2.7.2: {} + lilconfig@3.1.1: {} lines-and-columns@1.2.4: {} @@ -8776,6 +8578,8 @@ snapshots: perfect-scrollbar@1.5.5: {} + photoswipe@5.4.4: {} + picocolors@1.0.1: {} picomatch@2.3.1: {} @@ -9521,7 +9325,7 @@ snapshots: tslib@2.6.3: {} - tsup@8.0.2(@microsoft/api-extractor@7.46.2(@types/node@20.14.2))(@swc/core@1.5.25)(postcss@8.4.38)(typescript@5.4.5): + tsup@8.0.2(@microsoft/api-extractor@7.46.2(@types/node@20.14.2))(@swc/core@1.4.17)(postcss@8.4.38)(typescript@5.4.5): dependencies: bundle-require: 4.1.0(esbuild@0.19.12) cac: 6.7.14 @@ -9539,7 +9343,7 @@ snapshots: tree-kill: 1.2.2 optionalDependencies: '@microsoft/api-extractor': 7.46.2(@types/node@20.14.2) - '@swc/core': 1.5.25 + '@swc/core': 1.4.17 postcss: 8.4.38 typescript: 5.4.5 transitivePeerDependencies: @@ -9650,7 +9454,7 @@ snapshots: universalify@2.0.1: {} - unplugin-auto-import@0.17.5(@vueuse/core@10.10.0(vue@3.4.26(typescript@5.4.5)))(rollup@4.18.0): + unplugin-auto-import@0.17.5(@vueuse/core@10.9.0(vue@3.4.26(typescript@5.4.5)))(rollup@4.18.0): dependencies: '@antfu/utils': 0.7.7 '@rollup/pluginutils': 5.1.0(rollup@4.18.0) @@ -9661,7 +9465,7 @@ snapshots: unimport: 3.7.1(rollup@4.18.0) unplugin: 1.10.1 optionalDependencies: - '@vueuse/core': 10.10.0(vue@3.4.26(typescript@5.4.5)) + '@vueuse/core': 10.9.0(vue@3.4.26(typescript@5.4.5)) transitivePeerDependencies: - rollup @@ -9752,7 +9556,7 @@ snapshots: - supports-color - terser - vite-plugin-checker@0.6.4(eslint@9.4.0)(optionator@0.9.4)(stylelint@16.6.1(typescript@5.4.5))(typescript@5.4.5)(vite@5.2.13(@types/node@20.14.2)(sass@1.77.4)(terser@5.31.1))(vue-tsc@2.0.20(typescript@5.4.5)): + vite-plugin-checker@0.6.4(eslint@9.4.0)(optionator@0.9.4)(stylelint@16.6.1(typescript@5.4.5))(typescript@5.4.5)(vite@5.2.13(@types/node@20.14.2)(sass@1.77.4)(terser@5.31.1))(vue-tsc@2.0.16(typescript@5.4.5)): dependencies: '@babel/code-frame': 7.24.7 ansi-escapes: 4.3.2 @@ -9775,7 +9579,7 @@ snapshots: optionator: 0.9.4 stylelint: 16.6.1(typescript@5.4.5) typescript: 5.4.5 - vue-tsc: 2.0.20(typescript@5.4.5) + vue-tsc: 2.0.16(typescript@5.4.5) vite-plugin-css-injected-by-js@3.5.1(vite@5.2.13(@types/node@20.14.2)(sass@1.77.4)(terser@5.31.1)): dependencies: @@ -9881,10 +9685,10 @@ snapshots: optionalDependencies: vite: 5.2.13(@types/node@20.14.2)(sass@1.77.4)(terser@5.31.1) - vitepress@1.0.2(@algolia/client-search@4.23.3)(@types/node@20.14.2)(@types/react@18.3.3)(postcss@8.4.38)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4)(search-insights@2.14.0)(terser@5.31.1)(typescript@5.4.5): + vitepress@1.0.2(@algolia/client-search@4.23.2)(@types/node@20.14.2)(@types/react@18.3.1)(postcss@8.4.38)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4)(search-insights@2.14.0)(terser@5.31.1)(typescript@5.4.5): dependencies: '@docsearch/css': 3.6.0 - '@docsearch/js': 3.6.0(@algolia/client-search@4.23.3)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.14.0) + '@docsearch/js': 3.6.0(@algolia/client-search@4.23.2)(@types/react@18.3.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.14.0) '@shikijs/core': 1.2.4 '@shikijs/transformers': 1.2.4 '@types/markdown-it': 13.0.7 @@ -9927,10 +9731,10 @@ snapshots: - typescript - universal-cookie - vitepress@1.1.4(@algolia/client-search@4.23.3)(@types/node@20.14.2)(@types/react@18.3.3)(postcss@8.4.38)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.76.0)(search-insights@2.14.0)(terser@5.31.1)(typescript@5.4.5): + vitepress@1.1.4(@algolia/client-search@4.23.2)(@types/node@20.14.2)(@types/react@18.3.1)(postcss@8.4.38)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.76.0)(search-insights@2.14.0)(terser@5.31.1)(typescript@5.4.5): dependencies: '@docsearch/css': 3.6.0 - '@docsearch/js': 3.6.0(@algolia/client-search@4.23.3)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.14.0) + '@docsearch/js': 3.6.0(@algolia/client-search@4.23.2)(@types/react@18.3.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.14.0) '@shikijs/core': 1.4.0 '@shikijs/transformers': 1.4.0 '@types/markdown-it': 14.1.1 @@ -10038,11 +9842,6 @@ snapshots: dependencies: vue: 3.4.26(typescript@5.4.5) - vue-demi@0.14.8(vue@3.4.26(typescript@5.4.5)): - dependencies: - vue: 3.4.26(typescript@5.4.5) - optional: true - vue-eslint-parser@9.4.3(eslint@9.4.0): dependencies: debug: 4.3.5 @@ -10099,14 +9898,6 @@ snapshots: semver: 7.6.0 typescript: 5.4.5 - vue-tsc@2.0.20(typescript@5.4.5): - dependencies: - '@volar/typescript': 2.3.0-alpha.14 - '@vue/language-core': 2.0.20(typescript@5.4.5) - semver: 7.6.2 - typescript: 5.4.5 - optional: true - vue@3.4.21(typescript@5.4.4): dependencies: '@vue/compiler-dom': 3.4.21 diff --git a/ui/plugin-lightbox/index.html b/ui/plugin-lightbox/index.html deleted file mode 100644 index 890c34c13..000000000 --- a/ui/plugin-lightbox/index.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - plugin-lightbox - - - -
- - - -
- -
- - - - diff --git a/ui/plugin-lightbox/main.ts b/ui/plugin-lightbox/main.ts deleted file mode 100644 index 50760f310..000000000 --- a/ui/plugin-lightbox/main.ts +++ /dev/null @@ -1,85 +0,0 @@ -import Artalk from 'artalk' - -Artalk.use((ctx) => { - const LOADED_ATTR = 'atk-lightbox-loaded' - const IMG_LINK_EL_CLASS = 'atk-lightbox-img' - const IMG_LINK_EL_SEL = `.${IMG_LINK_EL_CLASS}` - - const typeSet = window.ATK_LIGHTBOX_TYPE - const typeIs = (t: string) => - (!typeSet && window[t]) || (typeSet || '').toLowerCase() === t.toLowerCase() - - // add artalk event listener - ctx.on('list-loaded', () => { - const $imgLinks: HTMLAnchorElement[] = [] - - ctx.getCommentNodes().forEach((comment) => { - const $content = comment.getRender().$content - $content - .querySelectorAll(`img:not([atk-emoticon]):not([${LOADED_ATTR}])`) - .forEach(($img) => { - $img.setAttribute(LOADED_ATTR, '') // 初始化标记 - - const $imgLink = document.createElement('a') - $imgLink.setAttribute('class', IMG_LINK_EL_CLASS) - $imgLink.setAttribute('href', $img.src) - $imgLink.setAttribute('data-src', $img.src) - $imgLink.append($img.cloneNode()) - - $img.replaceWith($imgLink) - $imgLinks.push($imgLink) - }) - - // lightGallery - // @link https://github.com/sachinchoolur/lightGallery - if (typeIs('lightGallery')) { - window.lightGallery($content, { - selector: IMG_LINK_EL_SEL, - ...(window.ATK_LIGHTBOX_CONF || {}), - }) - } - }) - - // lightbox2 - // @link https://github.com/lokesh/lightbox2 - if (typeIs('lightbox')) { - $imgLinks.forEach((el) => { - window.$(el).attr('data-title', window.$(el).find('img').attr('alt')) - window.$(el).attr('rel', 'lightbox') - el.onclick = (evt) => { - evt.preventDefault() - window.lightbox.start(window.$(el)) - } - }) - } - - // PhotoSwipe - // @link https://github.com/dimsemenov/photoswipe - /* - if (typeIs('PhotoSwipeLightbox') || typeIs('PhotoSwipe')) { - const dataSource: any[] = [] - const lightbox = new window.PhotoSwipeLightbox({ - dataSource, ...(window.ATK_LIGHTBOX_CONF || {}) - }) - - $imgLinks.forEach((el) => { - const $img = el.querySelector('img')! - dataSource.push({ src: $img.src }) - - el.onclick = (evt) => { - evt.preventDefault() - lightbox.loadAndOpen(0); - } - }) - - lightbox.init() - } - */ - }) - - // Fancybox Event bind - // @link https://github.com/fancyapps/fancybox - if (typeIs('Fancybox')) { - window.Fancybox.bind(`.artalk .atk-list ${IMG_LINK_EL_SEL}`, window.ATK_LIGHTBOX_CONF) - } -}) diff --git a/ui/plugin-lightbox/package.json b/ui/plugin-lightbox/package.json index 44a81a08e..a6cd55fe6 100644 --- a/ui/plugin-lightbox/package.json +++ b/ui/plugin-lightbox/package.json @@ -1,18 +1,60 @@ { "name": "@artalk/plugin-lightbox", - "version": "0.1.2", + "version": "0.2.1", "license": "MIT", "description": "The image lightbox plugin for artalk", + "type": "module", "main": "./dist/artalk-plugin-lightbox.js", - "module": "./dist/artalk-plugin-lightbox.es.js", + "module": "./dist/artalk-plugin-lightbox.mjs", + "types": "./dist/artalk-plugin-lightbox.d.ts", + "files": [ + "dist" + ], "scripts": { "dev": "vite", "build": "vite build", - "serve": "vite preview", - "prepublish": "pnpm build", - "publish": "pnpm publish --access=public" + "serve": "vite preview" }, "dependencies": { "artalk": "workspace:^" + }, + "devDependencies": { + "@artalk/plugin-kit": "workspace:^", + "lightgallery": "^2.7.2", + "lightbox2": "^2.11.4", + "photoswipe": "^5.4.4", + "fancybox": "^3.0.1" + }, + "peerDependencies": { + "lightgallery": "^2.7.2", + "lightbox2": "^2.11.4", + "photoswipe": "^5.4.4", + "fancybox": "^3.0.1" + }, + "peerDependenciesMeta": { + "lightgallery": { + "optional": true + }, + "lightbox2": { + "optional": true + }, + "photoswipe": { + "optional": true + }, + "fancybox": { + "optional": true + } + }, + "exports": { + ".": { + "require": { + "types": "./dist/artalk-plugin-lightbox.d.cts", + "default": "./dist/artalk-plugin-lightbox.cjs" + }, + "default": { + "types": "./dist/artalk-plugin-lightbox.d.ts", + "default": "./dist/artalk-plugin-lightbox.mjs" + } + } } } diff --git a/ui/plugin-lightbox/src/helper.ts b/ui/plugin-lightbox/src/helper.ts new file mode 100644 index 000000000..49ab935e3 --- /dev/null +++ b/ui/plugin-lightbox/src/helper.ts @@ -0,0 +1,35 @@ +import type lightGallery from 'lightgallery' +import type PhotoSwipeLightbox from 'photoswipe' +import type { ArtalkLightboxPluginOptions } from './main' + +const winKeys = { + lightGallery: 'lightGallery', + lightBox: 'lightbox', + fancyBox: 'Fancybox', + photoSwipe: 'PhotoSwipeLightbox', +} + +let deps: { + lightGallery?: typeof lightGallery + lightBox?: any + fancyBox?: any + photoSwipe?: typeof PhotoSwipeLightbox +} + +export async function getDeps(opts?: ArtalkLightboxPluginOptions) { + if (deps) return deps + deps = {} + for (const key in winKeys) { + try { + if (typeof window !== 'undefined' && window[winKeys[key]]) { + deps[key] = window[winKeys[key]] + } else { + deps[key] = await opts?.[key]?.lib?.() + } + if (deps[key]) return deps + } catch { + void 0 + } + } + return deps +} diff --git a/ui/plugin-lightbox/src/main.ts b/ui/plugin-lightbox/src/main.ts new file mode 100644 index 000000000..938748d3a --- /dev/null +++ b/ui/plugin-lightbox/src/main.ts @@ -0,0 +1,109 @@ +import { ArtalkPlugin } from 'artalk' + +import { getDeps } from './helper' + +const LOADED_ATTR = 'atk-lightbox-loaded' +const IMG_LINK_EL_CLASS = 'atk-lightbox-img' +const IMG_LINK_EL_SEL = `.${IMG_LINK_EL_CLASS}` + +export interface ArtalkLightboxPluginOptions { + lightGallery?: { + lib?: () => Promise + } + lightBox?: { + lib?: () => Promise + } + fancyBox?: { + lib?: () => Promise + } + photoSwipe?: { + lib?: () => Promise + } +} + +export const ArtalkLightboxPlugin: ArtalkPlugin = (ctx, opts) => { + // add artalk event listener + ctx.on('list-loaded', async () => { + const $imgLinks: HTMLAnchorElement[] = [] + const $contents = new Set() + + ctx.getCommentNodes().forEach((comment) => { + const $content = comment.getRender().$content + $content + .querySelectorAll(`img:not([atk-emoticon]):not([${LOADED_ATTR}])`) + .forEach(($img) => { + $img.setAttribute(LOADED_ATTR, '') // 初始化标记 + + const $imgLink = document.createElement('a') + $imgLink.setAttribute('class', IMG_LINK_EL_CLASS) + $imgLink.setAttribute('href', $img.src) + $imgLink.setAttribute('data-src', $img.src) + $imgLink.append($img.cloneNode()) + + $img.replaceWith($imgLink) + $imgLinks.push($imgLink) + }) + + $contents.add($content) + }) + + const deps = await getDeps(opts) + + // lightgallery + if (deps.lightGallery) { + // lightGallery + // @link https://github.com/sachinchoolur/lightGallery + $contents.forEach((el) => { + deps.lightGallery!(el, { + selector: IMG_LINK_EL_SEL, + ...(window.ATK_LIGHTBOX_CONF || {}), + }) + }) + } + + if (deps.lightBox) { + // lightbox2 + // @link https://github.com/lokesh/lightbox2 + $imgLinks.forEach((el) => { + window.$(el).attr('data-title', window.$(el).find('img').attr('alt')) + window.$(el).attr('rel', 'lightbox') + el.onclick = (evt) => { + evt.preventDefault() + deps.lightBox!.start(window.$(el)) + } + }) + } + + if (deps.photoSwipe) { + // PhotoSwipe + // @link https://github.com/dimsemenov/photoswipe + const dataSource: any[] = [] + const lightbox = new deps.photoSwipe({ + dataSource, + ...(window.ATK_LIGHTBOX_CONF || {}), + }) + + $imgLinks.forEach((el) => { + const $img = el.querySelector('img')! + dataSource.push({ src: $img.src }) + + el.onclick = (evt) => { + evt.preventDefault() + // @ts-expect-error missing type but works + lightbox.loadAndOpen(0) + } + }) + + lightbox.init() + } + + if (deps.fancyBox) { + // Fancybox Event bind + // @link https://github.com/fancyapps/fancybox + deps.fancyBox.then(({ FancyBox }) => { + if (!FancyBox) return + FancyBox.bind(`.artalk .atk-list ${IMG_LINK_EL_SEL}`, window.ATK_LIGHTBOX_CONF) + }) + } + }) +} diff --git a/ui/plugin-lightbox/tsconfig.json b/ui/plugin-lightbox/tsconfig.json index 122e9c5f0..aa6fcb7cb 100644 --- a/ui/plugin-lightbox/tsconfig.json +++ b/ui/plugin-lightbox/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "baseUrl": ".", - "outDir": "dist" + "outDir": "dist", + "types": ["@artalk/plugin-kit/client", "vite/client"] } } diff --git a/ui/plugin-lightbox/vite.config.ts b/ui/plugin-lightbox/vite.config.ts index d003e1ff5..47a40e4e7 100644 --- a/ui/plugin-lightbox/vite.config.ts +++ b/ui/plugin-lightbox/vite.config.ts @@ -1,30 +1,15 @@ import { defineConfig } from 'vite' -import { resolve } from 'path' -import tsconfigPaths from 'vite-tsconfig-paths' + +import { ViteArtalkPluginKit } from '@artalk/plugin-kit' export default defineConfig({ - base: './', build: { - target: 'es2015', - outDir: resolve(__dirname, 'dist'), - minify: 'terser', - lib: { - entry: resolve(__dirname, './main.ts'), - name: 'artalk-plugin-lightbox', - fileName: (format) => - format == 'umd' ? 'artalk-plugin-lightbox.js' : `artalk-plugin-lightbox.${format}.js`, - formats: ['es', 'umd', 'iife'], - }, rollupOptions: { - external: ['artalk', 'lightgallery'], + external: ['lightgallery', 'lightbox2', 'photoswipe', 'fancybox'], output: { - globals: { - artalk: 'Artalk', - lightgallery: 'lightgallery', - }, - extend: true, + dynamicImportInCjs: false, }, }, }, - plugins: [tsconfigPaths()], + plugins: [ViteArtalkPluginKit()], })