@funhub/platform 0.1.68 → 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.
@@ -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:x,smartTagIds:S,title:ae,showPlayCount:oe,playCountDelta:se,showEpisode:ce,enableInfinite:le,items:w,mode:ue=`renderer`}){let T=c()?.detailId||``,E=ue===`editor`,D=E,{getVerticalHoCoverImageUrl:O,getTitleText:k}=o(),de=ee(null),A=m(()=>S??[],[S]),j=m(()=>w??[],[w]),M=!!le&&!E,N=x===!0,P=!N,F=M&&N&&!D,fe=d(v,M),I=l(y),L=fe*I,[pe,R]=h([]),[z,B]=h(2),[V,H]=h(!1),[U,W]=h(!1),G=m(()=>s(L),[L]),{data:K}=r([`video-detail-recommend`,T,F?`paged`:`all`],async()=>!T||D?null:F?await e({page:1,page_size:16}):await e(),{enabled:!D&&!!T}),q=m(()=>D?G:b(K?.data?.videos,T),[K?.data?.videos,T,G,D]);p(()=>{if(!F){R([]),B(2),H(!1),W(!1);return}R(q),B(2),H(te(K?.data?.videos,16)),W(!1)},[K?.data?.videos,q,F]);let J=F?pe:q,Y=m(()=>P?new Set(j.map(e=>C(e.contentId)).filter(Boolean)):new Set,[j,P]),X=m(()=>{if(D)return J;let e=J.filter(e=>!Y.has(e.id));if(!N||A.length===0)return e;let t=new Set(A.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))))},[J,D,N,Y,A]),Z=m(()=>{if(!P||!j.length)return[];let e=new Map;return J.forEach(t=>{let n=C(t.id);n&&e.set(n,t)}),j.map((t,n)=>{let r=G[n%Math.max(1,G.length)],i=C(t.contentId),a=e.get(i)??(D?{...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:k(a),s=t.coverMode===`upload`?t.coverUrl:O(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)},[G,J,k,O,D,j,P]),Q=m(()=>X.map(e=>({info:e})),[X]),me=m(()=>u(Z,Q,L),[Z,L,Q]),$=m(()=>{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)))}if(M){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,M,F]),he=V&&$.length>0?Math.max(0,$.length-4):-1,ge=String(ae||``).trim(),_e=f(async()=>{if(!(!F||!V||U)){W(!0);try{let t=await e({page:z,page_size:16}),n=Array.isArray(t.data?.videos)?t.data.videos:[],r=b(n,T),i=0;R(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}),B(e=>e+1),H(te(n,16)&&i>0)}catch(e){console.error(`猜你喜欢分页加载失败`,e),H(!1)}finally{W(!1)}}},[T,V,U,z,F]);return p(()=>{if(!F)return;let e=de.current;if(!e||!V)return;let t=new IntersectionObserver(e=>{e[0]?.isIntersecting&&!U&&_e()});return t.observe(e),()=>{t.disconnect()}},[_e,V,U,F,he]),$.length?_(t,{className:`w-full mt-[16px] ${D?`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=k(e.info),o=oe!==!1&&(e.config?.showPlayCount??!0),s=e.config?.showEpisode??ce,c=re(e.info.play_count||0),l=ne(e.info),u=Number.isFinite(I)&&I>0?I: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?de:void 0,style:{width:d,...p||{}},children:g(a,{url:O(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:D?``:ie(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=C(t);return e.map(e=>y(e)).filter(e=>!n||!e.id||C(e.id)!==n)}function te(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 ne(e){if(x(e)){let t=Number(e.episode_cnt||e.links?.length||0);return t>0?`全${t}集`:``}return S(Number(e.duration||0))}function x(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 S(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 re(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 ie(e){if(e.content_type===0){let t=encodeURIComponent(e.name||``);return`/video/${e.id}/${t}/episode/1`}return`/post/${e.id}`}function C(e){return typeof e==`string`?e.trim():``}export{v as VideoDetailRecommendClient};
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};
@@ -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{useTranslations as f}from"next-intl";import{usePathname as p,useRouter as m,useSearchParams as h}from"next/navigation";function g(g){let _=f(`components.biz.business.searchHistory`),{title:v,rows:y=1,clearText:b,confirmDescription:x,storageKey:S=`guest`,onHistoryClick:C,mode:w=`renderer`}=g,T=b??_(`clear`),E=x??_(`confirmClearDescription`),D=c(()=>[_(`mockHistory1`),_(`mockHistory2`),_(`mockHistory3`)],[_]),[O,k]=l([]),[A,j]=l(!1),M=m(),N=p(),P=h(),F=`search_history_${S}`,I=o(()=>{let e=localStorage.getItem(F);if(e)try{k(JSON.parse(e))}catch(e){console.error(`Failed to parse search history`,e)}else k([])},[F]);s(()=>{I()},[I]),s(()=>(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(()=>{let e=O.length>0?O:w===`editor`?D:[],t=y*10;return e.slice(0,t)},[O,w,D,y]);if(R.length===0)return null;let z=e=>{if(C)C(e);else{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:v}),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:`${y*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 truncate max-w-[150px]`,children:e})},t))}),u(a,{open:A,onOpenChange:j,onConfirm:()=>{L()},title:``,description:E})]})}export{g as SearchHistoryClient};
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): Promise<react_jsx_runtime0.JSX.Element>;
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";import{getTranslations as n}from"next-intl/server";async function r(r){let{mode:i=`renderer`,...a}=r,o=await n(`components.biz.business.searchHistory`);return t(e,{...a,mode:i,title:a.title||o(`defaultTitle`),clearText:o(`clear`),confirmDescription:o(`confirmClearDescription`)})}export{r as SearchHistoryServer};
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 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)return;let n=t.trim();if(n){try{let t=localStorage.getItem(N),r=[];if(t)try{let e=JSON.parse(t);r=Array.isArray(e)?e:[]}catch{r=[]}let a=[n,...r.map(e=>String(e).trim()).filter(Boolean).filter(e=>e!==n)];localStorage.setItem(N,JSON.stringify(a.slice(0,20))),e.emit(i.SEARCH_HISTORY_UPDATE)}catch(e){console.error(`Failed to save search history`,e)}if(C)C(n);else{let e=new URLSearchParams(M.toString());e.set(`q`,n);let t=j.includes(`/search-result`)?j:`/search-result`;A.push(`${t}?${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-result`)?j:`/search-result`;A.push(`${t}${e.toString()?`?${e.toString()}`:``}`)}e.emit(i.SEARCH_HISTORY_UPDATE)}},[D,O,j,A,M]);let F=()=>{P(O)};function I(){k(``),!D&&(A.push(`/search`),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};
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): Promise<react_jsx_runtime0.JSX.Element>;
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";import{getTranslations as n}from"next-intl/server";async function r(r){let{mode:i=`renderer`,...a}=r,o=await n(`components.pages.search`);return t(e,{...a,mode:i,defaultPlaceholder:o(`topHeader.placeholder`),searchLabel:o(`topHeader.search`)})}export{r as SearchInputServer};
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};
@@ -11,7 +11,6 @@ interface ClientProps extends TextRecommendProps {
11
11
  }
12
12
  /**
13
13
  * 文字推荐物料组件 (推荐搜索) - 客户端交互部分
14
- * 适配 Figma 设计稿布局:一行展示2个,包含“换一批”功能,每批固定 6 个
15
14
  */
16
15
  declare function TextRecommendClient(props: ClientProps): react_jsx_runtime0.JSX.Element | null;
17
16
  //#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,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-result`)?b:`/search-result`;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};
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 m=c(({setSearchInputVal:c,initInputVal:m,initInputVersion:h,addSearchHistory:g})=>{let _=f(`components.pages.search`),[v,y]=n(`search-input-val`,``),b=p().get(`q`),x=e=>{let t=e.target.value;y(t)},S=l(e=>{c(e),g(e)},[g,c]);return t(()=>{m&&(y(m),S(m))},[m,h],`search-init-input-effect`),t(()=>{b&&(y(b),S(b))},[b],`search-url-params-effect`),u(i,{className:`h-[55px]`,rightChild:u(`div`,{className:`cursor-pointer w-[52px] flex items-center justify-center`,onClick:()=>{v&&S(v)},children:u(`span`,{className:`text-[16px] text-text1`,children:_(`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:_(`topHeader.placeholder`),maxLength:20,value:v,className:s.searchInput,onChange:x,onKeyDown:e=>{if(e.key===`Enter`){if(e.preventDefault(),!v)return;S(v)}}}),v&&u(o,{className:`w-[15px] h-[15px] text-text3 z-10 absolute right-[12px]`,onClick:()=>{r()||(y(``),c(``))}})]})})});export{m as default};
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 v}from"next/navigation";const y=[{label:`综合`,value:`all`},{label:`视频`,value:`video`},{label:`用户`,value:`user`}];function b(){let{userInfo:b}=n(),x=b?.user_id||`guest`,S=v().get(`q`)?.toString()||``,C=S?decodeURIComponent(S):``,[w,T]=m(C),[E]=m(C),[D]=m(0),[O,k]=m(y[0].value),[A,j]=m(u[0].value),[M,N]=m(0),[,P]=m([]),{addHistory:F}=a({storageKey:x}),I=p(()=>w.trim()!==``,[w]);return f(()=>(t.on(i.EXCHANGE_SEARCH_TYPE,k),()=>{t.off(i.EXCHANGE_SEARCH_TYPE,k)}),[k]),_(r,{className:`w-full min-h-screen bg-bg1 pb-[12px] overscroll-y-none`,children:[g(o,{setSearchInputVal:t=>{t!==w&&(P([]),T(t),e({q:t}))},initInputVal:E,initInputVersion:D,addSearchHistory:F}),g(d,{searchType:O,tabList:y,onChange:e=>{k(e),P([])},sort:A,onSortChange:e=>{j(e),N(e=>e+1)}}),I&&_(h,{children:[O===`user`&&g(s,{mode:`user`,inputVal:w,sort:A,refreshVersion:M}),O===`all`&&g(l,{searchInputVal:w,sort:A,refreshVersion:M}),O===`video`&&g(c,{mode:`video`,inputVal:w,sort:A,refreshVersion:M})]}),!I&&g(r,{className:`w-full pt-[12px]`})]})}export{b as default};
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?: "default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
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?: "default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
11
- size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
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,...o.filter(e=>e!==n)].slice(0,a);s(r),localStorage.setItem(c,JSON.stringify(r)),e.emit(t.SEARCH_HISTORY_UPDATE)},clearHistory:()=>{s([]),localStorage.removeItem(c),e.emit(t.SEARCH_HISTORY_UPDATE)}}}export{i as useSearchHistory};
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};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@funhub/platform",
3
3
  "type": "module",
4
- "version": "0.1.68",
4
+ "version": "0.1.69",
5
5
  "private": false,
6
6
  "sideEffects": [
7
7
  "**/*.css"