@funhub/platform 0.1.67 → 0.1.69
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.
- package/dist/components/biz/business/detail/video-detail-recommend/client.mjs +1 -1
- package/dist/components/biz/business/marquee/material.d.mts +1 -1
- package/dist/components/biz/business/marquee/schema.d.mts +1 -1
- package/dist/components/biz/business/search-history/client.mjs +1 -1
- package/dist/components/biz/business/search-history/server.d.mts +2 -2
- package/dist/components/biz/business/search-history/server.mjs +1 -1
- package/dist/components/biz/business/search-input/client.d.mts +0 -2
- package/dist/components/biz/business/search-input/client.mjs +1 -1
- package/dist/components/biz/business/search-input/server.d.mts +2 -2
- package/dist/components/biz/business/search-input/server.mjs +1 -1
- package/dist/components/biz/business/tab-bar/client.mjs +1 -1
- package/dist/components/biz/business/text-recommend/client.d.mts +0 -1
- package/dist/components/biz/business/text-recommend/client.mjs +1 -1
- package/dist/components/pages/search/top-header.mjs +1 -1
- package/dist/components/pages/search-result/page-client.mjs +1 -1
- package/dist/components/ui/badge.d.mts +1 -1
- package/dist/components/ui/button.d.mts +2 -2
- package/dist/hooks/use-search-history.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{gContentGetGuessYouLikeVideos as e}from"../../../../../service/generated/client.mjs";import{Box as t}from"../../../../ui/box.mjs";import{Text as n}from"../../../../ui/text.mjs";import{useRequest as r}from"../../../../../hooks/query/use-query.mjs";import i from"../../../../../assets/icons/detail/video_flag.mjs";import{MiniThreeCard as a}from"../../../../common/cards/mini-three-card.mjs";import{useCardDecoration as o}from"../../../../../hooks/use-card-decoration.mjs";import{buildEditorPreviewRecommendList as s}from"../shared/editor-preview.mjs";import{useVideoDetailMaterialRuntimeContext as c}from"../shared/runtime-context-provider.mjs";import{clampColumns as l,mergeManualAndPool as u,resolveRows as d}from"./utils.mjs";import{useCallback as f,useEffect as p,useMemo as m,useRef as ee,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";function v({rows:v,columns:y,smartTagEnabled:
|
|
2
|
+
"use client";import{gContentGetGuessYouLikeVideos as e}from"../../../../../service/generated/client.mjs";import{Box as t}from"../../../../ui/box.mjs";import{Text as n}from"../../../../ui/text.mjs";import{useRequest as r}from"../../../../../hooks/query/use-query.mjs";import i from"../../../../../assets/icons/detail/video_flag.mjs";import{MiniThreeCard as a}from"../../../../common/cards/mini-three-card.mjs";import{useCardDecoration as o}from"../../../../../hooks/use-card-decoration.mjs";import{buildEditorPreviewRecommendList as s}from"../shared/editor-preview.mjs";import{useVideoDetailMaterialRuntimeContext as c}from"../shared/runtime-context-provider.mjs";import{clampColumns as l,mergeManualAndPool as u,resolveRows as d}from"./utils.mjs";import{useCallback as f,useEffect as p,useMemo as m,useRef as ee,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";function v({rows:v,columns:y,smartTagEnabled:S,smartTagIds:C,title:ie,showPlayCount:ae,playCountDelta:oe,showEpisode:se,enableInfinite:ce,items:T,mode:le=`renderer`}){let E=c()?.detailId||``,D=le===`editor`,O=D,{getVerticalHoCoverImageUrl:k,getTitleText:A}=o(),j=ee(null),M=S===!0,N=m(()=>Array.isArray(C)?C.map(e=>String(e||``).trim()).filter(Boolean):[],[C]),P=m(()=>T??[],[T]),F=!!ce&&M&&!D,I=!M,L=F&&M&&!O,ue=d(v,F),R=l(y),z=ue*R,[de,B]=h([]),[V,H]=h(2),[U,W]=h(!1),[G,K]=h(!1),q=m(()=>s(z),[z]),{data:J}=r([`video-detail-recommend`,E,L?`paged`:`all`],async()=>!E||O?null:L?await e({page:1,page_size:16}):await e(),{enabled:!O&&!!E}),Y=m(()=>O?q:b(J?.data?.videos,E),[J?.data?.videos,E,q,O]);p(()=>{if(!L){B([]),H(2),W(!1),K(!1);return}B(Y),H(2),W(x(J?.data?.videos,16)),K(!1)},[J?.data?.videos,Y,L]);let X=L?de:Y,fe=m(()=>I?new Set(P.map(e=>w(e.contentId)).filter(Boolean)):new Set,[P,I]),pe=m(()=>{if(O)return X;let e=X.filter(e=>!fe.has(e.id));if(!M||N.length===0)return e;let t=new Set(N.map(String));return e.filter(e=>(Array.isArray(e.source_tags)?e.source_tags:String(e.source_tags||``).split(`,`).filter(Boolean)).some(e=>t.has(String(e?.id??e))))},[X,O,M,fe,N]),Z=m(()=>{if(!I||!P.length)return[];let e=new Map;return X.forEach(t=>{let n=w(t.id);n&&e.set(n,t)}),P.map((t,n)=>{let r=q[n%Math.max(1,q.length)],i=w(t.contentId),a=e.get(i)??(O?{...r,id:i||r.id||`preview-manual-${n+1}`,name:r.name||`猜你喜欢 ${n+1}`}:null);if(!a)return null;let o=t.titleMode===`custom`?t.title:A(a),s=t.coverMode===`upload`?t.coverUrl:k(a);return{info:{...a,name:o||a.name,img_y:s||a.img_y,img_x:s||a.img_x},config:{showPlayCount:t.showPlayCount,playCountDelta:t.playCountDelta,showEpisode:t.showEpisode}}}).filter(Boolean)},[q,X,A,k,O,P,I]),Q=m(()=>pe.map(e=>({info:e})),[pe]),me=m(()=>u(Z,Q,z),[Z,z,Q]),$=m(()=>{if(L){if(!Z.length)return Q;let e=new Set(Z.map(e=>e.info.id).filter(Boolean));return Z.concat(Q.filter(t=>!e.has(t.info.id)))}if(F){if(!Z.length)return Q;let e=new Set(Z.map(e=>e.info.id).filter(Boolean));return Z.concat(Q.filter(t=>!e.has(t.info.id)))}return me},[me,Z,Q,F,L]),he=U&&$.length>0?Math.max(0,$.length-4):-1,ge=String(ie||``).trim(),_e=f(async()=>{if(!(!L||!U||G)){K(!0);try{let t=await e({page:V,page_size:16}),n=Array.isArray(t.data?.videos)?t.data.videos:[],r=b(n,E),i=0;B(e=>{let t=new Set(e.map(e=>e.id).filter(Boolean)),n=[...e];return r.forEach(e=>{(!e.id||!t.has(e.id))&&(n.push(e),e.id&&t.add(e.id))}),i=n.length-e.length,n}),H(e=>e+1),W(x(n,16)&&i>0)}catch(e){console.error(`猜你喜欢分页加载失败`,e),W(!1)}finally{K(!1)}}},[E,U,G,V,L]);return p(()=>{if(!L)return;let e=j.current;if(!e||!U)return;let t=new IntersectionObserver(e=>{e[0]?.isIntersecting&&!G&&_e()});return t.observe(e),()=>{t.disconnect()}},[_e,U,G,L,he]),$.length?_(t,{className:`w-full mt-[16px] ${O?`pointer-events-none`:``}`,children:[ge?g(n,{className:`block pl-[12px] mb-[8px] text-text1 text-[18px] leading-[26px] font-bold`,children:ge}):null,g(t,{className:`w-full flex flex-wrap px-[12px]`,children:$.map((e,t)=>{let r=A(e.info),o=ae!==!1&&(e.config?.showPlayCount??!0),s=e.config?.showEpisode??se,c=ne(e.info.play_count||0),l=te(e.info),u=Number.isFinite(R)&&R>0?R:3,d=`${100/u}%`,f=t%u,p=u>1?{paddingLeft:8*f/u,paddingRight:8*(u-f-1)/u}:null;return g(`div`,{ref:t===he?j:void 0,style:{width:d,...p||{}},children:g(a,{url:k(e.info),text:r,textChild:g(n,{as:`h3`,className:`text-text1 text-[16px] h-[24px] leading-[24px] mt-[4px] line-clamp-1`,children:r}),style:{width:`100%`},bottomLeftChild:o?_(`div`,{className:`h-[20px] leading-[20px] text-[#fff] text-[12px] px-[4px] rounded-[4px] bg-[#333] ml-[4px] flex items-center`,children:[g(i,{className:`w-[16px] h-[auto] text-[#fff] mr-[4px]`}),c]}):null,bottomRightChild:s&&l?g(`div`,{className:`text-[#fff] text-[12px] leading-[20px] pr-2`,children:l}):null,linkPath:O?``:re(e.info)})},`guess-like-${t}`)})})]}):null}function y(e){return{id:e.video_id||``,mid:``,name:e.name||``,cat_id:``,cat_name:``,status:`1`,status_text:``,create_time:``,content_type:0,episode_cnt:e.episode_count||0,show_at:e.show_at??``,position:``,img_type:e.img_type??``,img_x:e.img_x??``,img_y:e.img_y??``,img_width:``,img_height:``,play_count:e.play_count,preview_images:[],duration:String(e.duration??``),score:String(e.score??``),is_more_link:e.is_more_link?`y`:`n`,update_status:String(e.update_status??``),description:e.description??``,language:``,director:``,actor:``,area:``,issue_date:``,publisher:``,series:``,number:``,tags:[],source_tags:e.source_tags??``,source_actor:[],links:Array.isArray(e.episodes)?e.episodes.map(e=>({id:e.id??``,name:e.name??``,preview_m3u8_url:e.preview_m3u8_url??``,m3u8_url:e.m3u8_url??``})):[],money:``,up_user:``,source_username:``,task_id:``,file_status:``}}function b(e,t){if(!Array.isArray(e))return[];let n=w(t);return e.map(e=>y(e)).filter(e=>!n||!e.id||w(e.id)!==n)}function x(e,t){if(!Array.isArray(e)||e.length===0)return!1;let n=e[0];if(typeof n?.has_more==`boolean`)return n.has_more;let r=Number(n?.total??0);return Number.isFinite(r)&&r>0?r>t:e.length>=t}function te(e){if(S(e)){let t=Number(e.episode_cnt||e.links?.length||0);return t>0?`全${t}集`:``}return C(Number(e.duration||0))}function S(e){if(Number(e.type??e.content_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 C(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 ne(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 re(e){if(e.content_type===0){let t=encodeURIComponent(e.name||``);return`/video/${e.id}/${t}/episode/1`}return`/post/${e.id}`}function w(e){return typeof e==`string`?e.trim():``}export{v as VideoDetailRecommendClient};
|
|
@@ -18,7 +18,7 @@ declare const marqueeMaterial: DefineMaterialOption<typeof MarqueeServer, typeof
|
|
|
18
18
|
}, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
|
|
19
19
|
click: zod.ZodObject<{
|
|
20
20
|
readonly enabled: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
21
|
-
readonly redirectType: zod.ZodOptional<zod.ZodType<"
|
|
21
|
+
readonly redirectType: zod.ZodOptional<zod.ZodType<"content" | "link" | "content_list", unknown, zod_v4_core0.$ZodTypeInternals<"content" | "link" | "content_list", unknown>>> & SchemaHasDefaultValue;
|
|
22
22
|
readonly link: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
|
|
23
23
|
}, zod_v4_core0.$strip> & SchemaHasDefaultValue;
|
|
24
24
|
close: zod.ZodObject<{
|
|
@@ -22,7 +22,7 @@ declare const marqueeInspectorPropsSchema: z.ZodObject<{
|
|
|
22
22
|
}, z.core.$strip>> & SchemaHasDefaultValue;
|
|
23
23
|
click: z.ZodObject<{
|
|
24
24
|
readonly enabled: z.ZodBoolean & SchemaHasDefaultValue;
|
|
25
|
-
readonly redirectType: z.ZodOptional<z.ZodType<"
|
|
25
|
+
readonly redirectType: z.ZodOptional<z.ZodType<"content" | "link" | "content_list", unknown, z.core.$ZodTypeInternals<"content" | "link" | "content_list", unknown>>> & SchemaHasDefaultValue;
|
|
26
26
|
readonly link: z.ZodOptional<z.ZodString> & SchemaHasDefaultValue;
|
|
27
27
|
}, z.core.$strip> & SchemaHasDefaultValue;
|
|
28
28
|
close: z.ZodObject<{
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../../ui/button.mjs";import t from"../../../../utils/event-bus.mjs";import{Box as n}from"../../../ui/box.mjs";import{Text as r}from"../../../ui/text.mjs";import{eventKey as i}from"../../../../constants/event-key.mjs";import{DeleteConfirmDialog as a}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{useCallback as o,useEffect as s,useMemo as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{
|
|
2
|
+
"use client";import{Button as e}from"../../../ui/button.mjs";import t from"../../../../utils/event-bus.mjs";import{Box as n}from"../../../ui/box.mjs";import{Text as r}from"../../../ui/text.mjs";import{eventKey as i}from"../../../../constants/event-key.mjs";import{DeleteConfirmDialog as a}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{useCallback as o,useEffect as s,useMemo as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{usePathname as f,useRouter as p,useSearchParams as m}from"next/navigation";function h(e,t){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function g(g){let{title:_,rows:v=1,clearText:y,confirmDescription:b,storageKey:x=`guest`,onHistoryClick:S,mode:C=`renderer`}=g,w=_??`搜索历史`,T=y??`清空`,E=b??`确定要清除所有搜索历史吗?`,D=c(()=>[`搜索历史1`,`搜索历史2`,`搜索历史3`],[]),[O,k]=l([]),[A,j]=l(!1),M=p(),N=f(),P=m(),F=`search_history_${x}`,I=o(()=>{let e=[];try{let t=localStorage.getItem(F);if(t)try{let n=JSON.parse(t);e=Array.isArray(n)?n:[]}catch{e=[]}k(e)}catch(e){console.error(`Failed to parse search history`,e),k([])}},[F]);s(()=>(I(),t.on(i.SEARCH_HISTORY_UPDATE,I),()=>t.off(i.SEARCH_HISTORY_UPDATE,I)),[I]);let L=()=>{k([]),localStorage.removeItem(F),j(!1),t.emit(i.SEARCH_HISTORY_UPDATE)},R=c(()=>(O.length?O:C===`editor`?D:[]).slice(0,v*10),[O,C,D,v]);if(R.length===0)return null;let z=e=>{if(S){S(e);return}let t=new URLSearchParams(P.toString());t.set(`q`,e);let n=N.includes(`/search-result`)?N:`/search-result`;M.push(`${n}?${t.toString()}`)};return d(n,{className:`px-4 py-2`,children:[d(n,{className:`flex justify-between items-center mb-2`,children:[u(r,{className:`text-[16px] font-bold text-text1`,children:w}),u(e,{variant:`ghost`,size:`sm`,className:`text-text3 text-[12px] p-0 h-auto`,onClick:()=>j(!0),children:T})]}),u(n,{className:`flex flex-wrap gap-2 overflow-hidden`,style:{maxHeight:`${v*40}px`},children:R.map((e,t)=>u(n,{className:`px-3 py-1 bg-bg2 rounded-full cursor-pointer`,onClick:()=>z(e),children:u(r,{className:`text-[14px] text-text2`,children:h(e,8)})},t))}),u(a,{open:A,onOpenChange:j,onConfirm:L,title:``,description:E})]})}export{g as SearchHistoryClient};
|
|
@@ -8,8 +8,8 @@ interface ServerProps extends SearchHistoryProps {
|
|
|
8
8
|
onHistoryClick?: (keyword: string) => void;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* 搜索历史物料组件 (search-history) -
|
|
11
|
+
* 搜索历史物料组件 (search-history) - 服务端部分,国际化由 Client 内 useTranslations 处理
|
|
12
12
|
*/
|
|
13
|
-
declare function SearchHistoryServer(props: ServerProps):
|
|
13
|
+
declare function SearchHistoryServer(props: ServerProps): react_jsx_runtime0.JSX.Element;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { SearchHistoryServer };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{SearchHistoryClient as e}from"./client.mjs";import{jsx as t}from"react/jsx-runtime";
|
|
2
|
+
import{SearchHistoryClient 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 SearchHistoryServer};
|
|
@@ -5,7 +5,6 @@ import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
5
5
|
//#region components/biz/business/search-input/client.d.ts
|
|
6
6
|
type SearchInputProps = SearchInputInspectorProps;
|
|
7
7
|
interface ClientProps extends SearchInputProps {
|
|
8
|
-
/** 占位符,未配置时由服务端 defaultPlaceholder 兜底 */
|
|
9
8
|
placeholder?: string;
|
|
10
9
|
defaultPlaceholder?: string;
|
|
11
10
|
searchLabel?: string;
|
|
@@ -14,7 +13,6 @@ interface ClientProps extends SearchInputProps {
|
|
|
14
13
|
}
|
|
15
14
|
/**
|
|
16
15
|
* 搜索输入框物料组件 (SearchInput) - 客户端交互部分
|
|
17
|
-
* 适配 Figma 设计稿布局:包含返回按钮、带边框的输入框、外部搜索按钮
|
|
18
16
|
*/
|
|
19
17
|
declare function SearchInputClient(props: ClientProps): react_jsx_runtime0.JSX.Element;
|
|
20
18
|
//#endregion
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import
|
|
2
|
+
"use client";import{Box as e}from"../../../ui/box.mjs";import{Input as t}from"../../../ui/input.mjs";import{Text as n}from"../../../ui/text.mjs";import r from"../../../../assets/icons/left_arrow.mjs";import i from"../../../../assets/icons/search.mjs";import a from"../../../../assets/icons/clear.mjs";import{useCallback as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{usePathname as u,useRouter as d,useSearchParams as f}from"next/navigation";function p(e){if(!e||typeof e!=`string`)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.map(e=>e==null?``:String(e).trim()).filter(Boolean):[]}catch{return[]}}function m(m){let{placeholder:h,defaultPlaceholder:g,searchLabel:_,storageKey:v=`guest`,onSearch:y,mode:b=`renderer`}=m,x=h||(g??`请输入搜索内容`),S=_??`搜索`,C=b===`editor`,[w,T]=s(``),E=d(),D=u(),O=f(),k=`search_history_${v}`,A=o(e=>{if(C)return;let t=e.trim();if(t){try{let e=[t,...p(localStorage.getItem(k)).filter(e=>e!==t)].slice(0,20);localStorage.setItem(k,JSON.stringify(e))}catch(e){console.error(`Failed to save search history`,e)}if(y)y(t);else{let e=new URLSearchParams(O.toString());e.set(`q`,t);let n=D.includes(`/search-result`)?D:`/search-result`;E.push(`${n}?${e.toString()}`)}}},[k,C,y,D,E,O]);return l(e,{className:`px-3 py-2 bg-bg1 flex items-center gap-3 w-full${C?` pointer-events-none`:``}`,children:[c(e,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:()=>{C||E.back()},children:c(r,{className:`w-4 h-4 text-text1`})}),l(e,{className:`flex-1 flex items-center gap-1 bg-bg2 border border-theme5 rounded-[20px] px-2 py-1.5 overflow-hidden`,children:[c(e,{className:`p-1 shrink-0`,children:c(i,{className:`w-[14px] h-[14px] text-text3`})}),c(t,{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:x,value:w,maxLength:128,onChange:e=>T(e.target.value),onKeyDown:e=>e.key===`Enter`&&A(w)}),w&&c(a,{className:`w-[15px] h-[15px] text-text3 shrink-0 cursor-pointer active:opacity-70`,onClick:()=>T(``)})]}),c(e,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:()=>A(w),children:c(n,{className:`text-[16px] text-text1 leading-[24px] font-normal`,children:S})})]})}export{m as SearchInputClient};
|
|
@@ -4,8 +4,8 @@ import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
4
4
|
|
|
5
5
|
//#region components/biz/business/search-input/server.d.ts
|
|
6
6
|
/**
|
|
7
|
-
* 搜索输入框物料组件 (SearchInput) -
|
|
7
|
+
* 搜索输入框物料组件 (SearchInput) - 服务端部分,国际化由 Client 内 useTranslations 处理
|
|
8
8
|
*/
|
|
9
|
-
declare function SearchInputServer(props: SearchInputProps):
|
|
9
|
+
declare function SearchInputServer(props: SearchInputProps): react_jsx_runtime0.JSX.Element;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { SearchInputServer };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{SearchInputClient as e}from"./client.mjs";import{jsx as t}from"react/jsx-runtime";
|
|
2
|
+
import{SearchInputClient 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 SearchInputServer};
|
|
@@ -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{useMemo as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{usePathname as o,useRouter as s}from"next/navigation";const c=[];function l(l){let{items:u=c,mode:d=`renderer`}=l,f=s(),p=o(),m=r(()=>d===`editor`?0:u.findIndex(e=>!!(e.domainId===`home`&&p===`/`||e.domainId===`mine`&&p.includes(`/mine`))),[u,p,d]),h=e=>{if(d!==`editor`)if(e.configType===1)switch(e.functionPageType){case`搜索`:f.push(`/search`);break;case`个人中心`:f.push(`/user/mine`);break;case`内容列表`:f.push(`/video-list?tags=${e.tags}&title=${e.title}`);break;default:f.push(`/`)}else{let t=(e.domainId??``).toString().trim();f.push(t?`/domain
|
|
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{useMemo as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{usePathname as o,useRouter as s}from"next/navigation";const c=[];function l(l){let{items:u=c,mode:d=`renderer`}=l,f=s(),p=o(),m=r(()=>d===`editor`?0:u.findIndex(e=>!!(e.domainId===`home`&&p===`/`||e.domainId===`mine`&&p.includes(`/mine`))),[u,p,d]),h=e=>{if(d!==`editor`)if(e.configType===1)switch(e.functionPageType){case`搜索`:f.push(`/search`);break;case`个人中心`:f.push(`/user/mine`);break;case`内容列表`:f.push(`/video-list?tags=${e.tags}&title=${e.title}`);break;default:f.push(`/`)}else{let t=(e.domainId??``).toString().trim();f.push(t?`/domain/${t}`:`/`)}};return!u||u.length===0?null:i(t,{className:`fixed bottom-0 left-0 right-0 bg-bg1 border-t border-line safe-area-bottom z-50`,children:i(t,{className:`flex h-[50px] items-center justify-around`,children:u.map((r,o)=>{let s=m===o,c=r.icon;return s&&r.activeIcon&&(c=r.activeIcon),a(t,{className:`flex flex-col items-center justify-center flex-1 cursor-pointer`,onClick:()=>h(r),children:[i(t,{className:`relative w-6 h-6`,children:c?i(e,{src:c,alt:r.label,fill:!0,className:`object-contain`}):i(t,{className:`w-full h-full rounded-sm ${s?`bg-theme5`:`bg-text3`}`})}),i(n,{className:`text-[10px] mt-1 truncate max-w-full px-1 ${s?`text-theme5 font-medium`:`text-text3`}`,children:r.label})]},o)})})})}export{l as TabBarClient};
|
|
@@ -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{
|
|
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{usePathname as s,useRouter as c,useSearchParams as l}from"next/navigation";const u=[];function d(d){let{title:f,items:p=u,onItemClick:m,mode:h=`renderer`}=d,g=h===`editor`,_=c(),v=s(),y=l(),[b,x]=i(0),S=r(()=>{if(p.length<=6)return p;let e=b%Math.ceil(p.length/6)*6;return p.slice(e,e+6)},[p,b]);if(p.length===0)return null;let C=e=>{e.stopPropagation(),x(e=>e+1)},w=e=>{if(m){m(e);return}let t=new URLSearchParams(y.toString());t.set(`q`,e);let n=v.includes(`/search-result`)?v:`/search-result`;_.push(`${n}?${t.toString()}`)};return o(e,{className:`bg-bg1 p-3 flex flex-col gap-3 w-full${g?` pointer-events-none`:``}`,children:[o(e,{className:`flex items-center justify-between w-full`,children:[a(t,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:f}),o(e,{className:`flex items-center gap-1 cursor-pointer active:opacity-70 transition-opacity`,onClick:C,children:[a(t,{className:`text-[14px] text-text3 leading-[22px]`,children:`换一批`}),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:S.map((n,r)=>a(e,{className:`flex items-center h-[32px] cursor-pointer active:opacity-70 transition-opacity overflow-hidden`,onClick:()=>w(n.label),children:a(t,{className:`text-[14px] text-text1 leading-[22px] truncate w-full`,children:n.label})},`${b}-${r}`))})]})}export{d as TextRecommendClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Input as e}from"../../ui/input.mjs";import{useKeepAliveEffect as t,useKeepAliveState as n}from"../../common/keep-scroll-position/index.mjs";import{isPCEnv as r}from"../../../utils/tools.mjs";import{HeaderNav as i}from"../../common/header-nav/client.mjs";import a from"../../../assets/icons/search.mjs";import o from"../../../assets/icons/clear.mjs";import s from"./style.module.mjs";import{memo as c,useCallback as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{useTranslations as f}from"next-intl";import{useSearchParams as p}from"next/navigation";const
|
|
2
|
+
"use client";import{Input as e}from"../../ui/input.mjs";import{useKeepAliveEffect as t,useKeepAliveState as n}from"../../common/keep-scroll-position/index.mjs";import{isPCEnv as r}from"../../../utils/tools.mjs";import{HeaderNav as i}from"../../common/header-nav/client.mjs";import a from"../../../assets/icons/search.mjs";import o from"../../../assets/icons/clear.mjs";import s from"./style.module.mjs";import{memo as c,useCallback as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{useTranslations as f}from"next-intl";import{useSearchParams as p}from"next/navigation";function m(){}const h=c(({setSearchInputVal:c,initInputVal:h,initInputVersion:g,addSearchHistory:_,clearCallback:v=m})=>{let y=f(`components.pages.search`),[b,x]=n(`search-input-val`,``),S=p().get(`q`),C=e=>{let t=e.target.value;x(t)},w=l(e=>{c(e),_(e)},[_,c]);return t(()=>{h&&(x(h),w(h))},[h,g],`search-init-input-effect`),t(()=>{S&&(x(S),w(S))},[S],`search-url-params-effect`),u(i,{className:`h-[55px]`,rightChild:u(`div`,{className:`cursor-pointer w-[52px] flex items-center justify-center`,onClick:()=>{b&&w(b)},children:u(`span`,{className:`text-[16px] text-text1`,children:y(`topHeader.search`)})}),centerChild:d(`header`,{className:`w-[calc(100%-52px-48px)] ml-[-15px] h-[35px] rounded-[20px] flex items-center justify-center relative overflow-hidden border-line1 border-[1px]`,children:[u(`div`,{className:`absolute left-0 top-0 w-full h-full bg-bg2 opacity-50`}),u(a,{className:`w-[16px] h-[16px] text-text3 absolute left-[12px] top-[9px] z-[1]`}),u(e,{placeholder:y(`topHeader.placeholder`),maxLength:20,value:b,className:s.searchInput,onChange:C,onKeyDown:e=>{if(e.key===`Enter`){if(e.preventDefault(),!b)return;w(b)}}}),b&&u(o,{className:`w-[15px] h-[15px] text-text3 z-10 absolute right-[12px]`,onClick:()=>{r()||(x(``),c(``),v())}})]})})});export{h as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{updateUrlParams as e}from"../../../utils/common.mjs";import t from"../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{Box as r}from"../../ui/box.mjs";import{eventKey as i}from"../../../constants/event-key.mjs";import{useSearchHistory as a}from"../../../hooks/use-search-history.mjs";import o from"../search/top-header.mjs";import s from"./search-user.mjs";import c from"./search-video.mjs";import l from"./search-all.mjs";import{SORT_OPTIONS as u,SearchTab as d}from"./search-tab.mjs";import{useEffect as f,useMemo as p,useState as m}from"react";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";import{useSearchParams as
|
|
2
|
+
"use client";import{updateUrlParams as e}from"../../../utils/common.mjs";import t from"../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{Box as r}from"../../ui/box.mjs";import{eventKey as i}from"../../../constants/event-key.mjs";import{useSearchHistory as a}from"../../../hooks/use-search-history.mjs";import o from"../search/top-header.mjs";import s from"./search-user.mjs";import c from"./search-video.mjs";import l from"./search-all.mjs";import{SORT_OPTIONS as u,SearchTab as d}from"./search-tab.mjs";import{useEffect as f,useMemo as p,useState as m}from"react";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";import{useRouter as v,useSearchParams as y}from"next/navigation";const b=[{label:`综合`,value:`all`},{label:`视频`,value:`video`},{label:`用户`,value:`user`}];function x(){let x=v(),{userInfo:S}=n(),C=S?.user_id||`guest`,w=y().get(`q`)?.toString()||``,T=w?decodeURIComponent(w):``,[E,D]=m(T),[O]=m(T),[k]=m(0),[A,j]=m(b[0].value),[M,N]=m(u[0].value),[P,F]=m(0),[,I]=m([]),{addHistory:L}=a({storageKey:C}),R=p(()=>E.trim()!==``,[E]);f(()=>(t.on(i.EXCHANGE_SEARCH_TYPE,j),()=>{t.off(i.EXCHANGE_SEARCH_TYPE,j)}),[j]);function z(){x.push(`/search`)}return _(r,{className:`w-full min-h-screen bg-bg1 pb-[12px] overscroll-y-none`,children:[g(o,{setSearchInputVal:t=>{t!==E&&(I([]),D(t),e({q:t}))},initInputVal:O,initInputVersion:k,addSearchHistory:L,clearCallback:z}),g(d,{searchType:A,tabList:b,onChange:e=>{j(e),I([])},sort:M,onSortChange:e=>{N(e),F(e=>e+1)}}),R&&_(h,{children:[A===`user`&&g(s,{mode:`user`,inputVal:E,sort:M,refreshVersion:P}),A===`all`&&g(l,{searchInputVal:E,sort:M,refreshVersion:P}),A===`video`&&g(c,{mode:`video`,inputVal:E,sort:M,refreshVersion:P})]}),!R&&g(r,{className:`w-full pt-[12px]`})]})}export{x as default};
|
|
@@ -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?: "
|
|
9
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | 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?: "
|
|
11
|
-
size?: "default" | "
|
|
10
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "link" | null | undefined;
|
|
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 组件属性。 */
|
|
14
14
|
type ButtonProps = Button.Props & VariantProps<typeof buttonVariants> & {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import e from"../utils/event-bus.mjs";import{eventKey as t}from"../constants/event-key.mjs";import{useEffect as n,useState as r}from"react";function i({storageKey:i,maxCount:a=20}){let[o,s]=r([]),c=`search_history_${i}`;return n(()=>{let e=localStorage.getItem(c);if(e)try{s(JSON.parse(e))}catch(e){console.error(`Failed to parse search history`,e)}},[c]),{history:o,addHistory:n=>{if(!n.trim())return;let r=[n,...
|
|
2
|
+
import e from"../utils/event-bus.mjs";import{eventKey as t}from"../constants/event-key.mjs";import{useEffect as n,useState as r}from"react";function i({storageKey:i,maxCount:a=20}){let[o,s]=r([]),c=`search_history_${i}`;return n(()=>{let e=localStorage.getItem(c);if(e)try{s(JSON.parse(e))}catch(e){console.error(`Failed to parse search history`,e)}},[c]),{history:o,addHistory:n=>{if(!n.trim())return;let r=n.trim();try{let e=localStorage.getItem(c),t=[];if(e)try{let n=JSON.parse(e);t=Array.isArray(n)?n.map(e=>String(e).trim()).filter(Boolean):[]}catch{t=[]}let n=[r,...t.filter(e=>e!==r)].slice(0,a);s(n),localStorage.setItem(c,JSON.stringify(n))}catch(e){console.error(`Failed to save search history`,e)}e.emit(t.SEARCH_HISTORY_UPDATE)},clearHistory:()=>{s([]),localStorage.removeItem(c),e.emit(t.SEARCH_HISTORY_UPDATE)}}}export{i as useSearchHistory};
|