your personal website on atproto - mirror blento.app

try heypster

Florian e9953b2d b0821e40

+47 -1
+1
package.json
··· 62 62 "bits-ui": "^2.14.4", 63 63 "clsx": "^2.1.1", 64 64 "gsap": "^3.14.2", 65 + "heypster-gif": "^3.0.4", 65 66 "hls.js": "^1.6.15", 66 67 "leaflet": "^1.9.4", 67 68 "link-preview-js": "^4.0.0",
+8
pnpm-lock.yaml
··· 77 77 gsap: 78 78 specifier: ^3.14.2 79 79 version: 3.14.2 80 + heypster-gif: 81 + specifier: ^3.0.4 82 + version: 3.0.4 80 83 hls.js: 81 84 specifier: ^1.6.15 82 85 version: 1.6.15 ··· 1965 1968 hex-rgb@4.3.0: 1966 1969 resolution: {integrity: sha512-Ox1pJVrDCyGHMG9CFg1tmrRUMRPRsAWYc/PinY0XzJU4K7y7vjNoLKIQ7BR5UJMCxNN8EM1MNDmHWA/B3aZUuw==, tarball: https://registry.npmjs.org/hex-rgb/-/hex-rgb-4.3.0.tgz} 1967 1970 engines: {node: '>=6'} 1971 + 1972 + heypster-gif@3.0.4: 1973 + resolution: {integrity: sha512-GcmzNYxi1MQNipc/aF1zlVP4ACeqdVJZsP4CrVvx/oKW0VZd+Y/iT/EXaMDJL/dCYqx+unmmLPoDdAzIg8gX7w==, tarball: https://registry.npmjs.org/heypster-gif/-/heypster-gif-3.0.4.tgz} 1968 1974 1969 1975 hls.js@1.6.15: 1970 1976 resolution: {integrity: sha512-E3a5VwgXimGHwpRGV+WxRTKeSp2DW5DI5MWv34ulL3t5UNmyJWCQ1KmLEHbYzcfThfXG8amBL+fCYPneGHC4VA==, tarball: https://registry.npmjs.org/hls.js/-/hls.js-1.6.15.tgz} ··· 4791 4797 function-bind: 1.1.2 4792 4798 4793 4799 hex-rgb@4.3.0: {} 4800 + 4801 + heypster-gif@3.0.4: {} 4794 4802 4795 4803 hls.js@1.6.15: {} 4796 4804
+17 -1
src/lib/cards/GIFCard/EditingGifCard.svelte
··· 1 1 <script lang="ts"> 2 + import { onMount } from 'svelte'; 2 3 import type { ContentComponentProps } from '../types'; 3 4 import GiphySearchModal from './GiphySearchModal.svelte'; 5 + import { toggleHeypster } from './heypster.svelte'; 4 6 5 7 let { item = $bindable() }: ContentComponentProps = $props(); 6 8 ··· 18 20 isSearchOpen = false; 19 21 } 20 22 23 + onMount(() => { 24 + 25 + window.addEventListener('heypsterGifClicked', (event) => { 26 + if (!isSearchOpen) return; 27 + const data = event.detail; 28 + console.log(data); 29 + item.cardData.url = data.h264; 30 + toggleHeypster(); 31 + 32 + isSearchOpen = false; 33 + }); 34 + }) 35 + 21 36 function openSearch() { 22 37 isSearchOpen = true; 38 + toggleHeypster(); 23 39 } 24 40 </script> 25 41 ··· 72 88 {/if} 73 89 </div> 74 90 75 - <GiphySearchModal bind:open={isSearchOpen} onselect={handleGifSelect} oncancel={() => (isSearchOpen = false)} /> 91 + <!-- <GiphySearchModal bind:open={isSearchOpen} onselect={handleGifSelect} oncancel={() => (isSearchOpen = false)} /> -->
+21
src/lib/cards/GIFCard/heypster.svelte.ts
··· 1 + import { env } from '$env/dynamic/public'; 2 + import HeypsterGifSDK from 'heypster-gif/index.js'; 3 + 4 + const heypster = $state({}); 5 + 6 + function initHeypster() { 7 + heypster.sdk = new HeypsterGifSDK(env.PUBLIC_HEYPSTER_API_TOKEN, false, 'en', 'top', 'v3', { 8 + provider: 'giphy', 9 + key: env.PUBLIC_GIPHY_API_TOKEN 10 + }); 11 + } 12 + 13 + export function toggleHeypster() { 14 + if (!heypster.sdk) initHeypster(); 15 + 16 + if (!heypster.sdk.popupElement) { 17 + heypster.sdk = heypster.sdk.initialize(); 18 + } 19 + 20 + heypster.sdk.togglePopup(); 21 + }