@funhub/platform 0.1.95 → 0.1.97

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.
@@ -1,2 +1,2 @@
1
1
 
2
- import{headers as e}from"next/headers";const t={detailId:``,currentSeriesNum:1};async function n(){let n=await e(),a=[n.get(`x-invoke-path`),n.get(`x-matched-path`),n.get(`next-url`),n.get(`x-next-url`),n.get(`x-original-uri`),n.get(`x-rewrite-url`),n.get(`referer`)].map(e=>r(e)).filter(Boolean);for(let e of a){let t=i(e);if(t.detailId)return t}return t}function r(e){if(!e)return``;let t=e.trim();if(!t)return``;if(t.startsWith(`/`))return t.split(`?`)[0]||``;try{return new URL(t).pathname||``}catch{return``}}function i(e){let n=e.split(`/`).filter(Boolean);if(!n.length)return t;let r=n.findIndex(e=>e===`video`||e===`webview`);if(r<0||n.length<=r+1)return t;let i=String(n[r+1]||``).trim();if(!i)return t;let a=n.findIndex((e,t)=>t>r&&e===`episode`),o=a>=0?Number(n[a+1]):1;return{detailId:i,currentSeriesNum:Number.isFinite(o)&&o>0?Math.floor(o):1}}export{n as resolveVideoDetailRouteContext};
2
+ import{headers as e}from"next/headers";const t={detailId:``,currentSeriesNum:1};async function n(){let n=await e(),a=[n.get(`next-url`),n.get(`x-next-url`),n.get(`x-original-uri`),n.get(`x-rewrite-url`),n.get(`x-invoke-path`),n.get(`x-matched-path`),n.get(`referer`)].map(e=>r(e)).filter(Boolean);for(let e of a){let t=i(e);if(t.detailId)return t}return t}function r(e){if(!e)return``;let t=e.trim();if(!t)return``;if(t.startsWith(`/`))return t.split(`?`)[0]||``;try{return new URL(t).pathname||``}catch{return``}}function i(e){let n=e.split(`/`).filter(Boolean);if(!n.length)return t;let r=n.findIndex(e=>e===`video`||e===`webview`);if(r<0||n.length<=r+1)return t;let i=o(n[r+1]);if(!i)return t;let s=n.findIndex((e,t)=>t>r&&e===`episode`);return{detailId:i,currentSeriesNum:a(s>=0?n[s+1]:void 0)}}function a(e){let t=Number(e);return!Number.isFinite(t)||t<=0?1:Math.floor(t)}function o(e){let t=String(e||``).trim();if(!t)return``;let n=s(t).trim();return!n||n.includes(`[`)||n.includes(`]`)?``:n}function s(e){try{return decodeURIComponent(e)}catch{return e}}export{n as resolveVideoDetailRouteContext};
@@ -3,9 +3,13 @@ import { VideoDetailActionsProps } from "./schema.mjs";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region components/biz/business/detail/video-detail-actions/server.d.ts
6
+ interface VideoDetailActionsServerProps extends VideoDetailActionsProps {
7
+ detailId?: string;
8
+ currentSeriesNum?: number;
9
+ }
6
10
  /**
7
11
  * 视频详情行为模块服务端组件。
8
12
  */
9
- declare function VideoDetailActions(props: VideoDetailActionsProps): react_jsx_runtime0.JSX.Element;
13
+ declare function VideoDetailActions(props: VideoDetailActionsServerProps): Promise<react_jsx_runtime0.JSX.Element>;
10
14
  //#endregion
11
15
  export { VideoDetailActions };
@@ -1,2 +1,2 @@
1
1
 
2
- import{VideoDetailActionsClient as e}from"./client.mjs";import{jsx as t}from"react/jsx-runtime";function n(n){let{mode:r=`renderer`,...i}=n;return t(e,{...i,mode:r})}export{n as VideoDetailActions};
2
+ import{VideoDetailMaterialRuntimeProvider as e}from"../shared/runtime-context-provider.mjs";import{resolveVideoDetailRouteContext as t}from"../shared/video-detail-route-context-server.mjs";import{getVideoDetailServerInformation as n}from"../shared/video-detail-server-data.mjs";import{VideoDetailActionsClient as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";async function a(a){let{mode:o=`renderer`,detailId:s,currentSeriesNum:c,...l}=a;if(o!==`renderer`)return i(r,{...l,mode:o});let u=await t(),d=String(s||u.detailId||``).trim();if(!d)return i(r,{...l,mode:o});let f=await n(d);if(!f)return i(r,{...l,mode:o});let p=Math.max(1,Number(c||u.currentSeriesNum||1));return i(e,{value:{information:f,detailId:d,currentSeriesNum:p,episodeIndex:Math.max(0,p-1),isShow:!0,isInformationLoading:!1,isInformationResolved:!0},children:i(r,{...l,mode:o})})}export{a as VideoDetailActions};
@@ -3,9 +3,13 @@ import { VideoDetailInfoProps } from "./schema.mjs";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region components/biz/business/detail/video-detail-info/server.d.ts
6
+ interface VideoDetailInfoServerProps extends VideoDetailInfoProps {
7
+ detailId?: string;
8
+ currentSeriesNum?: number;
9
+ }
6
10
  /**
7
11
  * 媒体信息-简介&选集物料服务端组件。
8
12
  */
9
- declare function VideoDetailInfo(props: VideoDetailInfoProps): Promise<react_jsx_runtime0.JSX.Element>;
13
+ declare function VideoDetailInfo(props: VideoDetailInfoServerProps): Promise<react_jsx_runtime0.JSX.Element>;
10
14
  //#endregion
11
15
  export { VideoDetailInfo };
@@ -1,2 +1,2 @@
1
1
 
2
- import{VideoDetailMaterialRuntimeProvider as e}from"../shared/runtime-context-provider.mjs";import{VideoDetailInfoClient as t}from"./client.mjs";import{resolveVideoDetailRouteContext as n}from"../shared/video-detail-route-context-server.mjs";import{getVideoDetailServerInformation as r}from"../shared/video-detail-server-data.mjs";import{jsx as i,jsxs as a}from"react/jsx-runtime";import o from"next/link";async function s(s){let{mode:l=`renderer`,showEpisodes:d=!1,...f}=s;if(l!==`renderer`)return i(t,{...f,showEpisodes:d,mode:l});let p=await n(),m=p.detailId;if(!m)return i(t,{...f,showEpisodes:d,mode:l});let h=await r(m);if(!h)return i(t,{...f,showEpisodes:d,mode:l});let g=Math.max(1,Number(p.currentSeriesNum||1)),_=c(h),v=d&&h.is_more_link===`y`&&_.length>1;return a(e,{value:{information:h,detailId:m,currentSeriesNum:g,episodeIndex:Math.max(0,g-1),isShow:!0,isInformationLoading:!1,isInformationResolved:!0},children:[i(t,{...f,showEpisodes:!1,mode:l}),v&&i(`div`,{className:`w-full px-[12px] mt-[12px]`,children:i(`div`,{className:`flex flex-wrap gap-[8px]`,children:_.map(e=>{let t=e.seriesNum===g;return i(o,{href:u(m,h.name||``,e.seriesNum),className:`h-[28px] min-w-[40px] rounded-[6px] border px-[8px] text-[12px] leading-[26px] text-center ${t?`border-theme5 text-theme5 bg-theme5/10`:`border-line1 text-text2 bg-bg1`}`,children:e.label},e.key)})})})]})}function c(e){return(Array.isArray(e.links)?e.links:[]).map((e,t)=>{let n=e||{},r=typeof n.id==`string`?n.id:``,i=l(n.id,n.name,t+1);return{key:r||`episode-${i}-${t+1}`,seriesNum:i,label:`第${i}集`}})}function l(e,t,n){let r=Number(e);if(Number.isFinite(r)&&r>0)return Math.floor(r);let i=Number(t);return Number.isFinite(i)&&i>0?Math.floor(i):n}function u(e,t,n){return`/video/${e}/${encodeURIComponent(t||``)}/episode/${n}`}export{s as VideoDetailInfo};
2
+ import{VideoDetailMaterialRuntimeProvider as e}from"../shared/runtime-context-provider.mjs";import{VideoDetailInfoClient as t}from"./client.mjs";import{resolveVideoDetailRouteContext as n}from"../shared/video-detail-route-context-server.mjs";import{getVideoDetailServerInformation as r}from"../shared/video-detail-server-data.mjs";import{jsx as i,jsxs as a}from"react/jsx-runtime";import o from"next/link";async function s(s){let{mode:l=`renderer`,showEpisodes:d=!1,detailId:f,currentSeriesNum:p,...m}=s;if(l!==`renderer`)return i(t,{...m,showEpisodes:d,mode:l});let h=await n(),g=String(f||h.detailId||``).trim();if(!g)return i(t,{...m,showEpisodes:d,mode:l});let _=await r(g);if(!_)return i(t,{...m,showEpisodes:d,mode:l});let v=Math.max(1,Number(p||h.currentSeriesNum||1)),y=c(_),b=d&&_.is_more_link===`y`&&y.length>1;return a(e,{value:{information:_,detailId:g,currentSeriesNum:v,episodeIndex:Math.max(0,v-1),isShow:!0,isInformationLoading:!1,isInformationResolved:!0},children:[i(t,{...m,showEpisodes:!1,mode:l}),b&&i(`div`,{className:`w-full px-[12px] mt-[12px]`,children:i(`div`,{className:`flex flex-wrap gap-[8px]`,children:y.map(e=>{let t=e.seriesNum===v;return i(o,{href:u(g,_.name||``,e.seriesNum),className:`h-[28px] min-w-[40px] rounded-[6px] border px-[8px] text-[12px] leading-[26px] text-center ${t?`border-theme5 text-theme5 bg-theme5/10`:`border-line1 text-text2 bg-bg1`}`,children:e.label},e.key)})})})]})}function c(e){return(Array.isArray(e.links)?e.links:[]).map((e,t)=>{let n=e||{},r=typeof n.id==`string`?n.id:``,i=l(n.id,n.name,t+1);return{key:r||`episode-${i}-${t+1}`,seriesNum:i,label:`第${i}集`}})}function l(e,t,n){let r=Number(e);if(Number.isFinite(r)&&r>0)return Math.floor(r);let i=Number(t);return Number.isFinite(i)&&i>0?Math.floor(i):n}function u(e,t,n){return`/video/${e}/${encodeURIComponent(t||``)}/episode/${n}`}export{s as VideoDetailInfo};
@@ -3,9 +3,13 @@ import { VideoDetailInfoTitleTagsEpisodesProps } from "./schema.mjs";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region components/biz/business/detail/video-detail-info-title-tags-episodes/server.d.ts
6
+ interface VideoDetailInfoTitleTagsEpisodesServerProps extends VideoDetailInfoTitleTagsEpisodesProps {
7
+ detailId?: string;
8
+ currentSeriesNum?: number;
9
+ }
6
10
  /**
7
11
  * 媒体信息-选集物料服务端组件。
8
12
  */
9
- declare function VideoDetailInfoTitleTagsEpisodes(props: VideoDetailInfoTitleTagsEpisodesProps): Promise<react_jsx_runtime0.JSX.Element>;
13
+ declare function VideoDetailInfoTitleTagsEpisodes(props: VideoDetailInfoTitleTagsEpisodesServerProps): Promise<react_jsx_runtime0.JSX.Element>;
10
14
  //#endregion
11
15
  export { VideoDetailInfoTitleTagsEpisodes };
@@ -1,2 +1,2 @@
1
1
 
2
- import{VideoDetailMaterialRuntimeProvider as e}from"../shared/runtime-context-provider.mjs";import{resolveVideoDetailRouteContext as t}from"../shared/video-detail-route-context-server.mjs";import{getVideoDetailServerInformation as n}from"../shared/video-detail-server-data.mjs";import{VideoDetailInfoTitleTagsEpisodesClient as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";async function a(a){let{mode:o=`renderer`,...s}=a;if(o!==`renderer`)return i(r,{...s,mode:o});let c=await t(),l=c.detailId;if(!l)return i(r,{...s,mode:o});let u=await n(l);return u?i(e,{value:{information:u,detailId:l,currentSeriesNum:Math.max(1,Number(c.currentSeriesNum||1)),isShow:!0,isInformationLoading:!1,isInformationResolved:!0},children:i(r,{...s,mode:o})}):i(r,{...s,mode:o})}export{a as VideoDetailInfoTitleTagsEpisodes};
2
+ import{VideoDetailMaterialRuntimeProvider as e}from"../shared/runtime-context-provider.mjs";import{resolveVideoDetailRouteContext as t}from"../shared/video-detail-route-context-server.mjs";import{getVideoDetailServerInformation as n}from"../shared/video-detail-server-data.mjs";import{VideoDetailInfoTitleTagsEpisodesClient as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";async function a(a){let{mode:o=`renderer`,detailId:s,currentSeriesNum:c,...l}=a;if(o!==`renderer`)return i(r,{...l,mode:o});let u=await t(),d=String(s||u.detailId||``).trim();if(!d)return i(r,{...l,mode:o});let f=await n(d);return f?i(e,{value:{information:f,detailId:d,currentSeriesNum:Math.max(1,Number(c||u.currentSeriesNum||1)),isShow:!0,isInformationLoading:!1,isInformationResolved:!0},children:i(r,{...l,mode:o})}):i(r,{...l,mode:o})}export{a as VideoDetailInfoTitleTagsEpisodes};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{pContentGetPopularVideoList as e}from"../../../../../service/generated/client.mjs";import{Image as t}from"../../../../ui/image.mjs";import{Box as n}from"../../../../ui/box.mjs";import{Text as r}from"../../../../ui/text.mjs";import i from"../../../../../assets/icons/detail/video_flag.mjs";import{MiniThreeCard as a}from"../../../../common/cards/mini-three-card.mjs";import{HOME_RECOMMEND_DEFAULT_GRID_COLUMNS as o,HOME_RECOMMEND_DEFAULT_GRID_ROWS as s,HOME_RECOMMEND_DEFAULT_PLAY_COUNT_DELTA as c,HOME_RECOMMEND_DEFAULT_SHOW_EPISODE as l,HOME_RECOMMEND_DEFAULT_SHOW_PLAY_COUNT as u,HOME_RECOMMEND_MAX_GRID_COLUMNS as ee,HOME_RECOMMEND_MAX_GRID_ROWS as te}from"./home-recommend-default-config.mjs";import{HOME_RECOMMEND_CARD_CONFIG_FIELD as d}from"./home-recommend-preview.mjs";import{useCallback as f,useEffect as p,useLayoutEffect as m,useMemo as h,useRef as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{useRouter as ne}from"next/navigation";const re={},ie={list:[]};function b({variant:t,props:i=re,data:a=ie,mode:d=`renderer`}){let b=d===`editor`,S=ne(),{list:C,title:se,cursor:T}=a,E=h(()=>Array.isArray(C)?C:[],[C]),D=h(()=>Array.isArray(a.icons)?a.icons:[],[a.icons]),{rows:ce,columns:O,moreLink:le,title:k,smartTagIds:A,catId:de,showPlayCount:fe,playCountDelta:pe,showEpisode:me,enableInfinite:he}=i,N=he===!0,P=!b&&N&&E.length>=16,F=h(()=>Array.isArray(A)?A.map(e=>String(e||``).trim()).filter(Boolean):[],[A]),I=typeof de==`string`?de.trim():``,[L,ge]=_(0),[R,_e]=_(E),[z,ve]=_(D),[B,V]=_(()=>j(T)),[ye,be]=_(!1),xe=g(null),H=g(null),U=g(!1);p(()=>{_e(E),ve(D),V(j(T))},[T,D,E]);let Se=oe(ce,s,te),W=oe(O,o,ee),G=N?16:t===`grid`?Se*W:16,Ce=Se*W,we=b&&t===`grid`,K=we?R.slice(0,Ce):R,q=we?z.slice(0,Ce):z,Te=t===`waterfall`?6:4,J=K.length>0?Math.max(0,K.length-Te):-1,Ee=!!B,De=k&&k.trim()||se||``,Y=fe??u,X=Number(pe??c),Z=me??l,Oe=!N,Q=Oe?ae(le):``,ke=Oe&&!!Q,Ae=f(async()=>{let t=B;if(!(!P||!t||U.current)){U.current=!0,be(!0);try{let n=await e({cursor:t,page_size:G,tags:F.length>0?F:void 0,cat_id:I||void 0}),r=Array.isArray(n.data?.videos)?n.data.videos:[],i=j(n.data?.cursor);r.length>0&&_e(e=>e.concat(r)),V(e=>{if(!(!r.length||!i))return i===e?void 0:i})}catch(e){console.error(`推荐位加载下一页失败(client)`,e),V(void 0)}finally{U.current=!1,be(!1)}}},[B,I,G,F,P]),je=f(()=>{Q&&(Q.startsWith(`http`)?window.location.href=Q:S.push(Q))},[Q,S]);p(()=>{let e=H.current;if(!e||!P||!Ee)return;let t=document.getElementById(`app-scroll-container`)||null,n=new IntersectionObserver(e=>{!e[0]?.isIntersecting||ye||Ae()},{root:t,threshold:0});return n.observe(e),()=>{n.disconnect()}},[Ae,Ee,ye,K.length,G,P,J]),m(()=>{let e=xe.current;if(!e||t!==`waterfall`)return;let n=()=>{let t=e.clientWidth||0;ge(t>0?(t-12)/2:0)};n();let r=new ResizeObserver(n);return r.observe(e),()=>{r.disconnect()}},[t]);let $=h(()=>t===`waterfall`?ue(K,q,L):{left:[],right:[]},[L,q,K,t]);return K.length?y(n,{className:`w-full mt-[16px]`,children:[y(n,{className:`flex items-center justify-between px-[12px] mb-[8px]`,children:[v(r,{className:`flex-1 min-w-0 text-text1 text-[18px] leading-[26px] font-bold line-clamp-1`,children:De}),ke&&v(r,{className:`text-text3 text-[12px] leading-[18px] cursor-pointer`,onClick:je,children:`更多`})]}),t===`grid`&&v(n,{className:`w-full flex flex-wrap px-[12px]`,children:K.map((e,n)=>{let r=q[n],i=w(e),a=Y&&(i?.showPlayCount??!0),o=i?.playCountDelta??X,s=i?.showEpisode??Z,c=n%W,l=W>1?{paddingLeft:12*c/W,paddingRight:12*(W-c-1)/W}:void 0;return v(`div`,{ref:n===J?H:void 0,className:`min-w-0`,style:{width:`${100/W}%`,...l||{}},children:v(x,{variant:t,item:e,icon:r,index:n,showPlayCount:a,playCountDelta:o,showEpisode:s,widthStyle:{width:`100%`}})},M(e,n))})}),t===`waterfall`&&y(n,{ref:xe,className:`w-full px-[12px] flex gap-[12px]`,children:[v(n,{className:`flex-1 min-w-0 flex flex-col`,children:$.left.map(e=>{let n=w(e.item),r=Y&&(n?.showPlayCount??!0),i=n?.playCountDelta??X,a=n?.showEpisode??Z;return v(`div`,{ref:e.index===J?H:void 0,children:v(x,{variant:t,item:e.item,icon:e.icon,index:e.index,showPlayCount:r,playCountDelta:i,showEpisode:a,widthStyle:{width:`100%`}})},M(e.item,e.index))})}),v(n,{className:`flex-1 min-w-0 flex flex-col`,children:$.right.map(e=>{let n=w(e.item),r=Y&&(n?.showPlayCount??!0),i=n?.playCountDelta??X,a=n?.showEpisode??Z;return v(`div`,{ref:e.index===J?H:void 0,children:v(x,{variant:t,item:e.item,icon:e.icon,index:e.index,showPlayCount:r,playCountDelta:i,showEpisode:a,widthStyle:{width:`100%`}})},M(e.item,e.index))})})]})]}):null}function x({variant:e,item:t,icon:o,index:s,showPlayCount:c,playCountDelta:l,showEpisode:u,widthStyle:ee}){let te=se(t),d=t.name||``,f=ce(t.static?.browse_cnt??0),p=E(t,u),m=k(t,o,s);return v(a,{url:te,text:d,className:`w-full`,style:ee,topRightChild:m?v(S,{url:m}):void 0,bottomLeftChild:c?y(n,{className:`h-[20px] leading-[20px] text-[#fff] text-[12px] px-[4px] rounded-[4px] bg-[#333] ml-[4px] flex items-center`,children:[v(i,{className:`w-[16px] h-[auto] text-[#fff] mr-[4px]`}),f]}):null,bottomRightChild:u?p&&v(r,{className:`text-[#fff] text-[12px] leading-[18px] pr-2`,children:p}):null,textChild:v(n,{className:`py-[4px]`,children:v(r,{as:`h3`,className:`text-text1 text-[16px] leading-[24px] ${e===`waterfall`?`break-words line-clamp-3`:`line-clamp-1`}`,children:d})}),linkPath:C(t)})}function S({url:e}){return v(n,{className:`relative w-[40px] h-[20px]`,children:v(t,{src:e,alt:`corner`,fill:!0,objectFit:`cover`})})}function C(e){let t=encodeURIComponent(e.name||``);return`/video/${e.id||``}/${t}/episode/1`}function ae(e){return e?e.trim():``}function oe(e,t,n){let r=Number(e);return!Number.isFinite(r)||r<=0?t:Math.min(n,Math.floor(r))}function w(e){return e[d]}function se(e){return e.img_y||e.img_x||``}function T(e){return typeof e==`string`?e:``}function E(e,t){if(!t)return``;if(D(e)){let t=Number(e.episode_cnt||e.links?.length||0);return t>0?`全${t}集`:``}return le(Number(e.duration||0))}function D(e){if(Number(e.type??0)===2)return!0;let t=e.is_more_link;if(t===!0||t===`y`||t===`1`)return!0;let n=Number(e.episode_cnt||e.links?.length||0);return Number.isFinite(n)&&n>1}function ce(e){return!Number.isFinite(e)||e<=0?`0`:e>=1e6?`${O(e/1e6)}M`:e>=1e3?`${O(e/1e3)}k`:Math.floor(e).toString()}function O(e){let t=e.toFixed(1);return t.endsWith(`.0`)?t.slice(0,-2):t}function le(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 k(e,t,n){return T(e.badge_url)||T(t?.material_url)||``}function ue(e,t,n){let r=[],i=[],a=n<=0,o=0,s=0;return e.forEach((e,c)=>{let l=t[c];if(a){c%2==0?r.push({item:e,icon:l,index:c}):i.push({item:e,icon:l,index:c});return}let u=A(n,e);o<=s?(r.push({item:e,icon:l,index:c}),o+=u):(i.push({item:e,icon:l,index:c}),s+=u)}),{left:r,right:i}}function A(e,t){if(!e)return 0;let n=e*1.3461538461538463,r=E(t,!0)?18:0;return n+20+r+6+16}function j(e){if(typeof e==`string`)return e.trim()||void 0}function M(e,t){return e.id?`home-recommend-${e.id}`:`home-recommend-${t}`}export{b as default};
2
+ "use client";import{pContentGetPopularVideoList as e}from"../../../../../service/generated/client.mjs";import{Image as t}from"../../../../ui/image.mjs";import{Box as n}from"../../../../ui/box.mjs";import{Text as r}from"../../../../ui/text.mjs";import i from"../../../../../assets/icons/detail/video_flag.mjs";import{MiniThreeCard as a}from"../../../../common/cards/mini-three-card.mjs";import{HOME_RECOMMEND_DEFAULT_GRID_COLUMNS as o,HOME_RECOMMEND_DEFAULT_GRID_ROWS as s,HOME_RECOMMEND_DEFAULT_PLAY_COUNT_DELTA as c,HOME_RECOMMEND_DEFAULT_SHOW_EPISODE as l,HOME_RECOMMEND_DEFAULT_SHOW_PLAY_COUNT as u,HOME_RECOMMEND_MAX_GRID_COLUMNS as ee,HOME_RECOMMEND_MAX_GRID_ROWS as te}from"./home-recommend-default-config.mjs";import{HOME_RECOMMEND_CARD_CONFIG_FIELD as d}from"./home-recommend-preview.mjs";import{useCallback as f,useEffect as p,useLayoutEffect as m,useMemo as h,useRef as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{useRouter as ne}from"next/navigation";const re={},ie={list:[]};function b({variant:t,props:i=re,data:a=ie,mode:d=`renderer`,props:b={}}){let S=d===`editor`,C=ne(),{list:se,title:T,cursor:E}=a,{items:D}=b,O=h(()=>Array.isArray(D)?D:[],[D]),k=h(()=>Array.isArray(a.icons)?a.icons:[],[a.icons]),{rows:ce,columns:le,moreLink:de,title:fe,smartTagIds:M,catId:pe,showPlayCount:me,playCountDelta:he,showEpisode:ge,enableInfinite:_e}=i,N=_e===!0,P=!S&&N&&O.length>=16,F=h(()=>Array.isArray(M)?M.map(e=>String(e||``).trim()).filter(Boolean):[],[M]),I=typeof pe==`string`?pe.trim():``,[L,ve]=_(0),[R,ye]=_(O),[be,xe]=_(k),[z,B]=_(()=>A(E)),[Se,Ce]=_(!1),we=g(null),V=g(null),H=g(!1);p(()=>{ye(O),xe(k),B(A(E))},[E,k,O]);let Te=oe(ce,s,te),U=oe(le,o,ee),W=N?16:t===`grid`?Te*U:16,Ee=Te*U,De=S&&t===`grid`,G=De?R.slice(0,Ee):R,K=De?be.slice(0,Ee):be,Oe=t===`waterfall`?6:4,q=G.length>0?Math.max(0,G.length-Oe):-1,J=!!z,ke=fe&&fe.trim()||T||``,Y=me??u,X=Number(he??c),Z=ge??l,Ae=!N,Q=Ae?ae(de):``,je=Ae&&!!Q,Me=f(async()=>{let t=z;if(!(!P||!t||H.current)){H.current=!0,Ce(!0);try{let n=await e({cursor:t,page_size:W,tags:F.length>0?F:void 0,cat_id:I||void 0}),r=Array.isArray(n.data?.videos)?n.data.videos:[],i=A(n.data?.cursor);r.length>0&&ye(e=>e.concat(r)),B(e=>{if(!(!r.length||!i))return i===e?void 0:i})}catch(e){console.error(`推荐位加载下一页失败(client)`,e),B(void 0)}finally{H.current=!1,Ce(!1)}}},[z,I,W,F,P]),Ne=f(()=>{Q&&(Q.startsWith(`http`)?window.location.href=Q:C.push(Q))},[Q,C]);p(()=>{let e=V.current;if(!e||!P||!J)return;let t=document.getElementById(`app-scroll-container`)||null,n=new IntersectionObserver(e=>{!e[0]?.isIntersecting||Se||Me()},{root:t,threshold:0});return n.observe(e),()=>{n.disconnect()}},[Me,J,Se,G.length,W,P,q]),m(()=>{let e=we.current;if(!e||t!==`waterfall`)return;let n=()=>{let t=e.clientWidth||0;ve(t>0?(t-12)/2:0)};n();let r=new ResizeObserver(n);return r.observe(e),()=>{r.disconnect()}},[t]);let $=h(()=>t===`waterfall`?ue(G,K,L):{left:[],right:[]},[L,K,G,t]);return G.length?y(n,{className:`w-full mt-[16px]`,children:[y(n,{className:`flex items-center justify-between px-[12px] mb-[8px]`,children:[v(r,{className:`flex-1 min-w-0 text-text1 text-[18px] leading-[26px] font-bold line-clamp-1`,children:ke}),je&&v(r,{className:`text-text3 text-[12px] leading-[18px] cursor-pointer`,onClick:Ne,children:`更多`})]}),t===`grid`&&v(n,{className:`w-full flex flex-wrap px-[12px]`,children:G.map((e,n)=>{let r=K[n],i=w(e),a=Y&&(i?.showPlayCount??!0),o=i?.playCountDelta??X,s=i?.showEpisode??Z,c=n%U,l=U>1?{paddingLeft:12*c/U,paddingRight:12*(U-c-1)/U}:void 0;return v(`div`,{ref:n===q?V:void 0,className:`min-w-0`,style:{width:`${100/U}%`,...l||{}},children:v(x,{variant:t,item:e,icon:r,index:n,showPlayCount:a,playCountDelta:o,showEpisode:s,widthStyle:{width:`100%`}})},j(e,n))})}),t===`waterfall`&&y(n,{ref:we,className:`w-full px-[12px] flex gap-[12px]`,children:[v(n,{className:`flex-1 min-w-0 flex flex-col`,children:$.left.map(e=>{let n=w(e.item),r=Y&&(n?.showPlayCount??!0),i=n?.playCountDelta??X,a=n?.showEpisode??Z;return v(`div`,{ref:e.index===q?V:void 0,children:v(x,{variant:t,item:e.item,icon:e.icon,index:e.index,showPlayCount:r,playCountDelta:i,showEpisode:a,widthStyle:{width:`100%`}})},j(e.item,e.index))})}),v(n,{className:`flex-1 min-w-0 flex flex-col`,children:$.right.map(e=>{let n=w(e.item),r=Y&&(n?.showPlayCount??!0),i=n?.playCountDelta??X,a=n?.showEpisode??Z;return v(`div`,{ref:e.index===q?V:void 0,children:v(x,{variant:t,item:e.item,icon:e.icon,index:e.index,showPlayCount:r,playCountDelta:i,showEpisode:a,widthStyle:{width:`100%`}})},j(e.item,e.index))})})]})]}):null}function x({variant:e,item:t,icon:o,index:s,showPlayCount:c,playCountDelta:l,showEpisode:u,widthStyle:ee}){let te=se(t),d=t.name||t?.title||``,f=O(t.static?.browse_cnt??0),p=E(t,u),m=le(t,o,s);return v(a,{url:te,text:d,className:`w-full`,style:ee,topRightChild:m?v(S,{url:m}):void 0,bottomLeftChild:c?y(n,{className:`h-[20px] leading-[20px] text-[#fff] text-[12px] px-[4px] rounded-[4px] bg-[#333] ml-[4px] flex items-center`,children:[v(i,{className:`w-[16px] h-[auto] text-[#fff] mr-[4px]`}),f]}):null,bottomRightChild:u?p&&v(r,{className:`text-[#fff] text-[12px] leading-[18px] pr-2`,children:p}):null,textChild:v(n,{className:`py-[4px]`,children:v(r,{as:`h3`,className:`text-text1 text-[16px] leading-[24px] ${e===`waterfall`?`break-words line-clamp-3`:`line-clamp-1`}`,children:d})}),linkPath:C(t)})}function S({url:e}){return v(n,{className:`relative w-[40px] h-[20px]`,children:v(t,{src:e,alt:`corner`,fill:!0,objectFit:`cover`})})}function C(e){let t=encodeURIComponent(e.name||``);return`/video/${e.id||``}/${t}/episode/1`}function ae(e){return e?e.trim():``}function oe(e,t,n){let r=Number(e);return!Number.isFinite(r)||r<=0?t:Math.min(n,Math.floor(r))}function w(e){return e[d]}function se(e){return e.img_y||e.img_x||e?.coverUrl}function T(e){return typeof e==`string`?e:``}function E(e,t){if(!t)return``;if(D(e)){let t=Number(e.episode_cnt||e.links?.length||0);return t>0?`全${t}集`:``}return ce(Number(e.duration||0))}function D(e){if(Number(e.type??0)===2)return!0;let t=e.is_more_link;if(t===!0||t===`y`||t===`1`)return!0;let n=Number(e.episode_cnt||e.links?.length||0);return Number.isFinite(n)&&n>1}function O(e){return!Number.isFinite(e)||e<=0?`0`:e>=1e6?`${k(e/1e6)}M`:e>=1e3?`${k(e/1e3)}k`:Math.floor(e).toString()}function k(e){let t=e.toFixed(1);return t.endsWith(`.0`)?t.slice(0,-2):t}function ce(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 le(e,t,n){return T(e.badge_url)||T(t?.material_url)||``}function ue(e,t,n){let r=[],i=[],a=n<=0,o=0,s=0;return e.forEach((e,c)=>{let l=t[c];if(a){c%2==0?r.push({item:e,icon:l,index:c}):i.push({item:e,icon:l,index:c});return}let u=de(n,e);o<=s?(r.push({item:e,icon:l,index:c}),o+=u):(i.push({item:e,icon:l,index:c}),s+=u)}),{left:r,right:i}}function de(e,t){if(!e)return 0;let n=e*1.3461538461538463,r=E(t,!0)?18:0;return n+20+r+6+16}function A(e){if(typeof e==`string`)return e.trim()||void 0}function j(e,t){return e.id?`home-recommend-${e.id}`:`home-recommend-${t}`}export{b as default};
@@ -1,2 +1,2 @@
1
1
 
2
- import{pContentGetNewstVideoList as e,pContentGetPopularVideoList as t}from"../../../service/generated/client.mjs";import{pContentGetNewstVideoListKey as n,pContentGetPopularVideoListKey as r}from"../../../service/generated/tanstack.mjs";import{HydrationBoundary as i}from"../../../hooks/query/hydration-boundary.mjs";import{getNextVideoListPageParam as a,resolveNextCursor as o}from"./types.mjs";import s from"./video-list-client.mjs";import{jsx as c}from"react/jsx-runtime";async function l({title:l=`列表页`,tags:u=[]}={}){let d={page_size:10,tags:u.length?u:void 0};return c(i,{prefetch:[{type:`infinite`,queryKey:r(d),queryFn:async e=>{let n=(await t({page_size:10,cursor:e||void 0,tags:u.length?u:void 0})).data;return{list:n?.videos??[],nextCursor:o(n)}},initialPageParam:``,getNextPageParam:e=>a(e)},{type:`infinite`,queryKey:n(d),queryFn:async t=>{let n=(await e({page_size:10,cursor:t||void 0,tags:u.length?u:void 0})).data;return{list:n?.videos??[],nextCursor:o(n)}},initialPageParam:``,getNextPageParam:e=>a(e)}],children:c(s,{title:l,tags:u})})}export{l as VideoListPage};
2
+ import{pContentGetNewstVideoList as e,pContentGetPopularVideoList as t}from"../../../service/generated/client.mjs";import{pContentGetNewstVideoListKey as n,pContentGetPopularVideoListKey as r}from"../../../service/generated/tanstack.mjs";import{HydrationBoundary as i}from"../../../hooks/query/hydration-boundary.mjs";import{revalidate as a}from"../../../constants/revalidate.mjs";import{getNextVideoListPageParam as o,resolveNextCursor as s}from"./types.mjs";import c from"./video-list-client.mjs";import{jsx as l}from"react/jsx-runtime";async function u({title:u=`列表页`,tags:d=[]}={}){let f={page_size:10,tags:d.length?d:void 0};return l(i,{prefetch:[{type:`infinite`,queryKey:r(f),queryFn:async e=>{let n=(await t({page_size:10,cursor:e||void 0,tags:d.length?d:void 0},{revalidate:a.TIME})).data;return{list:n?.videos??[],nextCursor:s(n)}},initialPageParam:``,getNextPageParam:e=>o(e)},{type:`infinite`,queryKey:n(f),queryFn:async t=>{let n=(await e({page_size:10,cursor:t||void 0,tags:d.length?d:void 0},{revalidate:a.TIME})).data;return{list:n?.videos??[],nextCursor:s(n)}},initialPageParam:``,getNextPageParam:e=>o(e)}],children:l(c,{title:u,tags:d})})}export{u as VideoListPage};
@@ -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{memo as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";const o=r(({item:r})=>{let o=r.img_x??r.img_y??``,s=r.name??r.id??``;return a(t,{className:`overflow-hidden rounded-[8px] shadow-sm`,children:[o?i(t,{className:`relative w-full aspect-video h-[240px]`,children:i(e,{src:o,alt:s,fill:!0,className:`object-cover`})}):null,i(t,{className:`py-[8px]`,children:i(n,{as:`h3`,className:`line-clamp-1 font-[16px] font-bold text-text1`,children:s})})]})});export{o as VideoListItemComponent};
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{memo as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";const o=r(({item:r})=>{let o=r.img_x??r.img_y??``,s=r.name??r.id??``;return a(t,{className:`overflow-hidden rounded-[8px] shadow-sm`,children:[o?i(t,{className:`relative w-full aspect-video h-[240px]`,children:i(e,{src:o,alt:s,fill:!0,className:`object-cover`})}):null,i(t,{className:`py-[8px]`,children:i(n,{as:`h3`,className:`line-clamp-1 text-[16px] text-bold text-text1`,children:s})})]})});export{o as VideoListItemComponent};
@@ -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" | "link" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
9
+ variant?: "default" | "link" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
10
10
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
11
11
  /** Badge 组件。 */
12
12
  declare function Badge({
@@ -8,7 +8,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
8
8
  //#region components/ui/button-group.d.ts
9
9
  /** buttonGroupVariants 工具定义。 */
10
10
  declare const buttonGroupVariants: (props?: ({
11
- orientation?: "horizontal" | "vertical" | null | undefined;
11
+ orientation?: "vertical" | "horizontal" | null | undefined;
12
12
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
13
13
  /** ButtonGroupText 组件属性。 */
14
14
  type ButtonGroupTextProps = useRender.ComponentProps<'div'>;
@@ -7,7 +7,7 @@ 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" | "link" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
10
+ variant?: "default" | "link" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
11
11
  size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
12
12
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
13
13
  /** Button 组件属性。 */
@@ -51,7 +51,7 @@ declare function FieldGroup({
51
51
  }: FieldGroupProps): react_jsx_runtime0.JSX.Element;
52
52
  /** fieldVariants 工具定义。 */
53
53
  declare const fieldVariants: (props?: ({
54
- orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
54
+ orientation?: "vertical" | "horizontal" | "responsive" | null | undefined;
55
55
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
56
56
  /** Field 组件。 */
57
57
  declare function Field({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@funhub/platform",
3
3
  "type": "module",
4
- "version": "0.1.95",
4
+ "version": "0.1.97",
5
5
  "private": false,
6
6
  "sideEffects": [
7
7
  "**/*.css"