@funhub/platform 0.1.61 → 0.1.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,8 @@ interface ImageTextRecommendInitialData {
16
16
  initialSmartList?: ContentShowVideoInfo[];
17
17
  initialLoadedBatchIndex?: number;
18
18
  initialDataFromServer?: boolean;
19
+ /** 智能铺设分批时,服务端首屏返回的下一页游标 */
20
+ initialSmartNextCursor?: string;
19
21
  }
20
22
  interface ClientProps extends ImageTextRecommendProps, ImageTextRecommendInitialData {
21
23
  allEpisodesText?: string;
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import e from"../../../../utils/get-res-url.mjs";import{pContentBatchGetVideoDetail as t,pContentGetPopularVideoList as n}from"../../../../service/generated/client.mjs";import{IMAGE_TEXT_RECOMMEND_FIXED_BATCH_SIZE as r,buildImageTextRecommendChosenTags as i,buildImageTextRecommendRemoteMap as a,buildImageTextRecommendSmartPicked as o,getImageTextRecommendFixedIds as s,getImageTextRecommendLayoutTags as c,resolveImageTextRecommendVideoId as l}from"../../../../hooks/image-text-recommend.mjs";import u from"../../../../assets/images/frame.mjs";import ee from"../../../../assets/images/subscript.mjs";import{useCallback as d,useEffect as f,useMemo as p,useRef as m,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import y from"next/image";import{useTranslations as te}from"next-intl";import ne from"next/link";const b=[];function x(t,n){if(!t||!t.trim())return n;if(t.startsWith(`http`)||t.startsWith(`//`)||t.startsWith(`data:`))return t;let r=e();return r?`${r}${t.startsWith(`/`)?t:`/${t}`}`:t}function S(e){if(e==null)return``;let t=e;return t.img_y||t.media?.img_y||``}function C(e){return e==null?``:e.name||``}function w(e){let t=e,n=t.type;return typeof n==`number`?n:t.is_more_link===!0||Number(t.episode_cnt||t.episode_count||t.episodes?.length||t.links?.length||0)>1?2:1}function T(e){if(!Number.isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${a(n)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}function E(e,t){let n=e,r=Number(n.episode_cnt??0);if(!Number.isFinite(r)||r<=0)return``;let i=n.update_status;return t(r,i===0||i===`0`)}function D(e,t,n){return e?w(e)===2&&n?E(e,n):T(Number(e.duration??e.detail?.duration??0)):``}function O(e,t){if(!(e??``).trim())return``;let n=encodeURIComponent((t??``).trim()||``);return`/video/${e.trim()}/${n}/episode/1`}function re(e){if(!e)return``;let t=e,n=Number(t.static?.browse_cnt??0);if(!Number.isFinite(n)||n<=0)return``;if(n>=1e6){let e=(n/1e6).toFixed(1);return e.endsWith(`.0`)?`${e.slice(0,-2)}M`:`${e}M`}if(n>=1e3){let e=(n/1e3).toFixed(1);return e.endsWith(`.0`)?`${e.slice(0,-2)}k`:`${e}k`}return Math.floor(n).toString()}function k(){let e=new Date,t=new Date(e);return t.setHours(24,0,0,0),t.getTime()-e.getTime()}function A(e){let{title:w,items:T=b,commonPlayCount:E,commonEpisodes:A,layout:j,allEpisodesText:M,mode:N=`renderer`,initialRemoteMap:P,initialSmartList:F,initialLoadedBatchIndex:I,initialDataFromServer:L}=e,R=te(`components.biz.business.imageTextRecommend`),z=N===`editor`,[B,V]=h(L&&P!=null?P:{}),[H,U]=h(L&&F!=null?F:[]),[W,G]=h(L&&I!=null?I:0),K=m(null),q=!!j?.enabled,J=p(()=>c(j),[j]),Y=T?.length??0,X=p(()=>s(T,q),[q,T]),Z=p(()=>X.length>0?Math.ceil(X.length/r):0,[X.length]),Q=d((e,t)=>R(t?`updatedTo`:`allEpisodes`,{count:e}),[R]),$=d(async(e,n)=>{if(e.length===0)return;let r=a((await t({ids:e})).data?.videos??[]);V(e=>n?{...e,...r}:r)},[]);f(()=>{if(z||L||!T||T.length===0)return;let e=!1;async function t(){if(X.length===0){e||(V({}),G(0));return}if(X.length<=r){await $(X,!1),e||G(1);return}await $(X.slice(0,r),!1),e||G(1)}async function a(){let t=i(J,Y),r=(await n({page_size:Math.max(20,Y*10),tags:t.length?Array.from(new Set(t)):void 0})).data?.videos??[];e||U(o(r,t,Y))}return(async()=>{try{q?await a():await t()}catch{e||(V({}),U([]),G(0))}})(),()=>{e=!0}},[z,L,q,T,J,Y,X,$]),f(()=>{if(z||q||X.length<=r||W<1||W>=Z)return;let e=K.current;if(!e)return;let t=new IntersectionObserver(e=>{let[t]=e;if(!t?.isIntersecting)return;let n=W,i=n*r,a=X.slice(i,i+r);a.length!==0&&($(a,!0),G(n+1))},{root:null,rootMargin:`0px`,threshold:0});return t.observe(e),()=>t.disconnect()},[z,q,X,W,Z,$]),f(()=>{if(z||!q||Y<=0)return;let e,t=!1;function r(){e=window.setTimeout(()=>{let e=i(J,Y);n({page_size:Math.max(20,Y*10),tags:e.length?Array.from(new Set(e)):void 0}).then(n=>{t||U(o(n.data?.videos??[],e,Y))}).catch(()=>{t||U([])}).finally(()=>{t||r()})},k())}return r(),()=>{t=!0,e!==void 0&&window.clearTimeout(e)}},[z,q,J,Y]);let ie=p(()=>!T||T.length===0?b:T.map((e,t)=>{let n=String(e?.contentId??``).trim(),r=q?H[t]:n?B[n]:void 0,i=(e?.title??``).trim()||(r?C(r):``),a=(e?.cover??``).trim()||(e?.useVideoPoster?S(r):``),o=(e?.contentDescription??``).trim(),s=D(r,M,Q),c=re(r);return{...e,contentId:n||(r?l(r):``),title:i,cover:a,contentDescription:o,episodeOrDurationText:s,playCountText:c}}),[M,Q,q,T,B,H]);if(!T||T.length===0)return null;let ae=!q&&X.length>r&&W>=1&&W<Z?W*r-2:-1;return v(`div`,{className:z?`bg-bg1 px-3 py-3 pointer-events-none`:`bg-bg1 px-3 py-3`,children:[w&&_(`div`,{className:`mb-3 flex items-center justify-between`,children:_(`h2`,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:w})}),_(`div`,{className:`flex overflow-x-auto pb-2 scrollbar-hide space-x-2`,children:ie.map((e,t)=>{let n=q?E:e.showPlayCount??!1,r=(e.playCountText??``).trim(),i=r!==``,a=q?A:e.showEpisodes??!1,o=(e.episodeOrDurationText??``).trim(),s=a&&o!==``,c=N===`renderer`?O(e.contentId??``,e.title??``):``,l=v(g,{children:[v(`div`,{className:`relative aspect-[116.67/155.56] rounded-lg overflow-hidden bg-bg2`,children:[z||e.cover?_(y,{src:x(e.cover,u),alt:e.title??``,fill:!0,sizes:`116.67px`,className:`object-cover text-[10px] text-text3`,unoptimized:!0}):_(`div`,{className:`w-full h-full flex items-center justify-center text-text3 text-xs`,children:R(`noCover`)}),!q&&(e.badge??``).trim()?_(`div`,{className:`absolute top-0 right-0 w-8 h-8`,children:_(y,{src:(e.badge??``).trim()||ee,alt:``,fill:!0,sizes:`32px`,className:`object-contain object-right-top`,unoptimized:!0})}):null,v(`div`,{className:`absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent pb-1 pt-3 px-1 flex justify-between items-center gap-1`,children:[_(`div`,{className:`flex items-center min-w-0 shrink`,children:n&&i?v(`div`,{className:`flex items-center gap-1 rounded bg-overlay px-1 py-0`,children:[_(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`10`,viewBox:`0 0 12 10`,fill:`none`,className:`shrink-0`,"aria-hidden":!0,children:_(`path`,{d:`M7.56 5.18437L5.013 6.56737C4.893 6.63337 4.761 6.66937 4.638 6.66937C4.269 6.66937 4.002 6.38737 4.002 5.99737V3.28237C4.002 2.89237 4.269 2.61037 4.638 2.61037C4.764 2.61037 4.893 2.64637 5.013 2.70937L7.572 4.09237C7.803 4.21837 7.938 4.41637 7.938 4.63237C7.938 4.85137 7.8 5.05537 7.56 5.18437ZM9.807 9.27637L2.133 8.52937C0.954 8.52937 0 7.57537 0 6.39637V2.79937C0 1.62037 0.954 0.666368 2.133 0.666368L9.81 0.000367165C10.989 0.000367165 11.943 0.954367 11.943 2.13337V7.14337C11.9422 7.70935 11.7168 8.25188 11.3163 8.65181C10.9158 9.05174 10.373 9.27637 9.807 9.27637ZM10.875 2.13337C10.875 1.99351 10.8475 1.85502 10.7939 1.72581C10.7404 1.5966 10.662 1.47919 10.5631 1.3803C10.4642 1.2814 10.3468 1.20296 10.2176 1.14944C10.0883 1.09591 9.94986 1.06837 9.81 1.06837L2.133 1.73437C1.99314 1.73437 1.85465 1.76191 1.72544 1.81544C1.59623 1.86896 1.47883 1.9474 1.37993 2.0463C1.28104 2.14519 1.20259 2.2626 1.14907 2.39181C1.09555 2.52102 1.068 2.65951 1.068 2.79937V6.39637C1.068 6.67882 1.1802 6.94971 1.37993 7.14944C1.57966 7.34916 1.85054 7.46137 2.133 7.46137L9.807 8.20837C9.94686 8.20837 10.0853 8.18082 10.2146 8.1273C10.3438 8.07378 10.4612 7.99533 10.5601 7.89644C10.659 7.79754 10.7374 7.68014 10.7909 7.55093C10.8445 7.42171 10.872 7.28323 10.872 7.14337V2.13337H10.875Z`,fill:`white`})}),_(`span`,{className:`text-white text-[12px] leading-[20px]`,children:r})]}):null}),_(`div`,{className:`flex items-center shrink-0`,children:s?_(`span`,{className:`text-white text-[12px] leading-[20px]`,children:o}):null})]})]}),_(`div`,{className:`mt-2 py-2`,children:_(`h3`,{className:`text-[16px] text-text1 truncate font-bold leading-[24px]`,children:e.title})})]});return _(`div`,{ref:t===ae?K:void 0,className:`flex-shrink-0 w-[116.67px]`,children:c?_(ne,{href:c,className:`block rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-primary`,children:l}):l},t)})})]})}export{A as ImageTextRecommendClient};
2
+ "use client";import e from"../../../../utils/get-res-url.mjs";import{pContentBatchGetVideoDetail as t,pContentGetPopularVideoList as n}from"../../../../service/generated/client.mjs";import{IMAGE_TEXT_RECOMMEND_FIXED_BATCH_SIZE as r,buildImageTextRecommendChosenTags as i,buildImageTextRecommendRemoteMap as a,buildImageTextRecommendSmartPicked as o,getImageTextRecommendFixedIds as s,getImageTextRecommendLayoutTags as c,resolveImageTextRecommendVideoId as l}from"../../../../hooks/image-text-recommend.mjs";import u from"../../../../assets/images/frame.mjs";import ee from"../../../../assets/images/subscript.mjs";import{useCallback as d,useEffect as f,useMemo as p,useRef as te,useState as m}from"react";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";import v from"next/image";import{useTranslations as ne}from"next-intl";import re from"next/link";const y=[];function b(t,n){if(!t||!t.trim())return n;if(t.startsWith(`http`)||t.startsWith(`//`)||t.startsWith(`data:`))return t;let r=e();return r?`${r}${t.startsWith(`/`)?t:`/${t}`}`:t}function x(e){if(e==null)return``;let t=e;return t.img_y||t.media?.img_y||``}function S(e){return e==null?``:e.name||``}function C(e){let t=e,n=t.type;return typeof n==`number`?n:t.is_more_link===!0||Number(t.episode_cnt||t.episode_count||t.episodes?.length||t.links?.length||0)>1?2:1}function w(e){if(!Number.isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${a(n)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}function T(e,t){let n=e,r=Number(n.episode_cnt??0);if(!Number.isFinite(r)||r<=0)return``;let i=n.update_status;return t(r,i===0||i===`0`)}function ie(e,t,n){return e?C(e)===2&&n?T(e,n):w(Number(e.duration??e.detail?.duration??0)):``}function ae(e,t){if(!(e??``).trim())return``;let n=encodeURIComponent((t??``).trim()||``);return`/video/${e.trim()}/${n}/episode/1`}function oe(e){if(!e)return``;let t=e,n=Number(t.static?.browse_cnt??0);if(!Number.isFinite(n)||n<=0)return``;if(n>=1e6){let e=(n/1e6).toFixed(1);return e.endsWith(`.0`)?`${e.slice(0,-2)}M`:`${e}M`}if(n>=1e3){let e=(n/1e3).toFixed(1);return e.endsWith(`.0`)?`${e.slice(0,-2)}k`:`${e}k`}return Math.floor(n).toString()}function se(){let e=new Date,t=new Date(e);return t.setHours(24,0,0,0),t.getTime()-e.getTime()}function E(e){let{title:C,items:w=y,commonPlayCount:T,commonEpisodes:E,layout:D,allEpisodesText:O,mode:k=`renderer`,initialRemoteMap:A,initialSmartList:j,initialLoadedBatchIndex:M,initialDataFromServer:N,initialSmartNextCursor:P}=e,F=ne(`components.biz.business.imageTextRecommend`),I=k===`editor`,[L,R]=m(N&&A!=null?A:{}),[z,B]=m(N&&j!=null?j:[]),[V,H]=m(N&&M!=null?M:0),[U,W]=m(P),G=te(null),K=!!D?.enabled,q=p(()=>c(D),[D]),J=w?.length??0,Y=p(()=>s(w,K),[K,w]),X=p(()=>K&&J>r?Math.ceil(J/r):Y.length>0?Math.ceil(Y.length/r):0,[K,J,Y.length]),Z=d((e,t)=>F(t?`updatedTo`:`allEpisodes`,{count:e}),[F]),Q=d(async(e,n)=>{if(e.length===0)return;let r=a((await t({ids:e})).data?.videos??[]);R(e=>n?{...e,...r}:r)},[]);f(()=>{if(I||N||!w||w.length===0)return;let e=!1;async function t(){if(Y.length===0){e||(R({}),H(0));return}if(Y.length<=r){await Q(Y,!1),e||H(1);return}await Q(Y.slice(0,r),!1),e||H(1)}async function a(){let t=i(q,J),a=r;if(J>a){let r=await n({page_size:a,tags:t.length?Array.from(new Set(t)):void 0}),i=(r.data?.videos??[]).slice(0,a);e||(B(i),W(r.data?.cursor),H(1))}else{let r=(await n({page_size:Math.max(20,J*10),tags:t.length?Array.from(new Set(t)):void 0})).data?.videos??[];e||B(o(r,t,J))}}return(async()=>{try{K?await a():await t()}catch{e||(R({}),B([]),H(0))}})(),()=>{e=!0}},[I,N,K,w,q,J,Y,Q]),f(()=>{if(I||X<1||V<1||V>=X)return;let e=G.current;if(!e)return;let t=new IntersectionObserver(e=>{let[t]=e;if(!t?.isIntersecting)return;let a=V;if(K){let e=i(q,J);n({page_size:r,cursor:U,tags:e.length?Array.from(new Set(e)):void 0}).then(e=>{let t=e.data?.videos??[];B(e=>[...e,...t.slice(0,r)]),W(e.data?.cursor),H(a+1)}).catch(()=>{})}else{let e=a*r,t=Y.slice(e,e+r);t.length>0&&(Q(t,!0),H(a+1))}},{root:null,rootMargin:`0px`,threshold:0});return t.observe(e),()=>t.disconnect()},[I,K,Y,V,X,q,J,U,Q]),f(()=>{if(I||!K||J<=0)return;let e,t=!1;function r(){e=window.setTimeout(()=>{let e=i(q,J);n({page_size:Math.max(20,J*10),tags:e.length?Array.from(new Set(e)):void 0}).then(n=>{t||B(o(n.data?.videos??[],e,J))}).catch(()=>{t||B([])}).finally(()=>{t||r()})},se())}return r(),()=>{t=!0,e!==void 0&&window.clearTimeout(e)}},[I,K,q,J]);let $=p(()=>!w||w.length===0?y:K&&J>r?w.slice(0,z.length):w,[w,K,J,z.length]),ce=p(()=>$.length?$.map((e,t)=>{let n=String(e?.contentId??``).trim(),r=K?z[t]:n?L[n]:void 0,i=K?r?S(r):(e?.title??``).trim():(e?.title??``).trim()||(r?S(r):``),a=(e?.cover??``).trim(),o=K?x(r)||a:a||(e?.useVideoPoster?x(r):``),s=K&&String(r?.description??r?.content_description??``).trim()||(e?.contentDescription??``).trim(),c=ie(r,O,Z),u=oe(r);return{...e,contentId:n||(r?l(r):``),title:i,cover:o,contentDescription:s,episodeOrDurationText:c,playCountText:u}}):y,[O,Z,K,$,L,z]);if(!w||w.length===0)return null;let le=V>=1&&V<X?K?z.length-2:V*r-2:-1;return _(`div`,{className:I?`bg-bg1 px-3 py-3 pointer-events-none`:`bg-bg1 px-3 py-3`,children:[C&&g(`div`,{className:`mb-3 flex items-center justify-between`,children:g(`h2`,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:C})}),g(`div`,{className:`flex overflow-x-auto pb-2 scrollbar-hide space-x-2`,children:ce.map((e,t)=>{let n=K?T:e.showPlayCount??!1,r=(e.playCountText??``).trim(),i=r!==``,a=K?E:e.showEpisodes??!1,o=(e.episodeOrDurationText??``).trim(),s=a&&o!==``,c=k===`renderer`?ae(e.contentId??``,e.title??``):``,l=_(h,{children:[_(`div`,{className:`relative aspect-[116.67/155.56] rounded-lg overflow-hidden bg-bg2`,children:[I||e.cover?g(v,{src:b(e.cover,u),alt:e.title??``,fill:!0,sizes:`116.67px`,className:`object-cover text-[10px] text-text3`,unoptimized:!0}):g(`div`,{className:`w-full h-full flex items-center justify-center text-text3 text-xs`,children:F(`noCover`)}),!K&&(e.badge??``).trim()?g(`div`,{className:`absolute top-0 right-0 w-8 h-8`,children:g(v,{src:(e.badge??``).trim()||ee,alt:``,fill:!0,sizes:`32px`,className:`object-contain object-right-top`,unoptimized:!0})}):null,_(`div`,{className:`absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent pb-1 pt-3 px-1 flex justify-between items-center gap-1`,children:[g(`div`,{className:`flex items-center min-w-0 shrink`,children:n&&i?_(`div`,{className:`flex items-center gap-1 rounded bg-overlay px-1 py-0`,children:[g(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`10`,viewBox:`0 0 12 10`,fill:`none`,className:`shrink-0`,"aria-hidden":!0,children:g(`path`,{d:`M7.56 5.18437L5.013 6.56737C4.893 6.63337 4.761 6.66937 4.638 6.66937C4.269 6.66937 4.002 6.38737 4.002 5.99737V3.28237C4.002 2.89237 4.269 2.61037 4.638 2.61037C4.764 2.61037 4.893 2.64637 5.013 2.70937L7.572 4.09237C7.803 4.21837 7.938 4.41637 7.938 4.63237C7.938 4.85137 7.8 5.05537 7.56 5.18437ZM9.807 9.27637L2.133 8.52937C0.954 8.52937 0 7.57537 0 6.39637V2.79937C0 1.62037 0.954 0.666368 2.133 0.666368L9.81 0.000367165C10.989 0.000367165 11.943 0.954367 11.943 2.13337V7.14337C11.9422 7.70935 11.7168 8.25188 11.3163 8.65181C10.9158 9.05174 10.373 9.27637 9.807 9.27637ZM10.875 2.13337C10.875 1.99351 10.8475 1.85502 10.7939 1.72581C10.7404 1.5966 10.662 1.47919 10.5631 1.3803C10.4642 1.2814 10.3468 1.20296 10.2176 1.14944C10.0883 1.09591 9.94986 1.06837 9.81 1.06837L2.133 1.73437C1.99314 1.73437 1.85465 1.76191 1.72544 1.81544C1.59623 1.86896 1.47883 1.9474 1.37993 2.0463C1.28104 2.14519 1.20259 2.2626 1.14907 2.39181C1.09555 2.52102 1.068 2.65951 1.068 2.79937V6.39637C1.068 6.67882 1.1802 6.94971 1.37993 7.14944C1.57966 7.34916 1.85054 7.46137 2.133 7.46137L9.807 8.20837C9.94686 8.20837 10.0853 8.18082 10.2146 8.1273C10.3438 8.07378 10.4612 7.99533 10.5601 7.89644C10.659 7.79754 10.7374 7.68014 10.7909 7.55093C10.8445 7.42171 10.872 7.28323 10.872 7.14337V2.13337H10.875Z`,fill:`white`})}),g(`span`,{className:`text-white text-[12px] leading-[20px]`,children:r})]}):null}),g(`div`,{className:`flex items-center shrink-0`,children:s?g(`span`,{className:`text-white text-[12px] leading-[20px]`,children:o}):null})]})]}),g(`div`,{className:`mt-2 py-2`,children:g(`h3`,{className:`text-[16px] text-text1 truncate font-bold leading-[24px]`,children:e.title})})]});return g(`div`,{ref:t===le?G:void 0,className:`flex-shrink-0 w-[116.67px]`,children:c?g(re,{href:c,className:`block rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-primary`,children:l}):l},t)})})]})}export{E as ImageTextRecommendClient};
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineNumberPropSchema as n,defineObjectPropSchema as r,defineSwitchPropSchema as i,defineTextPropSchema as a}from"../../../../utils/schema/schema.mjs";import{z as o}from"zod";const s=o.object({contentId:a({label:`推荐位内容`,defaultValue:``}),title:a({label:`推荐位内容名称`,defaultValue:`视频标题`}),contentDescription:a({label:`内容说明简介`,defaultValue:``}),cover:a({label:`推荐位封面`,defaultValue:``}),useVideoPoster:i({label:`沿用视频海报`,defaultValue:!0}),showPlayCount:i({label:`播放量显示`,defaultValue:!1}),showEpisodes:i({label:`集数展示`,defaultValue:!0}),badge:a({label:`推荐位角标`,defaultValue:``,description:`角标图片地址,可通过低代码平台配置上传;留空则使用默认角标图`})}),c=t({title:a({label:`推荐位名称`,defaultValue:`推荐视频`}),moduleCount:n({label:`推荐模块数`,defaultValue:1}),layout:r({enabled:i({label:`智能铺设`,defaultValue:!1}),tags:e(o.string(),{label:`取数范围标签`,defaultValue:[`电影`]})},{label:`组件铺设`,defaultValue:{enabled:!1,tags:[`电影`]}}),commonPlayCount:i({label:`通用播放量`,defaultValue:!0}),commonEpisodes:i({label:`通用集数`,defaultValue:!0}),items:e(s,{label:`推荐位模块`,defaultValue:[{contentId:``,title:`视频标题 1`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``},{contentId:``,title:`视频标题 2`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``},{contentId:``,title:`视频标题 3`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``}]})});export{c as imageTextRecommendInspectorPropsSchema};
2
+ import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineNumberPropSchema as n,defineObjectPropSchema as r,defineSwitchPropSchema as i,defineTextPropSchema as a}from"../../../../utils/schema/schema.mjs";import{z as o}from"zod";const s=o.object({contentId:a({label:`推荐位内容`,defaultValue:``}),title:a({label:`推荐位内容名称`,defaultValue:`视频标题`}),contentDescription:a({label:`内容说明简介`,defaultValue:``}),cover:a({label:`推荐位封面`,defaultValue:``}),useVideoPoster:i({label:`沿用视频海报`,defaultValue:!0}),showPlayCount:i({label:`播放量显示`,defaultValue:!1}),showEpisodes:i({label:`集数展示`,defaultValue:!0}),badge:a({label:`推荐位角标`,defaultValue:``,description:`角标图片地址,可通过低代码平台配置上传;留空则使用默认角标图`})}),c=t({title:a({label:`推荐位名称`,defaultValue:`推荐视频`}),moduleCount:n({label:`推荐模块数`,defaultValue:1}),layout:r({enabled:i({label:`智能铺设`,defaultValue:!1}),tags:e(o.string(),{label:`取数范围标签`,defaultValue:[`电影`]})},{label:`组件铺设`,defaultValue:{enabled:!1,tags:[`电影`]}}),commonPlayCount:i({label:`通用播放量`,defaultValue:!0}),commonEpisodes:i({label:`通用集数`,defaultValue:!0}),items:e(s,{label:`推荐位模块`,defaultValue:[{contentId:`d6a35ba3279e6f0d`,title:`视频标题 1`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``},{contentId:`eaf60eab4938489d`,title:`视频标题 2`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``},{contentId:`c45fe58f91d1c986`,title:`视频标题 3`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``}]})});export{c as imageTextRecommendInspectorPropsSchema};
@@ -1,2 +1,2 @@
1
1
 
2
- import{pContentBatchGetVideoDetail as e,pContentGetPopularVideoList as t}from"../../../../service/generated/client.mjs";import{IMAGE_TEXT_RECOMMEND_FIXED_BATCH_SIZE as n,buildImageTextRecommendChosenTags as r,buildImageTextRecommendRemoteMap as i,buildImageTextRecommendSmartPicked as a,getImageTextRecommendFixedIds as o,getImageTextRecommendLayoutTags as s}from"../../../../hooks/image-text-recommend.mjs";import{ImageTextRecommendClient as c}from"./client.mjs";import{jsx as l}from"react/jsx-runtime";import{getTranslations as u}from"next-intl/server";const d=[];async function f(f){let{mode:p=`renderer`,items:m=d,layout:h,...g}=f,_,v,y,b=!1,x=``,S=``;try{let e=await u(`components.biz.business.imageTextRecommend`);x=e.raw(`allEpisodes`),S=e.raw(`updatedTo`)}catch{}let C=!!h?.enabled,w=o(m,C),T=s(h),E=m?.length??0;if(p===`renderer`&&m?.length)try{if(C){let e=r(T,E);v=a((await t({page_size:Math.max(20,E*10),tags:e.length?Array.from(new Set(e)):void 0})).data?.videos??[],e,E),_={},y=0,b=!0}else w.length>0&&(_=i((await e({ids:w.length<=n?w:w.slice(0,n)})).data?.videos??[]),v=[],y=1,b=!0)}catch{b=!1}return l(c,{...g,items:m,layout:h,mode:p,allEpisodesText:x,updatedToText:S,initialRemoteMap:_,initialSmartList:v,initialLoadedBatchIndex:y,initialDataFromServer:b})}export{f as ImageTextRecommendServer};
2
+ import{pContentBatchGetVideoDetail as e,pContentGetPopularVideoList as t}from"../../../../service/generated/client.mjs";import{IMAGE_TEXT_RECOMMEND_FIXED_BATCH_SIZE as n,buildImageTextRecommendChosenTags as r,buildImageTextRecommendRemoteMap as i,buildImageTextRecommendSmartPicked as a,getImageTextRecommendFixedIds as o,getImageTextRecommendLayoutTags as s}from"../../../../hooks/image-text-recommend.mjs";import{ImageTextRecommendClient as c}from"./client.mjs";import{jsx as l}from"react/jsx-runtime";import{getTranslations as u}from"next-intl/server";const d=[];async function f(f){let{mode:p=`renderer`,items:m=d,layout:h,...g}=f,_,v,y,b,x=!1,S=``,C=``;try{let e=await u(`components.biz.business.imageTextRecommend`);S=e.raw(`allEpisodes`),C=e.raw(`updatedTo`)}catch{}let w=!!h?.enabled,T=o(m,w),E=s(h),D=m?.length??0;if(p===`renderer`&&m?.length)try{if(w){let e=r(E,D);if(D>n){let r=await t({page_size:n,tags:e.length?Array.from(new Set(e)):void 0});v=(r.data?.videos??[]).slice(0,n),b=r.data?.cursor,y=1}else v=a((await t({page_size:Math.max(20,D*10),tags:e.length?Array.from(new Set(e)):void 0})).data?.videos??[],e,D),y=0;_={},x=!0}else T.length>0&&(_=i((await e({ids:T.length<=n?T:T.slice(0,n)})).data?.videos??[]),v=[],y=1,x=!0)}catch{x=!1}return l(c,{...g,items:m,layout:h,mode:p,allEpisodesText:S,updatedToText:C,initialRemoteMap:_,initialSmartList:v,initialLoadedBatchIndex:y,initialDataFromServer:x,initialSmartNextCursor:b})}export{f as ImageTextRecommendServer};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Image as e}from"../../../ui/image.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import r from"../../../../assets/icons/right_arrow.mjs";import i from"../../../../assets/images/marquee.mjs";import a from"./marquee.module.mjs";import{defaultMarqueePeriod as o}from"./schema.mjs";import{useEffect as s,useMemo as c,useState as l}from"react";import{X as u}from"lucide-react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{useTranslations as p}from"next-intl";import{useRouter as m}from"next/navigation";const h=[];function g(e,t=20){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function _(e){let t=5381;for(let n=0;n<e.length;n+=1)t=(t<<5)+t^(e.codePointAt(n)??0);return(t>>>0).toString(36)}function v(e,t){return e?t===`once`?!0:new Date(e).toLocaleDateString()===new Date().toLocaleDateString():!1}function y(e){let t=localStorage.getItem(e);if(!t)return{};try{return JSON.parse(t)}catch{let e=Number(t);return Number.isNaN(e)?{}:{closedAt:e}}}function b(e,t){localStorage.setItem(e,JSON.stringify(t))}function x(x){let S=p(`components.biz.business.marquee`),{contents:C=h,click:w,close:T,displayStrategy:E,mode:D=`renderer`}=x,O=D===`editor`,k=m(),[A,j]=l(!0),[M,N]=l(!1),[P,F]=l(0);s(()=>{N(!0)},[]);let I=c(()=>{let e=E?.period??o,t=e.start,n=e.end;if(!t&&!n)return!0;let r=Date.now(),i=t?new Date(t).getTime():0,a=n?new Date(n).getTime():2**53-1;return r>=i&&r<=a},[E?.period]),L=c(()=>(C??[]).map(e=>({...e,text:g(String(e?.text??``))})).filter(e=>!!e.text),[C]),R=c(()=>{let e=E?.period??o;return`marquee_state_${_(JSON.stringify({start:e.start??``,end:e.end??``,items:L.map(e=>({text:e.text??``,link:e.link??``}))}))}`},[E?.period,L]);if(s(()=>{F(0)},[L.length]),s(()=>{if(!M||O||!E?.rule||L.length===0)return;let e=y(R),t=v(e.displayedAt,E.rule),n=v(e.closedAt,E.rule);j(!(t||n))},[E?.rule,O,M,L.length,R]),s(()=>{if(!M||O||!E?.rule||!A||!I||L.length===0)return;let e=y(R);v(e.displayedAt,E.rule)||b(R,{...e,displayedAt:Date.now()})},[E?.rule,O,M,I,A,L.length,R]),!O&&(!M||!A||!I)||L.length===0)return null;let z=L[P%L.length],B=w?.enabled===!0,V=w?.link||z.link,H=B&&!!V,U=T?.enabled===!0;function W(){!E?.rule||L.length===0||b(R,{...y(R),closedAt:Date.now()})}let G=e=>{e.stopPropagation(),j(!1),W()},K=()=>{O||H&&V&&(U&&(j(!1),W()),k.push(V))},q=()=>{O||!A||L.length<=1||F(e=>(e+1)%L.length)},J=O?a[`marquee-item-paused`]:L.length>1?a[`marquee-item-once`]:a[`marquee-item-loop`];return d(t,{className:O?`px-3 py-2 w-full bg-bg1 pointer-events-none`:`px-3 py-2 w-full bg-bg1`,children:f(t,{className:`pl-[2px] pr-[12px] py-[2px] flex items-center w-full cursor-pointer relative rounded-[8px] overflow-hidden ${a[`marquee-shell`]}`,onClick:K,children:[d(t,{className:`relative shrink-0 w-[36px] h-[36px] mr-[4px]`,children:d(e,{src:typeof i==`string`?i:i.src,alt:S(`noticeAlt`),fill:!0,className:`object-cover`,unoptimized:!0})}),d(t,{className:`flex-1 overflow-hidden relative h-[22px] ml-1`,children:d(t,{className:`absolute inset-y-0 left-0 flex items-center whitespace-nowrap ${J}`,onAnimationEnd:q,children:d(n,{className:`inline-block text-[14px] text-[#f59e0b] leading-[22px] font-medium`,children:z.text})},`marquee-item-${P}`)}),f(t,{className:`flex items-center gap-[12px] shrink-0 ml-[4px]`,children:[H&&d(r,{className:`w-[16px] h-[16px] text-[#f59e0b]`}),U&&d(t,{className:`opacity-30 hover:opacity-100 transition-opacity`,onClick:G,children:d(u,{className:`w-[12px] h-[12px] text-[#F59E0B]`})})]})]})})}export{x as MarqueeClient};
2
+ "use client";import{Image as e}from"../../../ui/image.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import r from"../../../../assets/icons/right_arrow.mjs";import i from"../../../../assets/images/marquee.mjs";import a from"./marquee.module.mjs";import{defaultMarqueePeriod as o}from"./schema.mjs";import{useEffect as s,useMemo as c,useRef as l,useState as u}from"react";import{X as d}from"lucide-react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{useTranslations as m}from"next-intl";import{useRouter as h}from"next/navigation";const g=[];function _(e){return`${e}_visible_session`}function v(e,t=20){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function y(e){let t=5381;for(let n=0;n<e.length;n+=1)t=(t<<5)+t^(e.codePointAt(n)??0);return(t>>>0).toString(36)}function b(e,t){return e?t===`once`?!0:new Date(e).toLocaleDateString()===new Date().toLocaleDateString():!1}function x(e){let t=localStorage.getItem(e);if(!t)return{};try{return JSON.parse(t)}catch{let e=Number(t);return Number.isNaN(e)?{}:{closedAt:e}}}function S(e,t){localStorage.setItem(e,JSON.stringify(t))}function C(e){return sessionStorage.getItem(_(e))===`1`}function w(e,t){if(t){sessionStorage.setItem(_(e),`1`);return}sessionStorage.removeItem(_(e))}function T(_){let T=m(`components.biz.business.marquee`),{contents:E=g,click:D,close:O,displayStrategy:k,mode:A=`renderer`}=_,j=A===`editor`,M=h(),[N,P]=u(!0),[F,I]=u(!1),[L,R]=u(0),z=l(!1);s(()=>{I(!0)},[]);let B=c(()=>{let e=k?.period??o,t=e.start,n=e.end;if(!t&&!n)return!0;let r=Date.now(),i=t?new Date(t).getTime():0,a=n?new Date(n).getTime():2**53-1;return r>=i&&r<=a},[k?.period]),V=c(()=>(E??[]).map(e=>({...e,text:v(String(e?.text??``))})).filter(e=>!!e.text),[E]),H=c(()=>{let e=k?.period??o;return`marquee_state_${y(JSON.stringify({start:e.start??``,end:e.end??``,items:V.map(e=>({text:e.text??``,link:e.link??``}))}))}`},[k?.period,V]);if(s(()=>{z.current=C(H),P(!0)},[H]),s(()=>{R(0)},[V.length]),s(()=>{if(!F||j||!k?.rule||V.length===0)return;let e=x(H),t=b(e.displayedAt,k.rule),n=b(e.closedAt,k.rule);if(z.current=C(H),n){P(!1);return}if(t&&!z.current){P(!1);return}P(!0)},[k?.rule,j,F,V.length,H]),s(()=>{if(!F||j||!k?.rule||!N||!B||V.length===0)return;let e=x(H);b(e.displayedAt,k.rule)||S(H,{...e,displayedAt:Date.now()}),z.current=!0,w(H,!0)},[k?.rule,j,F,B,N,V.length,H]),!j&&(!F||!N||!B)||V.length===0)return null;let U=V[L%V.length],W=D?.enabled===!0,G=D?.link||U.link,K=W&&!!G,q=O?.enabled===!0;function J(){!k?.rule||V.length===0||(z.current=!0,w(H,!1),S(H,{...x(H),closedAt:Date.now()}))}let Y=e=>{e.stopPropagation(),P(!1),J()},X=()=>{j||K&&G&&(q&&(P(!1),J()),M.push(G))},Z=()=>{j||!N||V.length<=1||R(e=>(e+1)%V.length)},Q=j?a[`marquee-item-paused`]:V.length>1?a[`marquee-item-once`]:a[`marquee-item-loop`];return f(t,{className:j?`px-3 py-2 w-full bg-bg1 pointer-events-none`:`px-3 py-2 w-full bg-bg1`,children:p(t,{className:`pl-[2px] pr-[12px] py-[2px] flex items-center w-full cursor-pointer relative rounded-[8px] overflow-hidden ${a[`marquee-shell`]}`,onClick:X,children:[f(t,{className:`relative shrink-0 w-[36px] h-[36px] mr-[4px]`,children:f(e,{src:typeof i==`string`?i:i.src,alt:T(`noticeAlt`),fill:!0,className:`object-cover`,unoptimized:!0})}),f(t,{className:`flex-1 overflow-hidden relative h-[22px] ml-1`,children:f(t,{className:`absolute inset-y-0 left-0 flex items-center whitespace-nowrap ${Q}`,onAnimationEnd:Z,children:f(n,{className:`inline-block text-[14px] text-[#f59e0b] leading-[22px] font-medium`,children:U.text})},`marquee-item-${L}`)}),p(t,{className:`flex items-center gap-[12px] shrink-0 ml-[4px]`,children:[K&&f(r,{className:`w-[16px] h-[16px] text-[#f59e0b]`}),q&&f(t,{className:`opacity-30 hover:opacity-100 transition-opacity`,onClick:Y,children:f(d,{className:`w-[12px] h-[12px] text-[#F59E0B]`})})]})]})})}export{T as MarqueeClient};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import e from"../../../../utils/event-bus.mjs";import{Box as t}from"../../../ui/box.mjs";import{Input as n}from"../../../ui/input.mjs";import{Text as r}from"../../../ui/text.mjs";import{eventKey as i}from"../../../../constants/event-key.mjs";import a from"../../../../assets/icons/left_arrow.mjs";import o from"../../../../assets/icons/search.mjs";import s from"../../../../assets/icons/clear.mjs";import{useCallback as c,useEffect as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{useTranslations as p}from"next-intl";import{usePathname as m,useRouter as h,useSearchParams as g}from"next/navigation";function _(_){let v=p(`components.pages.search`),{placeholder:y,defaultPlaceholder:b,searchLabel:x,storageKey:S=`guest`,onSearch:C,mode:w=`renderer`}=_,T=y||(b??v(`topHeader.placeholder`)),E=x??v(`topHeader.search`),D=w===`editor`,[O,k]=u(``),A=h(),j=m(),M=g(),N=`search_history_${S}`,P=c(t=>{if(!D&&t.trim()){try{let n=localStorage.getItem(N),r=n?JSON.parse(n):[];r=[t,...r.filter(e=>e!==t)],localStorage.setItem(N,JSON.stringify(r.slice(0,20))),e.emit(i.SEARCH_HISTORY_UPDATE)}catch(e){console.error(`Failed to save search history`,e)}if(C)C(t);else{let e=new URLSearchParams(M.toString());e.set(`q`,t);let n=j.includes(`/search`)?j:`/search`;A.push(`${n}?${e.toString()}`)}}},[N,D,C,j,A,M]);l(()=>{let e=M.get(`q`);e&&e!==O&&(k(e),P(e))},[M,P,O]),l(()=>{if(!D&&O===``){if(M.has(`q`)){let e=new URLSearchParams(M.toString());e.delete(`q`);let t=j.includes(`/search`)?j:`/search`;A.push(`${t}${e.toString()?`?${e.toString()}`:``}`)}e.emit(i.SEARCH_HISTORY_UPDATE)}},[D,O,j,A,M]);let F=()=>{P(O)};return f(t,{className:D?`px-3 py-2 bg-bg1 flex items-center gap-3 w-full pointer-events-none`:`px-3 py-2 bg-bg1 flex items-center gap-3 w-full`,children:[d(t,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:()=>{D||A.back()},children:d(a,{className:`w-4 h-4 text-text1`})}),f(t,{className:`flex-1 flex items-center gap-1 bg-bg2 border border-theme5 rounded-[20px] px-2 py-1.5 overflow-hidden`,children:[d(t,{className:`p-1 shrink-0`,children:d(o,{className:`w-[14px] h-[14px] text-text3`})}),d(n,{className:`flex-1 border-none bg-transparent p-0 h-auto text-[14px] leading-[22px] focus-visible:ring-0 text-text1 placeholder:text-text3`,placeholder:T,value:O,onChange:e=>k(e.target.value),onKeyDown:e=>e.key===`Enter`&&F()}),O&&d(s,{className:`w-[15px] h-[15px] text-text3 shrink-0 cursor-pointer active:opacity-70`,onClick:()=>{k(``)}})]}),d(t,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:F,children:d(r,{className:`text-[16px] text-text1 leading-[24px] font-normal`,children:E})})]})}export{_ as SearchInputClient};
2
+ "use client";import e from"../../../../utils/event-bus.mjs";import{Box as t}from"../../../ui/box.mjs";import{Input as n}from"../../../ui/input.mjs";import{Text as r}from"../../../ui/text.mjs";import{eventKey as i}from"../../../../constants/event-key.mjs";import a from"../../../../assets/icons/left_arrow.mjs";import o from"../../../../assets/icons/search.mjs";import s from"../../../../assets/icons/clear.mjs";import{useCallback as c,useEffect as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{useTranslations as p}from"next-intl";import{usePathname as m,useRouter as h,useSearchParams as g}from"next/navigation";function _(_){let v=p(`components.pages.search`),{placeholder:y,defaultPlaceholder:b,searchLabel:x,storageKey:S=`guest`,onSearch:C,mode:w=`renderer`}=_,T=y||(b??v(`topHeader.placeholder`)),E=x??v(`topHeader.search`),D=w===`editor`,[O,k]=u(``),A=h(),j=m(),M=g(),N=`search_history_${S}`,P=c(t=>{if(!D&&t.trim()){try{let n=localStorage.getItem(N),r=n?JSON.parse(n):[];r=[t,...r.filter(e=>e!==t)],localStorage.setItem(N,JSON.stringify(r.slice(0,20))),e.emit(i.SEARCH_HISTORY_UPDATE)}catch(e){console.error(`Failed to save search history`,e)}if(C)C(t);else{let e=new URLSearchParams(M.toString());e.set(`q`,t);let n=j.includes(`/search`)?j:`/search`;A.push(`${n}?${e.toString()}`)}}},[N,D,C,j,A,M]);l(()=>{let e=M.get(`q`);e&&e!==O&&(k(e),P(e))},[M,P,O]),l(()=>{if(!D&&O===``){if(M.has(`q`)){let e=new URLSearchParams(M.toString());e.delete(`q`);let t=j.includes(`/search`)?j:`/search`;A.push(`${t}${e.toString()?`?${e.toString()}`:``}`)}e.emit(i.SEARCH_HISTORY_UPDATE)}},[D,O,j,A,M]);let F=()=>{P(O)};function I(){if(k(``),!D){if(M.has(`q`)){let e=new URLSearchParams(M.toString());e.delete(`q`);let t=j.includes(`/search`)?j:`/search`;A.push(`${t}${e.toString()?`?${e.toString()}`:``}`)}e.emit(i.SEARCH_HISTORY_UPDATE)}}return f(t,{className:D?`px-3 py-2 bg-bg1 flex items-center gap-3 w-full pointer-events-none`:`px-3 py-2 bg-bg1 flex items-center gap-3 w-full`,children:[d(t,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:()=>{D||A.back()},children:d(a,{className:`w-4 h-4 text-text1`})}),f(t,{className:`flex-1 flex items-center gap-1 bg-bg2 border border-theme5 rounded-[20px] px-2 py-1.5 overflow-hidden`,children:[d(t,{className:`p-1 shrink-0`,children:d(o,{className:`w-[14px] h-[14px] text-text3`})}),d(n,{className:`flex-1 border-none bg-transparent p-0 h-auto text-[14px] leading-[22px] focus-visible:ring-0 text-text1 placeholder:text-text3`,placeholder:T,value:O,onChange:e=>k(e.target.value),onKeyDown:e=>e.key===`Enter`&&F()}),O&&d(s,{className:`w-[15px] h-[15px] text-text3 shrink-0 cursor-pointer active:opacity-70`,onClick:I})]}),d(t,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:F,children:d(r,{className:`text-[16px] text-text1 leading-[24px] font-normal`,children:E})})]})}export{_ as SearchInputClient};
@@ -11,7 +11,7 @@ interface ClientProps extends TextRecommendProps {
11
11
  }
12
12
  /**
13
13
  * 文字推荐物料组件 (推荐搜索) - 客户端交互部分
14
- * 适配 Figma 设计稿布局:一行展示2个,包含“换一批”功能
14
+ * 适配 Figma 设计稿布局:一行展示2个,包含“换一批”功能,每批固定 6 个
15
15
  */
16
16
  declare function TextRecommendClient(props: ClientProps): react_jsx_runtime0.JSX.Element | null;
17
17
  //#endregion
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Box as e}from"../../../ui/box.mjs";import{Text as t}from"../../../ui/text.mjs";import n from"../../../../assets/icons/refresh.mjs";import{useMemo as r,useState as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{useTranslations as s}from"next-intl";import{usePathname as c,useRouter as l,useSearchParams as u}from"next/navigation";const d=[];function f(f){let p=s(`components.biz.business.textRecommend`),{title:m,displayCount:h=6,items:g=d,onItemClick:_,mode:v=`renderer`}=f,y=v===`editor`,b=l(),x=c(),S=u(),[C,w]=i(0),T=Math.ceil(g.length/h),E=r(()=>{if(g.length<=h)return g;let e=C%T*h;return g.slice(e,e+h)},[g,h,C,T]);if(g.length===0)return null;let D=e=>{e.stopPropagation(),w(e=>e+1)},O=e=>{if(_)_(e);else{let t=new URLSearchParams(S.toString());t.set(`q`,e);let n=x.includes(`/search`)?x:`/search`;b.push(`${n}?${t.toString()}`)}};return o(e,{className:y?`bg-bg1 p-3 flex flex-col gap-3 w-full pointer-events-none`:`bg-bg1 p-3 flex flex-col gap-3 w-full`,children:[o(e,{className:`flex items-center justify-between w-full`,children:[a(t,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:m||p(`defaultTitle`)}),o(e,{className:`flex items-center gap-1 cursor-pointer active:opacity-70 transition-opacity`,onClick:D,children:[a(t,{className:`text-[14px] text-text3 leading-[22px]`,children:p(`refreshBatch`)}),a(n,{className:`w-3 h-3 text-text3`})]})]}),a(e,{className:`grid grid-cols-2 gap-x-1 gap-y-1 w-full`,children:E.map((n,r)=>a(e,{className:`flex items-center h-[32px] cursor-pointer active:opacity-70 transition-opacity overflow-hidden`,onClick:()=>O(n.label),children:a(t,{className:`text-[14px] text-text1 leading-[22px] truncate w-full`,children:n.label})},`${C}-${r}`))})]})}export{f as TextRecommendClient};
2
+ "use client";import{Box as e}from"../../../ui/box.mjs";import{Text as t}from"../../../ui/text.mjs";import n from"../../../../assets/icons/refresh.mjs";import{useMemo as r,useState as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{useTranslations as s}from"next-intl";import{usePathname as c,useRouter as l,useSearchParams as u}from"next/navigation";const d=[];function f(f){let p=s(`components.biz.business.textRecommend`),{title:m,items:h=d,onItemClick:g,mode:_=`renderer`}=f,v=_===`editor`,y=l(),b=c(),x=u(),[S,C]=i(0),w=Math.ceil(h.length/6),T=r(()=>{if(h.length<=6)return h;let e=S%w*6;return h.slice(e,e+6)},[h,S,w]);if(h.length===0)return null;let E=e=>{e.stopPropagation(),C(e=>e+1)},D=e=>{if(g)g(e);else{let t=new URLSearchParams(x.toString());t.set(`q`,e);let n=b.includes(`/search`)?b:`/search`;y.push(`${n}?${t.toString()}`)}};return o(e,{className:v?`bg-bg1 p-3 flex flex-col gap-3 w-full pointer-events-none`:`bg-bg1 p-3 flex flex-col gap-3 w-full`,children:[o(e,{className:`flex items-center justify-between w-full`,children:[a(t,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:m||p(`defaultTitle`)}),o(e,{className:`flex items-center gap-1 cursor-pointer active:opacity-70 transition-opacity`,onClick:E,children:[a(t,{className:`text-[14px] text-text3 leading-[22px]`,children:p(`refreshBatch`)}),a(n,{className:`w-3 h-3 text-text3`})]})]}),a(e,{className:`grid grid-cols-2 gap-x-1 gap-y-1 w-full`,children:T.map((n,r)=>a(e,{className:`flex items-center h-[32px] cursor-pointer active:opacity-70 transition-opacity overflow-hidden`,onClick:()=>D(n.label),children:a(t,{className:`text-[14px] text-text1 leading-[22px] truncate w-full`,children:n.label})},`${S}-${r}`))})]})}export{f as TextRecommendClient};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{useIsLoggedIn as e,useOpenLogin as t}from"../../../hooks/use-auth.mjs";import{useEffect as n}from"react";import{Fragment as r,jsx as i}from"react/jsx-runtime";function a({children:a}){let o=e(),s=t();return n(()=>{o||s()},[o,s]),o?i(r,{children:a}):null}export{a as AuthGuard};
2
+ "use client";import{useUserStore as e}from"../../../store/modules/user-store.mjs";import{useIsLoggedIn as t,useLoginModalOpen as n,useOpenLogin as r}from"../../../hooks/use-auth.mjs";import{useEffect as i,useRef as a}from"react";import{Fragment as o,jsx as s}from"react/jsx-runtime";import{useRouter as c}from"next/navigation";function l({children:l}){let u=t(),d=n(),f=r(),p=c(),m=a(null);return i(()=>{u||f()},[u,f]),i(()=>{let t=m.current;if(m.current=d,t===!0&&d===!1){let t=setTimeout(()=>{e.getState().isLogin||p.back()},0);return()=>clearTimeout(t)}},[d,p]),u?s(o,{children:l}):null}export{l as AuthGuard};
@@ -6,7 +6,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
6
6
  //#region components/ui/badge.d.ts
7
7
  /** badgeVariants 工具定义。 */
8
8
  declare const badgeVariants: (props?: ({
9
- variant?: "default" | "destructive" | "secondary" | "outline" | "ghost" | "link" | null | undefined;
9
+ variant?: "default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
10
10
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
11
11
  /** Badge 组件。 */
12
12
  declare function Badge({
@@ -7,8 +7,8 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
7
7
  //#region components/ui/button.d.ts
8
8
  /** buttonVariants 工具定义。 */
9
9
  declare const buttonVariants: (props?: ({
10
- variant?: "default" | "destructive" | "secondary" | "outline" | "ghost" | "link" | null | undefined;
11
- size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
10
+ variant?: "default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
11
+ size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
12
12
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
13
13
  /** Button 组件属性。 */
14
14
  type ButtonProps = Button.Props & VariantProps<typeof buttonVariants> & {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@funhub/platform",
3
3
  "type": "module",
4
- "version": "0.1.61",
4
+ "version": "0.1.63",
5
5
  "private": false,
6
6
  "sideEffects": [
7
7
  "**/*.css"