@funhub/platform 0.1.124 → 0.1.125

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
- "use client";import{gContentGetRecommendVideoList as e}from"../../../../service/generated/client.mjs";import{Image as t}from"../../../ui/image.mjs";import{Box as n}from"../../../ui/box.mjs";import{EmptyState as r}from"../../../ui/empty.mjs";import{usePaginated as i,useRefetchQuery as a,useUpdateRequest as o}from"../../../../hooks/query/use-query.mjs";import{getPostDetailPagePath as s}from"../../../../utils/tools.mjs";import{apiCollectCustom as c}from"../../../../utils/api-collect.mjs";import{UserActivityList as l}from"../../../common/list/user-activity-list/user-activity-list.mjs";import{VideoListItemSkeleton as u}from"../../../common/skeleton/video-list-item-skeleton.mjs";import{useCardDecoration as d}from"../../../../hooks/use-card-decoration.mjs";import f from"../../../ui/rate.mjs";import{mapRecommendContentToUserActivityItem as p}from"../search-utils.mjs";import{memo as m,useCallback as h,useMemo as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{useTranslations as y}from"next-intl";import b from"next/link";const x=m(()=>_(n,{className:`w-full px-[12px] pt-[12px]`,children:Array.from({length:3}).map((e,t)=>_(u,{},`search-video-skeleton-${t}`))}));x.displayName=`SearchVideoListSkeleton`;const S=m(({item:e})=>{let{getCalculationScore:r}=d();return v(b,{className:`w-full flex items-center justify-between mb-[12px] pb-[12px] border-b border-line1 cursor-pointer px-[12px]`,href:s({id:e.video_id,contentType:0}),onClick:()=>{e.video_id},children:[_(n,{className:`w-[76px] h-[102px] shrink-0 rounded-[8px] overflow-hidden relative bg-bg2`,children:_(t,{src:e.img_y||e.img_x||``,fill:!0,objectFit:`cover`,alt:e.name||``})}),v(n,{className:`flex-1 min-w-0 flex flex-col ml-[12px]`,children:[_(`span`,{className:`leading-[26px] text-text1 text-[18px] font-bold max-w-[200px] line-clamp-1 mb-[4px]`,children:e.name||``}),v(n,{className:`flex items-center`,style:{transform:`scale(0.6)`,transformOrigin:`left center`},children:[_(f,{allowHalf:!0,value:r({score:String(e.score??0)})}),_(`span`,{className:`ml-[8px] text-[24px] text-[#F59E0B] font-bold leading-[24px]`,children:e.score?(Number(e.score)/10).toFixed(1):0})]}),v(n,{className:`w-full mt-[4px] flex items-center shrink-0 pr-[12px]`,children:[_(n,{className:`w-fit h-[20px] leading-[20px] px-[6px] text-text3 text-[12px] bg-line1 rounded-[4px] shrink-0 mr-[10px]`,children:e.group_name}),_(`span`,{className:`text-text2 text-[14px] leading-[22px] flex-1 min-w-0 line-clamp-1`,children:e.description})]})]})]})});S.displayName=`VideoItem`;const C=m(({list:e})=>_(n,{className:`w-full px-[12px] pt-[12px]`,children:e.map((e,t)=>_(S,{item:e},String(e.video_id??t)))}));C.displayName=`VideoList`;const w=m(({list:e,onUpdate:t,onActionSuccess:n})=>{let r=h(n=>{let r=e.findIndex(e=>e.content_id===n.content_id);if(r!==-1){let i=[...e];i[r]=n,t(i)}},[e,t]);return _(l,{list:g(()=>e.map(e=>({...p(e),onLikeSuccess(t){r({...e,like_count:String(t.count),dislike_count:t.dislikeCount===void 0?e.dislike_count:String(t.dislikeCount),interaction:{...e.interaction,is_liked:t.isLiked,is_dislike:t.isDisliked??e.interaction?.is_dislike}})},onDislikeSuccess(t){r({...e,like_count:t.likeCount===void 0?e.like_count:String(t.likeCount),dislike_count:String(t.count),interaction:{...e.interaction,is_dislike:t.isDisliked,is_liked:t.isLiked??e.interaction?.is_liked}})}})),[r,e]),showGroupHeaders:!1,onActionSuccess:n})});w.displayName=`InfoList`;const T=m(({searchType:t,inputVal:s})=>{let c=y(`components.pages.search.searchResult`),u=h(async n=>await e({data_type:2,extra_params:JSON.stringify({type:t===`video`?3:2,keywords:s}),page:n||1,page_size:20}),[s,20,t]),d=g(()=>[`searchByKeyForVideoInfo`,s,t===`video`?3:2],[s,t]),f=i({key:d,initialPageParam:1,async queryFn(e){let n=await u(e);return(t===`video`?n?.data?.videos:n?.data?.contents)??{has_more:!1,total:0,list:[]}},getNextPageParam(e,t){if(e.has_more)return t.length+1}}),m=g(()=>{let e=f.data?.pages??[],t=[];for(let n of e){let e=n.list??[];t.push(...e)}return t},[f.data?.pages]),v=g(()=>m,[m,t]),b=o(),S=a(),w=h(e=>{b(d,t=>{if(!t)return t;let n=t.pages.map(t=>({...t,list:(t.list??[]).map(t=>t.content_id===e.content_id?e:t)}));return{...t,pages:n}})},[d,b]),T=h(()=>{S(d)},[d,S]),E=h(e=>({...p(e),onLikeSuccess(t){w({...e,like_count:String(t.count),dislike_count:t.dislikeCount===void 0?e.dislike_count:String(t.dislikeCount),interaction:{...e.interaction,is_liked:t.isLiked,is_dislike:t.isDisliked??e.interaction?.is_dislike}})},onDislikeSuccess(t){w({...e,like_count:t.likeCount===void 0?e.like_count:String(t.likeCount),dislike_count:String(t.count),interaction:{...e.interaction,is_dislike:t.isDisliked,is_liked:t.isLiked??e.interaction?.is_liked}})}}),[w]),D=g(()=>v.map(E),[E,v]),O=f.isPending||f.isFetching,k=t===`video`&&O&&v.length===0;return _(n,{className:`w-full`,children:t===`video`?k?_(x,{}):v.length>0?_(C,{list:v}):_(r,{type:`no-content`,text:c(`searchVideoInfo.noRelevantContent`),className:`mt-[12px]`}):_(l,{list:D,loading:O,hasMore:f.hasNextPage??!1,loadMore:async e=>{if(e!==!1)try{f&&await f.fetchNextPage()}catch(e){console.error(`获取内容列表失败`,e)}},showGroupHeaders:!1,emptyText:c(`searchVideoInfo.noRelevantContent`),onActionSuccess:T})})});T.displayName=`SearchInfoOrVideoList`;export{C as VideoList,T as default};
2
+ "use client";import{gContentGetRecommendVideoList as e}from"../../../../service/generated/client.mjs";import{Image as t}from"../../../ui/image.mjs";import{Box as n}from"../../../ui/box.mjs";import{EmptyState as r}from"../../../ui/empty.mjs";import{Text as i}from"../../../ui/text.mjs";import{usePaginated as a,useRefetchQuery as o,useUpdateRequest as s}from"../../../../hooks/query/use-query.mjs";import{formatVideoDuration as c,getPostDetailPagePath as l}from"../../../../utils/tools.mjs";import{apiCollectCustom as u}from"../../../../utils/api-collect.mjs";import{UserActivityList as d}from"../../../common/list/user-activity-list/user-activity-list.mjs";import{VideoListItemSkeleton as f}from"../../../common/skeleton/video-list-item-skeleton.mjs";import p from"../../../../assets/icons/view.mjs";import{mapRecommendContentToUserActivityItem as m}from"../search-utils.mjs";import{memo as h,useCallback as g,useMemo as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{useTranslations as b}from"next-intl";import x from"next/link";const S=h(()=>v(n,{className:`w-full px-[12px] pt-[12px]`,children:Array.from({length:3}).map((e,t)=>v(f,{},`search-video-skeleton-${t}`))}));S.displayName=`SearchVideoListSkeleton`;function C(e){let t=Number(e||0);return Number.isNaN(t)||t<=0?`0`:t>=1e4?`${(t/1e4).toFixed(1)}w`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function w(e){let t=Number(e.episode_count||0),n=Number.isFinite(t)&&t>0,r=String(e.update_status??``).trim();return!n||t<=1?c(Number(e.duration||0)):r===`1`?`${t}集全`:`更新至${t}集`}const T=h(({item:e})=>{let r=e.name||``,a=e.img_x||e.img_y||``,o=w(e);return y(x,{className:`mb-[12px] block border-b border-line1 px-[12px] pb-[12px]`,href:l({id:e.video_id,contentType:0}),onClick:()=>{e.video_id},children:[y(n,{className:`relative w-full overflow-hidden rounded-[12px] bg-neutral-800`,style:{aspectRatio:`16/9`},children:[a&&v(t,{src:a,alt:r||`封面`,fill:!0,objectFit:`cover`}),v(n,{className:`absolute inset-x-0 bottom-0 h-[40px] bg-gradient-to-t from-black/80 to-transparent z-0 pointer-events-none`}),y(n,{className:`absolute bottom-0 left-[8px] mb-[6px] z-10 flex items-center gap-[4px]`,children:[v(p,{className:`h-[14px] w-[14px] text-white`}),v(i,{as:`span`,className:`text-[12px] font-medium text-white drop-shadow-md`,children:C(e.play_count)})]}),o&&v(n,{className:`absolute bottom-0 right-[8px] mb-[6px] z-10 flex items-center`,children:v(i,{as:`span`,className:`text-[12px] font-medium text-white drop-shadow-md`,children:o})})]}),y(n,{className:`flex items-center justify-between gap-[12px] pt-[10px] px-2`,children:[y(n,{className:`flex-1 min-w-0`,children:[v(i,{as:`h3`,className:`text-[16px] font-semibold leading-[24px] text-text1 line-clamp-1`,children:r}),e.description&&v(i,{as:`p`,className:`mt-[4px] text-[13px] leading-[20px] text-text2 line-clamp-1`,children:e.description})]}),v(i,{className:`shrink-0 rounded-[20px] border border-[#FD4C5E] px-[24px] py-[8px] text-[14px] font-normal text-[#FD4C5E]`,children:`观看`})]})]})});T.displayName=`VideoItem`;const E=h(({list:e})=>v(n,{className:`w-full px-[12px] pt-[12px]`,children:e.map((e,t)=>v(T,{item:e},String(e.video_id??t)))}));E.displayName=`VideoList`;const D=h(({list:e,onUpdate:t,onActionSuccess:n})=>{let r=g(n=>{let r=e.findIndex(e=>e.content_id===n.content_id);if(r!==-1){let i=[...e];i[r]=n,t(i)}},[e,t]);return v(d,{list:_(()=>e.map(e=>({...m(e),onLikeSuccess(t){r({...e,like_count:String(t.count),dislike_count:t.dislikeCount===void 0?e.dislike_count:String(t.dislikeCount),interaction:{...e.interaction,is_liked:t.isLiked,is_dislike:t.isDisliked??e.interaction?.is_dislike}})},onDislikeSuccess(t){r({...e,like_count:t.likeCount===void 0?e.like_count:String(t.likeCount),dislike_count:String(t.count),interaction:{...e.interaction,is_dislike:t.isDisliked,is_liked:t.isLiked??e.interaction?.is_liked}})}})),[r,e]),showGroupHeaders:!1,onActionSuccess:n})});D.displayName=`InfoList`;const O=h(({searchType:t,inputVal:i})=>{let c=b(`components.pages.search.searchResult`),l=g(async n=>await e({data_type:2,extra_params:JSON.stringify({type:t===`video`?3:2,keywords:i}),page:n||1,page_size:20}),[i,20,t]),u=_(()=>[`searchByKeyForVideoInfo`,i,t===`video`?3:2],[i,t]),f=a({key:u,initialPageParam:1,async queryFn(e){let n=await l(e);return(t===`video`?n?.data?.videos:n?.data?.contents)??{has_more:!1,total:0,list:[]}},getNextPageParam(e,t){if(e.has_more)return t.length+1}}),p=_(()=>{let e=f.data?.pages??[],t=[];for(let n of e){let e=n.list??[];t.push(...e)}return t},[f.data?.pages]),h=_(()=>p,[p,t]),y=s(),x=o(),C=g(e=>{y(u,t=>{if(!t)return t;let n=t.pages.map(t=>({...t,list:(t.list??[]).map(t=>t.content_id===e.content_id?e:t)}));return{...t,pages:n}})},[u,y]),w=g(()=>{x(u)},[u,x]),T=g(e=>({...m(e),onLikeSuccess(t){C({...e,like_count:String(t.count),dislike_count:t.dislikeCount===void 0?e.dislike_count:String(t.dislikeCount),interaction:{...e.interaction,is_liked:t.isLiked,is_dislike:t.isDisliked??e.interaction?.is_dislike}})},onDislikeSuccess(t){C({...e,like_count:t.likeCount===void 0?e.like_count:String(t.likeCount),dislike_count:String(t.count),interaction:{...e.interaction,is_dislike:t.isDisliked,is_liked:t.isLiked??e.interaction?.is_liked}})}}),[C]),D=_(()=>h.map(T),[T,h]),O=f.isPending||f.isFetching,k=t===`video`&&O&&h.length===0;return v(n,{className:`w-full`,children:t===`video`?k?v(S,{}):h.length>0?v(E,{list:h}):v(r,{type:`no-content`,text:c(`searchVideoInfo.noRelevantContent`),className:`mt-[12px]`}):v(d,{list:D,loading:O,hasMore:f.hasNextPage??!1,loadMore:async e=>{if(e!==!1)try{f&&await f.fetchNextPage()}catch(e){console.error(`获取内容列表失败`,e)}},showGroupHeaders:!1,emptyText:c(`searchVideoInfo.noRelevantContent`),onActionSuccess:w})})});O.displayName=`SearchInfoOrVideoList`;export{E as VideoList,O as default};
@@ -8,7 +8,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
8
8
  /** buttonVariants 工具定义。 */
9
9
  declare const buttonVariants: (props?: ({
10
10
  variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
11
- size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | 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> & {
@@ -1,11 +1,11 @@
1
1
 
2
2
  import * as React from "react";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
- import NextImage from "next/image";
4
+ import Image from "next/image";
5
5
 
6
6
  //#region components/ui/image.d.ts
7
7
  /** BaseImageProps 属性定义。 */
8
- type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof NextImage>, 'className' | 'src' | 'alt' | 'width' | 'height' | 'loading' | 'priority' | 'fill' | 'style'>;
8
+ type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof Image>, 'className' | 'src' | 'alt' | 'width' | 'height' | 'loading' | 'priority' | 'fill' | 'style'>;
9
9
  type CommonImageProps = BaseImageProps & {
10
10
  /** 图片地址,支持普通 URL、默认资源路径和加密地址。 */src: string; /** 图片替代文本。 */
11
11
  alt?: string; /** 图片类名。 */
@@ -27,6 +27,6 @@ type ImagePropsWithSize = CommonImageProps & {
27
27
  /** ImageProps 属性定义。 */
28
28
  type ImageProps = ImagePropsWithFill | ImagePropsWithSize;
29
29
  /** 图片组件:支持 bnc 解密、默认资源域名拼接与错误占位。 */
30
- declare function Image(props: ImageProps): react_jsx_runtime0.JSX.Element;
30
+ declare function Image$1(props: ImageProps): react_jsx_runtime0.JSX.Element;
31
31
  //#endregion
32
- export { BaseImageProps, CommonImageProps, Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
32
+ export { BaseImageProps, CommonImageProps, Image$1 as Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@funhub/platform",
3
3
  "type": "module",
4
- "version": "0.1.124",
4
+ "version": "0.1.125",
5
5
  "private": false,
6
6
  "sideEffects": [
7
7
  "**/*.css"