your personal website on atproto - mirror blento.app

try heypster

Florian e9953b2d b0821e40

+47 -1
+1
package.json
··· 62 "bits-ui": "^2.14.4", 63 "clsx": "^2.1.1", 64 "gsap": "^3.14.2", 65 "hls.js": "^1.6.15", 66 "leaflet": "^1.9.4", 67 "link-preview-js": "^4.0.0",
··· 62 "bits-ui": "^2.14.4", 63 "clsx": "^2.1.1", 64 "gsap": "^3.14.2", 65 + "heypster-gif": "^3.0.4", 66 "hls.js": "^1.6.15", 67 "leaflet": "^1.9.4", 68 "link-preview-js": "^4.0.0",
+8
pnpm-lock.yaml
··· 77 gsap: 78 specifier: ^3.14.2 79 version: 3.14.2 80 hls.js: 81 specifier: ^1.6.15 82 version: 1.6.15 ··· 1965 hex-rgb@4.3.0: 1966 resolution: {integrity: sha512-Ox1pJVrDCyGHMG9CFg1tmrRUMRPRsAWYc/PinY0XzJU4K7y7vjNoLKIQ7BR5UJMCxNN8EM1MNDmHWA/B3aZUuw==, tarball: https://registry.npmjs.org/hex-rgb/-/hex-rgb-4.3.0.tgz} 1967 engines: {node: '>=6'} 1968 1969 hls.js@1.6.15: 1970 resolution: {integrity: sha512-E3a5VwgXimGHwpRGV+WxRTKeSp2DW5DI5MWv34ulL3t5UNmyJWCQ1KmLEHbYzcfThfXG8amBL+fCYPneGHC4VA==, tarball: https://registry.npmjs.org/hls.js/-/hls.js-1.6.15.tgz} ··· 4791 function-bind: 1.1.2 4792 4793 hex-rgb@4.3.0: {} 4794 4795 hls.js@1.6.15: {} 4796
··· 77 gsap: 78 specifier: ^3.14.2 79 version: 3.14.2 80 + heypster-gif: 81 + specifier: ^3.0.4 82 + version: 3.0.4 83 hls.js: 84 specifier: ^1.6.15 85 version: 1.6.15 ··· 1968 hex-rgb@4.3.0: 1969 resolution: {integrity: sha512-Ox1pJVrDCyGHMG9CFg1tmrRUMRPRsAWYc/PinY0XzJU4K7y7vjNoLKIQ7BR5UJMCxNN8EM1MNDmHWA/B3aZUuw==, tarball: https://registry.npmjs.org/hex-rgb/-/hex-rgb-4.3.0.tgz} 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} 1974 1975 hls.js@1.6.15: 1976 resolution: {integrity: sha512-E3a5VwgXimGHwpRGV+WxRTKeSp2DW5DI5MWv34ulL3t5UNmyJWCQ1KmLEHbYzcfThfXG8amBL+fCYPneGHC4VA==, tarball: https://registry.npmjs.org/hls.js/-/hls.js-1.6.15.tgz} ··· 4797 function-bind: 1.1.2 4798 4799 hex-rgb@4.3.0: {} 4800 + 4801 + heypster-gif@3.0.4: {} 4802 4803 hls.js@1.6.15: {} 4804
+17 -1
src/lib/cards/GIFCard/EditingGifCard.svelte
··· 1 <script lang="ts"> 2 import type { ContentComponentProps } from '../types'; 3 import GiphySearchModal from './GiphySearchModal.svelte'; 4 5 let { item = $bindable() }: ContentComponentProps = $props(); 6 ··· 18 isSearchOpen = false; 19 } 20 21 function openSearch() { 22 isSearchOpen = true; 23 } 24 </script> 25 ··· 72 {/if} 73 </div> 74 75 - <GiphySearchModal bind:open={isSearchOpen} onselect={handleGifSelect} oncancel={() => (isSearchOpen = false)} />
··· 1 <script lang="ts"> 2 + import { onMount } from 'svelte'; 3 import type { ContentComponentProps } from '../types'; 4 import GiphySearchModal from './GiphySearchModal.svelte'; 5 + import { toggleHeypster } from './heypster.svelte'; 6 7 let { item = $bindable() }: ContentComponentProps = $props(); 8 ··· 20 isSearchOpen = false; 21 } 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 + 36 function openSearch() { 37 isSearchOpen = true; 38 + toggleHeypster(); 39 } 40 </script> 41 ··· 88 {/if} 89 </div> 90 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 + }