@funhub/platform 0.1.53 → 0.1.56

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.
Files changed (103) hide show
  1. package/README.md +13 -0
  2. package/bin/index.mjs +323 -0
  3. package/dist/assets/images/user/default_avatar.mjs +2 -0
  4. package/dist/components/biz/business/banner/variants/basic-banner/material.d.mts +1 -1
  5. package/dist/components/biz/business/banner-carousel/material.d.mts +1 -1
  6. package/dist/components/biz/business/channel-list/material.d.mts +1 -1
  7. package/dist/components/biz/business/detail/materials/registry.d.mts +7 -7
  8. package/dist/components/biz/business/detail/materials/video-detail-actions/material.d.mts +1 -1
  9. package/dist/components/biz/business/detail/materials/video-detail-info/material.d.mts +1 -1
  10. package/dist/components/biz/business/detail/materials/video-detail-info-title/material.d.mts +1 -1
  11. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/material.d.mts +1 -1
  12. package/dist/components/biz/business/detail/materials/video-detail-player/material.d.mts +1 -1
  13. package/dist/components/biz/business/detail/materials/video-detail-recommend/material.d.mts +1 -1
  14. package/dist/components/biz/business/floating-ball/material.d.mts +1 -1
  15. package/dist/components/biz/business/header-search/header-avatar-icon/material.d.mts +1 -1
  16. package/dist/components/biz/business/header-search/header-avatar-logo-search/material.d.mts +1 -1
  17. package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/material.d.mts +1 -1
  18. package/dist/components/biz/business/header-search/header-logo-search/material.d.mts +1 -1
  19. package/dist/components/biz/business/header-search/header-search/material.d.mts +1 -1
  20. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/material.d.mts +1 -1
  21. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/material.d.mts +1 -1
  22. package/dist/components/biz/business/large-feature-grid/card-item.mjs +1 -1
  23. package/dist/components/biz/business/large-feature-grid/material.d.mts +2 -2
  24. package/dist/components/biz/business/marquee/client.mjs +1 -1
  25. package/dist/components/biz/business/marquee/material.d.mts +2 -2
  26. package/dist/components/biz/business/marquee/schema.d.mts +1 -1
  27. package/dist/components/biz/business/profile/profile-header/material.d.mts +2 -2
  28. package/dist/components/biz/business/profile/profile-header/user-profile-avatar.mjs +1 -1
  29. package/dist/components/biz/business/profile/profile-header/user-profile-cover-background.mjs +1 -1
  30. package/dist/components/biz/business/profile/profile-main/material.d.mts +1 -1
  31. package/dist/components/biz/business/search-history/client.mjs +1 -1
  32. package/dist/components/biz/business/search-history/material.d.mts +1 -1
  33. package/dist/components/biz/business/search-history/schema.d.mts +1 -1
  34. package/dist/components/biz/business/search-history/server.mjs +1 -1
  35. package/dist/components/biz/business/search-input/client.d.mts +2 -0
  36. package/dist/components/biz/business/search-input/client.mjs +1 -1
  37. package/dist/components/biz/business/search-input/material.d.mts +1 -4
  38. package/dist/components/biz/business/search-input/schema.d.mts +1 -3
  39. package/dist/components/biz/business/search-input/schema.mjs +1 -1
  40. package/dist/components/biz/business/shortcut-grid/material.d.mts +1 -1
  41. package/dist/components/biz/business/tab-bar/material.d.mts +2 -2
  42. package/dist/components/biz/business/tab-bar/schema.d.mts +2 -2
  43. package/dist/components/biz/business/text-recommend/client.mjs +1 -1
  44. package/dist/components/biz/business/text-recommend/material.d.mts +1 -1
  45. package/dist/components/biz/business/text-recommend/schema.d.mts +1 -1
  46. package/dist/components/biz/business/video-horizontal-list/client.d.mts +2 -1
  47. package/dist/components/biz/business/video-horizontal-list/client.mjs +1 -1
  48. package/dist/components/biz/business/video-horizontal-list/material.d.mts +7 -7
  49. package/dist/components/biz/business/video-horizontal-list/material.mjs +1 -1
  50. package/dist/components/biz/business/video-horizontal-list/schema.d.mts +7 -7
  51. package/dist/components/biz/business/video-horizontal-list/schema.mjs +1 -1
  52. package/dist/components/biz/example/button/material.d.mts +1 -1
  53. package/dist/components/biz/example/button/material.mjs +1 -1
  54. package/dist/components/common/list/post-list/post-list.mjs +1 -1
  55. package/dist/components/common/list/user-activity-list/user-activity-list.d.mts +1 -1
  56. package/dist/components/common/list/user-activity-list/user-activity-list.mjs +1 -1
  57. package/dist/components/common/list/video-list/video-list.mjs +1 -1
  58. package/dist/components/pages/(follow)/_components/follow-button/index.mjs +1 -1
  59. package/dist/components/pages/login/password.mjs +1 -1
  60. package/dist/components/pages/login/register.mjs +1 -1
  61. package/dist/components/pages/login/reset-password.mjs +1 -1
  62. package/dist/components/pages/login/verify.mjs +1 -1
  63. package/dist/components/pages/search-result/page-client.mjs +1 -1
  64. package/dist/components/pages/search-result/search-all.mjs +1 -1
  65. package/dist/components/pages/search-result/search-tab.mjs +1 -1
  66. package/dist/components/pages/search-result/search-user.mjs +1 -1
  67. package/dist/components/pages/search-result/search-video.mjs +1 -1
  68. package/dist/components/pages/settings/_components/reset-password-drawer.mjs +1 -1
  69. package/dist/components/pages/settings/_components/settings.mjs +1 -1
  70. package/dist/components/ui/button.d.mts +1 -1
  71. package/dist/i18n/locales/en.mjs +2 -2
  72. package/dist/i18n/locales/zh-CN.mjs +2 -2
  73. package/dist/service/batch-get-video-detail.d.mts +21 -0
  74. package/dist/service/batch-get-video-detail.mjs +2 -0
  75. package/dist/service/get-popular-video-list-post.d.mts +8 -0
  76. package/dist/service/get-popular-video-list-post.mjs +2 -0
  77. package/dist/service.d.mts +3 -1
  78. package/dist/service.mjs +1 -1
  79. package/dist/utils/password-validator.d.mts +28 -0
  80. package/dist/utils/password-validator.mjs +2 -0
  81. package/dist/utils/schema/index.d.mts +1 -1
  82. package/dist/utils/schema/material.d.mts +7 -9
  83. package/dist/utils/schema/utils.d.mts +13 -3
  84. package/dist/utils/schema/utils.mjs +1 -1
  85. package/dist/utils.d.mts +3 -2
  86. package/dist/utils.mjs +1 -1
  87. package/package.json +7 -2
  88. package/templates/base/_meta.json +4 -0
  89. package/templates/base/template/README.md.template +32 -0
  90. package/templates/base/template/__dot__gitignore +6 -0
  91. package/templates/base/template/app/[locale]/layout.tsx.template +36 -0
  92. package/templates/base/template/app/[locale]/page.tsx.template +24 -0
  93. package/templates/base/template/app/globals.css +26 -0
  94. package/templates/base/template/app/layout.tsx.template +38 -0
  95. package/templates/base/template/eslint.config.mjs.template +68 -0
  96. package/templates/base/template/i18n/request.ts.template +3 -0
  97. package/templates/base/template/next-env.d.ts.template +4 -0
  98. package/templates/base/template/next.config.ts.template +21 -0
  99. package/templates/base/template/package.json.template +37 -0
  100. package/templates/base/template/postcss.config.js.template +18 -0
  101. package/templates/base/template/proxy.ts.template +18 -0
  102. package/templates/base/template/tailwind.config.cjs.template +13 -0
  103. package/templates/base/template/tsconfig.json.template +43 -0
@@ -1,5 +1,5 @@
1
1
 
2
- import { DefineMaterialOption } from "../../../../utils/schema/material.mjs";
2
+ import { DefineMaterialOption, MaterialCategory } from "../../../../utils/schema/material.mjs";
3
3
  import * as react from "react";
4
4
  import * as zod from "zod";
5
5
  import * as zod_v4_core0 from "zod/v4/core";
@@ -7,6 +7,6 @@ import * as zod_v4_core0 from "zod/v4/core";
7
7
  //#region components/biz/business/large-feature-grid/material.d.ts
8
8
  declare const largeFeatureGridMaterial: DefineMaterialOption<react.ComponentType<any>, react.ComponentType<any>, zod.ZodObject<Readonly<{
9
9
  [k: string]: zod_v4_core0.$ZodType<unknown, unknown, zod_v4_core0.$ZodTypeInternals<unknown, unknown>>;
10
- }>, zod_v4_core0.$strip>, string>;
10
+ }>, zod_v4_core0.$strip>, string, MaterialCategory>;
11
11
  //#endregion
12
12
  export { largeFeatureGridMaterial };
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Image as e}from"../../../ui/image.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import r from"../../../../assets/icons/right_arrow.mjs";import i from"../../../../assets/images/marquee.mjs";import a from"./marquee.module.mjs";import{useEffect as o,useMemo as s,useState as c}from"react";import{X as l}from"lucide-react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{useRouter as f}from"next/navigation";const p=[];function m(e,t=20){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function h(e){let t=5381;for(let n=0;n<e.length;n+=1)t=(t<<5)+t^(e.codePointAt(n)??0);return(t>>>0).toString(36)}function g(e,t){return e?t===`once`?!0:new Date(e).toLocaleDateString()===new Date().toLocaleDateString():!1}function _(e){let t=localStorage.getItem(e);if(!t)return{};try{return JSON.parse(t)}catch{let e=Number(t);return Number.isNaN(e)?{}:{closedAt:e}}}function v(e,t){localStorage.setItem(e,JSON.stringify(t))}function y(y){let{contents:b=p,click:x,close:S,displayStrategy:C,mode:w=`renderer`}=y,T=w===`editor`,E=f(),[D,O]=c(!0),[k,A]=c(!1),[j,M]=c(0);o(()=>{A(!0)},[]);let N=s(()=>{let e=C?.period?.start,t=C?.period?.end;if(!e&&!t)return!0;let n=Date.now(),r=e?new Date(e).getTime():0,i=t?new Date(t).getTime():2**53-1;return n>=r&&n<=i},[C?.period]),P=s(()=>(b??[]).map(e=>({...e,text:m(String(e?.text??``))})).filter(e=>!!e.text),[b]),F=s(()=>{let e=C?.rule??`once`,t=C?.period??{start:``,end:``};return`marquee_state_${h(JSON.stringify({rule:e,start:t.start??``,end:t.end??``,items:P.map(e=>({text:e.text??``,link:e.link??``}))}))}`},[C?.period,C?.rule,P]);if(o(()=>{M(0)},[P.length]),o(()=>{if(!k||T||!C?.rule||P.length===0)return;let e=_(F),t=g(e.displayedAt,C.rule),n=g(e.closedAt,C.rule);(t||n)&&O(!1)},[C?.rule,T,k,P.length,F]),o(()=>{if(!k||T||!C?.rule||!D||!N||P.length===0)return;let e=_(F);g(e.displayedAt,C.rule)||v(F,{...e,displayedAt:Date.now()})},[C?.rule,T,k,N,D,P.length,F]),!k||!D||!N||P.length===0)return null;let I=P[j%P.length],L=x?.enabled===!0,R=x?.link||I.link,z=L&&!!R,B=S?.enabled===!0;function V(){!C?.rule||P.length===0||v(F,{..._(F),closedAt:Date.now()})}let H=e=>{e.stopPropagation(),O(!1),V()},U=()=>{T||z&&R&&(B&&(O(!1),V()),E.push(R))},W=()=>{T||!D||P.length<=1||M(e=>(e+1)%P.length)},G=T?a[`marquee-item-paused`]:P.length>1?a[`marquee-item-once`]:a[`marquee-item-loop`];return u(t,{className:T?`px-3 py-2 w-full bg-bg1 pointer-events-none`:`px-3 py-2 w-full bg-bg1`,children:d(t,{className:`pl-[2px] pr-[12px] py-[2px] flex items-center w-full cursor-pointer relative rounded-[8px] overflow-hidden ${a[`marquee-shell`]}`,onClick:U,children:[u(t,{className:`relative shrink-0 w-[36px] h-[36px] mr-[4px]`,children:u(e,{src:typeof i==`string`?i:i.src,alt:`notice`,fill:!0,className:`object-cover`,unoptimized:!0})}),u(t,{className:`flex-1 overflow-hidden relative h-[22px] ml-1`,children:u(t,{className:`absolute inset-y-0 left-0 flex items-center whitespace-nowrap ${G}`,onAnimationEnd:W,children:u(n,{className:`inline-block text-[14px] text-[#f59e0b] leading-[22px] font-medium`,children:I.text})},`marquee-item-${j}`)}),d(t,{className:`flex items-center gap-[12px] shrink-0 ml-[4px]`,children:[z&&u(r,{className:`w-[16px] h-[16px] text-[#f59e0b]`}),B&&u(t,{className:`opacity-30 hover:opacity-100 transition-opacity`,onClick:H,children:u(l,{className:`w-[12px] h-[12px] text-[#F59E0B]`})})]})]})})}export{y as MarqueeClient};
2
+ "use client";import{Image as e}from"../../../ui/image.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import r from"../../../../assets/icons/right_arrow.mjs";import i from"../../../../assets/images/marquee.mjs";import a from"./marquee.module.mjs";import{useEffect as o,useMemo as s,useState as c}from"react";import{X as l}from"lucide-react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{useTranslations as f}from"next-intl";import{useRouter as p}from"next/navigation";const m=[];function h(e,t=20){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function g(e){let t=5381;for(let n=0;n<e.length;n+=1)t=(t<<5)+t^(e.codePointAt(n)??0);return(t>>>0).toString(36)}function _(e,t){return e?t===`once`?!0:new Date(e).toLocaleDateString()===new Date().toLocaleDateString():!1}function v(e){let t=localStorage.getItem(e);if(!t)return{};try{return JSON.parse(t)}catch{let e=Number(t);return Number.isNaN(e)?{}:{closedAt:e}}}function y(e,t){localStorage.setItem(e,JSON.stringify(t))}function b(b){let x=f(`components.biz.business.marquee`),{contents:S=m,click:C,close:w,displayStrategy:T,mode:E=`renderer`}=b,D=E===`editor`,O=p(),[k,A]=c(!0),[j,M]=c(!1),[N,P]=c(0);o(()=>{M(!0)},[]);let F=s(()=>{let e=T?.period?.start,t=T?.period?.end;if(!e&&!t)return!0;let n=Date.now(),r=e?new Date(e).getTime():0,i=t?new Date(t).getTime():2**53-1;return n>=r&&n<=i},[T?.period]),I=s(()=>(S??[]).map(e=>({...e,text:h(String(e?.text??``))})).filter(e=>!!e.text),[S]),L=s(()=>{let e=T?.rule??`once`,t=T?.period??{start:``,end:``};return`marquee_state_${g(JSON.stringify({rule:e,start:t.start??``,end:t.end??``,items:I.map(e=>({text:e.text??``,link:e.link??``}))}))}`},[T?.period,T?.rule,I]);if(o(()=>{P(0)},[I.length]),o(()=>{if(!j||D||!T?.rule||I.length===0)return;let e=v(L),t=_(e.displayedAt,T.rule),n=_(e.closedAt,T.rule);(t||n)&&A(!1)},[T?.rule,D,j,I.length,L]),o(()=>{if(!j||D||!T?.rule||!k||!F||I.length===0)return;let e=v(L);_(e.displayedAt,T.rule)||y(L,{...e,displayedAt:Date.now()})},[T?.rule,D,j,F,k,I.length,L]),!j||!k||!F||I.length===0)return null;let R=I[N%I.length],z=C?.enabled===!0,B=C?.link||R.link,V=z&&!!B,H=w?.enabled===!0;function U(){!T?.rule||I.length===0||y(L,{...v(L),closedAt:Date.now()})}let W=e=>{e.stopPropagation(),A(!1),U()},G=()=>{D||V&&B&&(H&&(A(!1),U()),O.push(B))},K=()=>{D||!k||I.length<=1||P(e=>(e+1)%I.length)},q=D?a[`marquee-item-paused`]:I.length>1?a[`marquee-item-once`]:a[`marquee-item-loop`];return u(t,{className:D?`px-3 py-2 w-full bg-bg1 pointer-events-none`:`px-3 py-2 w-full bg-bg1`,children:d(t,{className:`pl-[2px] pr-[12px] py-[2px] flex items-center w-full cursor-pointer relative rounded-[8px] overflow-hidden ${a[`marquee-shell`]}`,onClick:G,children:[u(t,{className:`relative shrink-0 w-[36px] h-[36px] mr-[4px]`,children:u(e,{src:typeof i==`string`?i:i.src,alt:x(`noticeAlt`),fill:!0,className:`object-cover`,unoptimized:!0})}),u(t,{className:`flex-1 overflow-hidden relative h-[22px] ml-1`,children:u(t,{className:`absolute inset-y-0 left-0 flex items-center whitespace-nowrap ${q}`,onAnimationEnd:K,children:u(n,{className:`inline-block text-[14px] text-[#f59e0b] leading-[22px] font-medium`,children:R.text})},`marquee-item-${N}`)}),d(t,{className:`flex items-center gap-[12px] shrink-0 ml-[4px]`,children:[V&&u(r,{className:`w-[16px] h-[16px] text-[#f59e0b]`}),H&&u(t,{className:`opacity-30 hover:opacity-100 transition-opacity`,onClick:W,children:u(l,{className:`w-[12px] h-[12px] text-[#F59E0B]`})})]})]})})}export{b as MarqueeClient};
@@ -1,8 +1,8 @@
1
1
 
2
2
  import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
3
3
  import { DefineMaterialOption } from "../../../../utils/schema/material.mjs";
4
- import "../../../../utils.mjs";
5
4
  import { MarqueeClient } from "./client.mjs";
5
+ import "../../../../utils.mjs";
6
6
  import { MarqueeServer } from "./server.mjs";
7
7
  import * as zod from "zod";
8
8
  import * as zod_v4_core0 from "zod/v4/core";
@@ -35,6 +35,6 @@ declare const marqueeMaterial: DefineMaterialOption<typeof MarqueeServer, typeof
35
35
  renderer: "renderer";
36
36
  editor: "editor";
37
37
  }>>;
38
- }, zod_v4_core0.$strip>, "marquee">;
38
+ }, zod_v4_core0.$strip>, "marquee", "内容组件">;
39
39
  //#endregion
40
40
  export { marqueeMaterial };
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
3
- import "../../../../utils.mjs";
3
+ import "../../../../utils/schema/index.mjs";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region components/biz/business/marquee/schema.d.ts
@@ -18,7 +18,7 @@ declare const profileHeaderMaterial: DefineMaterialOption<({
18
18
  renderer: "renderer";
19
19
  editor: "editor";
20
20
  }>>;
21
- }, zod_v4_core0.$strip>, "profile-header">;
21
+ }, zod_v4_core0.$strip>, "profile-header", "内容组件">;
22
22
  declare const profileHeaderMaterialWithDisabledBackground: DefineMaterialOption<({
23
23
  mode,
24
24
  ...props
@@ -30,6 +30,6 @@ declare const profileHeaderMaterialWithDisabledBackground: DefineMaterialOption<
30
30
  renderer: "renderer";
31
31
  editor: "editor";
32
32
  }>>;
33
- }, zod_v4_core0.$strip>, "profile-header-with-disabled-background">;
33
+ }, zod_v4_core0.$strip>, "profile-header-with-disabled-background", "内容组件">;
34
34
  //#endregion
35
35
  export { profileHeaderMaterial, profileHeaderMaterialWithDisabledBackground };
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{cn as e}from"../../../../../utils/cn.mjs";import{Button as t}from"../../../../ui/button.mjs";import{useUserStore as n}from"../../../../../store/modules/user-store.mjs";import{pUserEditUserInfo as r}from"../../../../../service/generated/client.mjs";import{uploadFile as i}from"../../../../../utils/upload-file.mjs";import{Avatar as a,AvatarFallback as o,AvatarImage as s}from"../../../../ui/avatar.mjs";import{Box as c}from"../../../../ui/box.mjs";import{Input as l}from"../../../../ui/input.mjs";import{Dialog as u,DialogContent as d}from"../../../../ui/dialog.mjs";import{Text as f}from"../../../../ui/text.mjs";import{useDeleteRequest as p}from"../../../../../hooks/query/use-query.mjs";import{ImageCropModal as m}from"../../../../common/image-crop-modal/image-crop-modal.mjs";import{useRef as h,useState as g}from"react";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";import{toast as b}from"sonner";const x=`https://guadd-sg-ccs-sing-dev.s3.ap-southeast-1.amazonaws.com/default/default_avatar.png`,S=[`image/jpeg`,`image/png`];function C(e){let t=e.name.toLowerCase(),n=e.type.toLowerCase();return S.includes(n)||/\.(?:jpg|jpeg|png)$/i.test(t)}function w({isMine:S,src:w,alt:T,onUnauthorizedClick:E}){let D=h(null),{userId:O,setUserInfo:k,userInfo:A}=n(),j=p(),[M,N]=g(!1),[P,F]=g(!1),[I,L]=g(``),[R,z]=g(!1);function B(){if(!R){if(S){N(!0);return}E?.()}}function V(){I&&(URL.revokeObjectURL(I),L(``))}function H(){N(!1)}function U(){R||D.current?.click()}function W(e){let t=e.target.files?.[0];if(t){if(!C(t)){b.error(`仅支持 JPG/JPEG/PNG 格式`),e.target&&(e.target.value=``);return}L(URL.createObjectURL(t)),F(!0),e.target&&(e.target.value=``)}}async function G(e){if(!O){b.error(`请先登录后再试`);return}try{z(!0);let t=await i(new File([e],`avatar.jpg`,{type:`image/jpeg`}),1);await r({user_id:String(O),avatar:t.objectKey}),k({...A,avatar:t.objectKey}),j([`user-profile`,`mine`]),j([`user-edit-info`,String(O)]),N(!1),F(!1),b.success(`更换完成`)}catch(e){console.error(`上传头像失败`,e),b.error(`头像上传失败,请稍后再试`)}finally{V(),z(!1)}}function K(){F(!1),V()}return y(_,{children:[S||E?v(t,{variant:`ghost`,size:`icon`,className:`!absolute bottom-3 left-0 h-22 w-22 rounded-full p-0 hover:bg-transparent`,onClick:B,"aria-label":`打开头像预览`,children:y(a,{className:`w-22 h-22`,children:[v(s,{src:w||x,alt:T||`avatar`}),v(o,{})]})}):y(a,{className:`!absolute bottom-3 left-0 w-22 h-22`,children:[v(s,{src:w||x,alt:T||`avatar`}),v(o,{})]}),v(u,{open:M,onOpenChange:H,children:v(d,{showCloseButton:!1,className:`bg-black !m-0 !p-0 !fixed !inset-0 !w-screen !h-screen !max-w-none !rounded-none !top-0 !left-0 !translate-x-0 !translate-y-0 !transform-none z-[9999] !pointer-events-auto`,children:y(c,{className:`relative flex h-full w-full flex-col items-center justify-center`,children:[v(t,{variant:`ghost`,size:`icon`,className:`absolute left-0 top-0 h-14 w-14 text-white hover:bg-transparent hover:text-white/80`,onClick:H,"aria-label":`关闭头像预览`,children:v(`svg`,{className:`w-4 h-4`,xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,viewBox:`0 0 16 16`,children:v(`path`,{d:`M14.55.2a.889.889 0 0 1 1.25 1.25l-.06.067L9.255 8l6.483 6.482.06.069a.888.888 0 0 1-1.25 1.25l-.067-.062L8 9.256l-6.482 6.483A.888.888 0 1 1 .26 14.482L6.742 8 .26 1.517.2 1.45A.888.888 0 0 1 1.45.2l.067.062 6.482 6.482L14.482.261l.068-.062Z`})})}),y(a,{className:`w-50 h-50`,children:[v(s,{src:w||x,alt:T||`avatar`}),v(o,{})]}),y(t,{variant:`ghost`,className:e(`absolute bottom-8 left-0 right-0 mx-auto flex w-[366px] max-w-[90%] items-center justify-between rounded-3xl bg-white/10 px-3 py-3 transition-colors hover:bg-white/20`,`active:scale-95`),onClick:U,disabled:R,children:[v(f,{as:`span`,className:`text-base font-medium text-white`,children:R?`上传中...`:`更换头像`}),y(`svg`,{className:`w-6 h-6 text-white`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:[v(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 9a2 2 0 012-2h.93a2 2 0 001.664-.89l.812-1.22A2 2 0 0110.07 4h3.86a2 2 0 011.664.89l.812 1.22A2 2 0 0018.07 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V9z`}),v(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 13a3 3 0 11-6 0 3 3 0 016 0z`})]})]})]})})}),v(l,{ref:D,type:`file`,accept:`.jpg,.jpeg,.png,image/jpeg,image/png`,className:`hidden`,onChange:W}),v(m,{open:P,onClose:K,imageSrc:I,onConfirm:G})]})}export{w as UserProfileAvatar};
2
+ "use client";import{cn as e}from"../../../../../utils/cn.mjs";import{Button as t}from"../../../../ui/button.mjs";import{useUserStore as n}from"../../../../../store/modules/user-store.mjs";import{pUserEditUserInfo as r}from"../../../../../service/generated/client.mjs";import{uploadFile as i}from"../../../../../utils/upload-file.mjs";import{Avatar as a,AvatarFallback as o,AvatarImage as s}from"../../../../ui/avatar.mjs";import{Box as c}from"../../../../ui/box.mjs";import{Input as l}from"../../../../ui/input.mjs";import{Dialog as u,DialogContent as d}from"../../../../ui/dialog.mjs";import{Text as f}from"../../../../ui/text.mjs";import{useDeleteRequest as p}from"../../../../../hooks/query/use-query.mjs";import{ImageCropModal as m}from"../../../../common/image-crop-modal/image-crop-modal.mjs";import{useRef as h,useState as g}from"react";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";import{toast as b}from"sonner";import{useTranslations as x}from"next-intl";const S=`https://guadd-sg-ccs-sing-dev.s3.ap-southeast-1.amazonaws.com/default/default_avatar.png`,C=[`image/jpeg`,`image/png`];function w(e){let t=e.name.toLowerCase(),n=e.type.toLowerCase();return C.includes(n)||/\.(?:jpg|jpeg|png)$/i.test(t)}function T({isMine:C,src:T,alt:E,onUnauthorizedClick:D}){let O=x(`components.pages.profile`),k=h(null),{userId:A,setUserInfo:j,userInfo:M}=n(),N=p(),[P,F]=g(!1),[I,L]=g(!1),[R,z]=g(``),[B,V]=g(!1);function H(){if(!B){if(C){F(!0);return}D?.()}}function U(){R&&(URL.revokeObjectURL(R),z(``))}function W(){F(!1)}function G(){B||k.current?.click()}function K(e){let t=e.target.files?.[0];if(t){if(!w(t)){b.error(O(`client.imageTypeInvalid`)),e.target&&(e.target.value=``);return}if(t.size>5242880){b.error(O(`client.imageTooLarge`)),e.target&&(e.target.value=``);return}z(URL.createObjectURL(t)),L(!0),e.target&&(e.target.value=``)}}async function q(e){if(!A){b.error(O(`client.loginRequiredForUpload`));return}try{V(!0);let t=await i(new File([e],`avatar.jpg`,{type:`image/jpeg`}),1);await r({user_id:String(A),avatar:t.objectKey}),j({...M,avatar:t.objectKey}),N([`user-profile`,`mine`]),N([`user-edit-info`,String(A)]),F(!1),L(!1),b.success(O(`client.mediaUpdateSuccess`))}catch(e){console.error(`上传头像失败`,e),b.error(O(`client.uploadFailed`))}finally{U(),V(!1)}}function J(){L(!1),U()}return y(_,{children:[C||D?v(t,{variant:`ghost`,size:`icon`,className:`!absolute bottom-3 left-0 h-22 w-22 rounded-full p-0 hover:bg-transparent`,onClick:H,"aria-label":`打开头像预览`,children:y(a,{className:`w-22 h-22`,children:[v(s,{src:T||S,alt:E||`avatar`}),v(o,{})]})}):y(a,{className:`!absolute bottom-3 left-0 w-22 h-22`,children:[v(s,{src:T||S,alt:E||`avatar`}),v(o,{})]}),v(u,{open:P,onOpenChange:W,children:v(d,{showCloseButton:!1,className:`bg-black !m-0 !p-0 !fixed !inset-0 !w-screen !h-screen !max-w-none !rounded-none !top-0 !left-0 !translate-x-0 !translate-y-0 !transform-none z-[9999] !pointer-events-auto`,children:y(c,{className:`relative flex h-full w-full flex-col items-center justify-center`,children:[v(t,{variant:`ghost`,size:`icon`,className:`absolute left-0 top-0 h-14 w-14 text-white hover:bg-transparent hover:text-white/80`,onClick:W,"aria-label":`关闭头像预览`,children:v(`svg`,{className:`w-4 h-4`,xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,viewBox:`0 0 16 16`,children:v(`path`,{d:`M14.55.2a.889.889 0 0 1 1.25 1.25l-.06.067L9.255 8l6.483 6.482.06.069a.888.888 0 0 1-1.25 1.25l-.067-.062L8 9.256l-6.482 6.483A.888.888 0 1 1 .26 14.482L6.742 8 .26 1.517.2 1.45A.888.888 0 0 1 1.45.2l.067.062 6.482 6.482L14.482.261l.068-.062Z`})})}),y(a,{className:`w-50 h-50`,children:[v(s,{src:T||S,alt:E||`avatar`}),v(o,{})]}),y(t,{variant:`ghost`,className:e(`absolute bottom-8 left-0 right-0 mx-auto flex w-[366px] max-w-[90%] items-center justify-between rounded-3xl bg-white/10 px-3 py-3 transition-colors hover:bg-white/20`,`active:scale-95`),onClick:G,disabled:B,children:[v(f,{as:`span`,className:`text-base font-medium text-white`,children:B?`上传中...`:`更换头像`}),y(`svg`,{className:`w-6 h-6 text-white`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:[v(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 9a2 2 0 012-2h.93a2 2 0 001.664-.89l.812-1.22A2 2 0 0110.07 4h3.86a2 2 0 011.664.89l.812 1.22A2 2 0 0018.07 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V9z`}),v(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 13a3 3 0 11-6 0 3 3 0 016 0z`})]})]})]})})}),v(l,{ref:k,type:`file`,accept:`.jpg,.jpeg,.png,image/jpeg,image/png`,className:`hidden`,onChange:K}),v(m,{open:I,onClose:J,imageSrc:R,onConfirm:q})]})}export{T as UserProfileAvatar};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{pUserUploadUserBgImage as t}from"../../../../../service/generated/client.mjs";import{uploadFile as n}from"../../../../../utils/upload-file.mjs";import{Image as r}from"../../../../ui/image.mjs";import{Box as i}from"../../../../ui/box.mjs";import{Input as a}from"../../../../ui/input.mjs";import{useDeleteRequest as o}from"../../../../../hooks/query/use-query.mjs";import{BackgroundPreviewModal as s}from"../../../../common/background-preview-modal/background-preview-modal.mjs";import{showImageCrop as c}from"../../../../common/image-crop/show-image-crop.mjs";import{useEffect as l,useRef as u,useState as d}from"react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{toast as h}from"sonner";const g=[`image/jpeg`,`image/png`];function _(e){let t=e.name.toLowerCase(),n=e.type.toLowerCase();return g.includes(n)||/\.(?:jpg|jpeg|png)$/i.test(t)}function v({isMine:g,enableCustomBackground:v=!0,src:y,onUnauthorizedClick:b}){let x=`/images/mine/img_mine_head_bg.png`,S=u(null),{userId:C,setUserInfo:w,userInfo:T}=e(),E=o(),[D,O]=d(!1),[k,A]=d(!1),j=v&&(!!g||typeof b==`function`);l(()=>{v||A(!1)},[v]);let M=()=>{if(v){if(g){D||A(!0);return}b?.()}},N=()=>{A(!1)};function P(){D||S.current?.click()}async function F(e){let r=e.target.files?.[0];if(e.target&&(e.target.value=``),r)try{if(!_(r)){h.error(`仅支持 JPG/JPEG/PNG 格式`);return}O(!0);let e=await n(await c(r,{aspectRatio:430/256,cropShape:`rect`,quality:.92,maxWidth:1920,maxHeight:1920}),1);await t({user_id:String(C),bg_image:e.objectKey}),w({...T,bg_image:e.objectKey}),E([`user-profile`,`mine`]),A(!1),h.success(`更换完成`)}catch(e){console.error(`上传背景图失败`,e),e instanceof Error&&e.message!==`用户取消`&&h.error(`背景图上传失败,请稍后再试`)}finally{O(!1)}}return m(f,{children:[p(i,{className:v?`h-33.75`:`h-24`,children:v?p(i,{className:`relative h-full w-full`,onClick:j?M:void 0,children:p(r,{alt:`cover background`,fill:!0,objectFit:`cover`,className:`pointer-events-none`,src:y||x})}):p(i,{className:`h-full w-full bg-bg1`})}),v&&m(f,{children:[p(s,{open:k,onClose:N,bgUrl:y||x,onUpload:P}),p(a,{ref:S,type:`file`,accept:`.jpg,.jpeg,.png,image/jpeg,image/png`,className:`hidden`,onChange:F})]})]})}export{v as UserProfileCoverBackground};
2
+ "use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{pUserUploadUserBgImage as t}from"../../../../../service/generated/client.mjs";import{uploadFile as n}from"../../../../../utils/upload-file.mjs";import{Image as r}from"../../../../ui/image.mjs";import{Box as i}from"../../../../ui/box.mjs";import{Input as a}from"../../../../ui/input.mjs";import{useDeleteRequest as o}from"../../../../../hooks/query/use-query.mjs";import{BackgroundPreviewModal as s}from"../../../../common/background-preview-modal/background-preview-modal.mjs";import{showImageCrop as c}from"../../../../common/image-crop/show-image-crop.mjs";import{useEffect as l,useRef as u,useState as d}from"react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{toast as h}from"sonner";import{useTranslations as g}from"next-intl";const _=[`image/jpeg`,`image/png`];function v(e){let t=e.name.toLowerCase(),n=e.type.toLowerCase();return _.includes(n)||/\.(?:jpg|jpeg|png)$/i.test(t)}function y({isMine:_,enableCustomBackground:y=!0,src:b,onUnauthorizedClick:x}){let S=g(`components.pages.profile`),C=`/images/mine/img_mine_head_bg.png`,w=u(null),{userId:T,setUserInfo:E,userInfo:D}=e(),O=o(),[k,A]=d(!1),[j,M]=d(!1),N=y&&(!!_||typeof x==`function`);l(()=>{y||M(!1)},[y]);let P=()=>{if(y){if(_){k||M(!0);return}x?.()}},F=()=>{M(!1)};function I(){k||w.current?.click()}async function L(e){let r=e.target.files?.[0];if(e.target&&(e.target.value=``),r)try{if(!v(r)){h.error(S(`client.imageTypeInvalid`));return}if(r.size>5242880){h.error(S(`client.imageTooLarge`));return}A(!0);let e=await n(await c(r,{aspectRatio:430/256,cropShape:`rect`,quality:.92,maxWidth:1920,maxHeight:1920}),1);await t({user_id:String(T),bg_image:e.objectKey}),E({...D,bg_image:e.objectKey}),O([`user-profile`,`mine`]),M(!1),h.success(S(`client.mediaUpdateSuccess`))}catch(e){console.error(`上传背景图失败`,e),e instanceof Error&&e.message!==`用户取消`&&h.error(S(`client.uploadFailed`))}finally{A(!1)}}return m(f,{children:[p(i,{className:y?`h-33.75`:`h-24`,children:y?p(i,{className:`relative h-full w-full`,onClick:N?P:void 0,children:p(r,{alt:`cover background`,fill:!0,objectFit:`cover`,className:`pointer-events-none`,src:b||C})}):p(i,{className:`h-full w-full bg-bg1`})}),y&&m(f,{children:[p(s,{open:j,onClose:F,bgUrl:b||C,onUpload:I}),p(a,{ref:w,type:`file`,accept:`.jpg,.jpeg,.png,image/jpeg,image/png`,className:`hidden`,onChange:L})]})]})}export{y as UserProfileCoverBackground};
@@ -11,6 +11,6 @@ declare const profileMainMaterial: DefineMaterialOption<typeof UserProfileMain,
11
11
  renderer: "renderer";
12
12
  editor: "editor";
13
13
  }>>;
14
- }, zod_v4_core0.$strip>, "profile-main">;
14
+ }, zod_v4_core0.$strip>, "profile-main", "内容组件">;
15
15
  //#endregion
16
16
  export { profileMainMaterial };
@@ -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{usePathname as f,useRouter as p,useSearchParams as m}from"next/navigation";const h=[`示例历史1`,`示例历史2`,`示例历史3`];function g(g){let{title:_,rows:v=1,clearText:y=`清理`,confirmDescription:b=`确认删除全部搜索历史吗?`,storageKey:x=`guest`,onHistoryClick:S,mode:C=`renderer`}=g,[w,T]=l([]),[E,D]=l(!1),O=p(),k=f(),A=m(),j=`search_history_${x}`,M=o(()=>{let e=localStorage.getItem(j);if(e)try{T(JSON.parse(e))}catch(e){console.error(`Failed to parse search history`,e)}else T([])},[j]);s(()=>{M()},[M]),s(()=>(t.on(i.SEARCH_HISTORY_UPDATE,M),()=>{t.off(i.SEARCH_HISTORY_UPDATE,M)}),[M]);let N=()=>{T([]),localStorage.removeItem(j),D(!1),t.emit(i.SEARCH_HISTORY_UPDATE)},P=c(()=>{let e=w.length>0?w:C===`editor`?h:[],t=v*10;return e.slice(0,t)},[w,C,v]);if(P.length===0)return null;let F=e=>{if(S)S(e);else{let t=new URLSearchParams(A.toString());t.set(`q`,e);let n=k.includes(`/search`)?k:`/search`;O.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:_}),u(e,{variant:`ghost`,size:`sm`,className:`text-text3 text-[12px] p-0 h-auto`,onClick:()=>D(!0),children:y})]}),u(n,{className:`flex flex-wrap gap-2 overflow-hidden`,style:{maxHeight:`${v*40}px`},children:P.map((e,t)=>u(n,{className:`px-3 py-1 bg-bg2 rounded-full cursor-pointer`,onClick:()=>F(e),children:u(r,{className:`text-[14px] text-text2 truncate max-w-[150px]`,children:e})},t))}),u(a,{open:E,onOpenChange:D,onConfirm:()=>{N()},title:``,description:b})]})}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{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`)?N:`/search`;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};
@@ -15,6 +15,6 @@ declare const searchHistoryMaterial: DefineMaterialOption<typeof SearchHistorySe
15
15
  renderer: "renderer";
16
16
  editor: "editor";
17
17
  }>>;
18
- }, zod_v4_core0.$strip>, "search-history">;
18
+ }, zod_v4_core0.$strip>, "search-history", "行为组件">;
19
19
  //#endregion
20
20
  export { searchHistoryMaterial };
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
3
- import "../../../../utils.mjs";
3
+ import "../../../../utils/schema/index.mjs";
4
4
  import * as zod from "zod";
5
5
  import * as zod_v4_core0 from "zod/v4/core";
6
6
 
@@ -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||`搜索历史`,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";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};
@@ -7,6 +7,8 @@ import * as react_jsx_runtime0 from "react/jsx-runtime";
7
7
  //#region components/biz/business/search-input/client.d.ts
8
8
  type SearchInputProps = InferSchemaProps<typeof searchInputInspectorPropsSchema>;
9
9
  interface ClientProps extends SearchInputProps {
10
+ /** 占位符,未配置时由服务端 defaultPlaceholder 兜底 */
11
+ placeholder?: string;
10
12
  defaultPlaceholder?: string;
11
13
  searchLabel?: string;
12
14
  storageKey?: string;
@@ -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{usePathname as p,useRouter as m,useSearchParams as h}from"next/navigation";function g(g){let{placeholder:_,defaultPlaceholder:v=`请输入搜索关键词`,searchLabel:y=`搜索`,storageKey:b=`guest`,onSearch:x,mode:S=`renderer`}=g,C=S===`editor`,[w,T]=u(``),E=m(),D=p(),O=h(),k=`search_history_${b}`,A=c(t=>{if(!C&&t.trim()){try{let n=localStorage.getItem(k),r=n?JSON.parse(n):[];r=[t,...r.filter(e=>e!==t)],localStorage.setItem(k,JSON.stringify(r.slice(0,20))),e.emit(i.SEARCH_HISTORY_UPDATE)}catch(e){console.error(`Failed to save search history`,e)}if(x)x(t);else{let e=new URLSearchParams(O.toString());e.set(`q`,t);let n=D.includes(`/search`)?D:`/search`;E.push(`${n}?${e.toString()}`)}}},[k,C,x,D,E,O]);l(()=>{let e=O.get(`q`);e&&e!==w&&(T(e),A(e))},[O,A,w]),l(()=>{if(!C&&w===``){if(O.has(`q`)){let e=new URLSearchParams(O.toString());e.delete(`q`);let t=D.includes(`/search`)?D:`/search`;E.push(`${t}${e.toString()?`?${e.toString()}`:``}`)}e.emit(i.SEARCH_HISTORY_UPDATE)}},[C,w,D,E,O]);let j=()=>{A(w)};return f(t,{className:C?`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:()=>{C||E.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:_||v,value:w,onChange:e=>T(e.target.value),onKeyDown:e=>e.key===`Enter`&&j()}),w&&d(s,{className:`w-[15px] h-[15px] text-text3 shrink-0 cursor-pointer active:opacity-70`,onClick:()=>{T(``)}})]}),d(t,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:j,children:d(r,{className:`text-[16px] text-text1 leading-[24px] font-normal`,children:y})})]})}export{g as SearchInputClient};
2
+ "use client";import e from"../../../../utils/event-bus.mjs";import{Box as t}from"../../../ui/box.mjs";import{Input as n}from"../../../ui/input.mjs";import{Text as r}from"../../../ui/text.mjs";import{eventKey as i}from"../../../../constants/event-key.mjs";import a from"../../../../assets/icons/left_arrow.mjs";import o from"../../../../assets/icons/search.mjs";import s from"../../../../assets/icons/clear.mjs";import{useCallback as c,useEffect as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{useTranslations as p}from"next-intl";import{usePathname as m,useRouter as h,useSearchParams as g}from"next/navigation";function _(_){let v=p(`components.pages.search`),{placeholder:y,defaultPlaceholder:b,searchLabel:x,storageKey:S=`guest`,onSearch:C,mode:w=`renderer`}=_,T=y||(b??v(`topHeader.placeholder`)),E=x??v(`topHeader.search`),D=w===`editor`,[O,k]=u(``),A=h(),j=m(),M=g(),N=`search_history_${S}`,P=c(t=>{if(!D&&t.trim()){try{let n=localStorage.getItem(N),r=n?JSON.parse(n):[];r=[t,...r.filter(e=>e!==t)],localStorage.setItem(N,JSON.stringify(r.slice(0,20))),e.emit(i.SEARCH_HISTORY_UPDATE)}catch(e){console.error(`Failed to save search history`,e)}if(C)C(t);else{let e=new URLSearchParams(M.toString());e.set(`q`,t);let n=j.includes(`/search`)?j:`/search`;A.push(`${n}?${e.toString()}`)}}},[N,D,C,j,A,M]);l(()=>{let e=M.get(`q`);e&&e!==O&&(k(e),P(e))},[M,P,O]),l(()=>{if(!D&&O===``){if(M.has(`q`)){let e=new URLSearchParams(M.toString());e.delete(`q`);let t=j.includes(`/search`)?j:`/search`;A.push(`${t}${e.toString()?`?${e.toString()}`:``}`)}e.emit(i.SEARCH_HISTORY_UPDATE)}},[D,O,j,A,M]);let F=()=>{P(O)};return f(t,{className:D?`px-3 py-2 bg-bg1 flex items-center gap-3 w-full pointer-events-none`:`px-3 py-2 bg-bg1 flex items-center gap-3 w-full`,children:[d(t,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:()=>{D||A.back()},children:d(a,{className:`w-4 h-4 text-text1`})}),f(t,{className:`flex-1 flex items-center gap-1 bg-bg2 border border-theme5 rounded-[20px] px-2 py-1.5 overflow-hidden`,children:[d(t,{className:`p-1 shrink-0`,children:d(o,{className:`w-[14px] h-[14px] text-text3`})}),d(n,{className:`flex-1 border-none bg-transparent p-0 h-auto text-[14px] leading-[22px] focus-visible:ring-0 text-text1 placeholder:text-text3`,placeholder:T,value:O,onChange:e=>k(e.target.value),onKeyDown:e=>e.key===`Enter`&&F()}),O&&d(s,{className:`w-[15px] h-[15px] text-text3 shrink-0 cursor-pointer active:opacity-70`,onClick:()=>{k(``)}})]}),d(t,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:F,children:d(r,{className:`text-[16px] text-text1 leading-[24px] font-normal`,children:E})})]})}export{_ as SearchInputClient};
@@ -1,7 +1,5 @@
1
1
 
2
- import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
3
2
  import { DefineMaterialOption } from "../../../../utils/schema/material.mjs";
4
- import "../../../../utils.mjs";
5
3
  import { SearchInputClient } from "./client.mjs";
6
4
  import { SearchInputServer } from "./server.mjs";
7
5
  import * as zod from "zod";
@@ -9,11 +7,10 @@ import * as zod_v4_core0 from "zod/v4/core";
9
7
 
10
8
  //#region components/biz/business/search-input/material.d.ts
11
9
  declare const searchInputMaterial: DefineMaterialOption<typeof SearchInputServer, typeof SearchInputClient, zod.ZodObject<{
12
- placeholder: zod.ZodString & SchemaHasDefaultValue;
13
10
  mode: zod.ZodOptional<zod.ZodEnum<{
14
11
  renderer: "renderer";
15
12
  editor: "editor";
16
13
  }>>;
17
- }, zod_v4_core0.$strip>, "search-input">;
14
+ }, zod_v4_core0.$strip>, "search-input", "行为组件">;
18
15
  //#endregion
19
16
  export { searchInputMaterial };
@@ -1,15 +1,13 @@
1
1
 
2
- import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
3
- import "../../../../utils.mjs";
4
2
  import * as zod from "zod";
5
3
  import * as zod_v4_core0 from "zod/v4/core";
6
4
 
7
5
  //#region components/biz/business/search-input/schema.d.ts
8
6
  /**
9
7
  * 搜索输入框物料属性定义
8
+ * 无需配置,低代码平台不展示配置面板;占位符等由服务端 i18n 注入。
10
9
  */
11
10
  declare const searchInputInspectorPropsSchema: zod.ZodObject<{
12
- placeholder: zod.ZodString & SchemaHasDefaultValue;
13
11
  mode: zod.ZodOptional<zod.ZodEnum<{
14
12
  renderer: "renderer";
15
13
  editor: "editor";
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineComponentPropsSchema as e,defineTextPropSchema as t}from"../../../../utils/schema/schema.mjs";const n=e({placeholder:t({label:`占位文本`,defaultValue:`搜索关键词`})});export{n as searchInputInspectorPropsSchema};
2
+ import{defineComponentPropsSchema as e}from"../../../../utils/schema/schema.mjs";const t=e({});export{t as searchInputInspectorPropsSchema};
@@ -21,6 +21,6 @@ declare const shortcutGridMaterial: DefineMaterialOption<typeof ShortcutGrid, ty
21
21
  renderer: "renderer";
22
22
  editor: "editor";
23
23
  }>>;
24
- }, zod_v4_core0.$strip>, "shortcut-grid">;
24
+ }, zod_v4_core0.$strip>, "shortcut-grid", "金刚组件">;
25
25
  //#endregion
26
26
  export { shortcutGridMaterial };
@@ -18,7 +18,7 @@ declare const tabBarMaterial: DefineMaterialOption<typeof TabBarServer, typeof T
18
18
  icon: zod.ZodString & SchemaHasDefaultValue;
19
19
  activeIcon: zod.ZodString & SchemaHasDefaultValue;
20
20
  configType: zod.ZodType<"function" | "product", unknown, zod_v4_core0.$ZodTypeInternals<"function" | "product", unknown>> & SchemaHasDefaultValue;
21
- functionPageType: zod.ZodType<"search" | "detail" | "profile" | "content_list", unknown, zod_v4_core0.$ZodTypeInternals<"search" | "detail" | "profile" | "content_list", unknown>> & SchemaHasDefaultValue;
21
+ functionPageType: zod.ZodType<"search" | "content_list" | "detail" | "profile", unknown, zod_v4_core0.$ZodTypeInternals<"search" | "content_list" | "detail" | "profile", unknown>> & SchemaHasDefaultValue;
22
22
  selectData: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
23
23
  mode: zod.ZodOptional<zod.ZodEnum<{
24
24
  renderer: "renderer";
@@ -29,6 +29,6 @@ declare const tabBarMaterial: DefineMaterialOption<typeof TabBarServer, typeof T
29
29
  renderer: "renderer";
30
30
  editor: "editor";
31
31
  }>>;
32
- }, zod_v4_core0.$strip>, "tab-bar">;
32
+ }, zod_v4_core0.$strip>, "tab-bar", "行为组件">;
33
33
  //#endregion
34
34
  export { tabBarMaterial };
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
3
- import "../../../../utils.mjs";
3
+ import "../../../../utils/schema/index.mjs";
4
4
  import * as zod from "zod";
5
5
  import * as zod_v4_core0 from "zod/v4/core";
6
6
 
@@ -15,7 +15,7 @@ declare const tabBarInspectorPropsSchema: zod.ZodObject<{
15
15
  icon: zod.ZodString & SchemaHasDefaultValue;
16
16
  activeIcon: zod.ZodString & SchemaHasDefaultValue;
17
17
  configType: zod.ZodType<"function" | "product", unknown, zod_v4_core0.$ZodTypeInternals<"function" | "product", unknown>> & SchemaHasDefaultValue;
18
- functionPageType: zod.ZodType<"search" | "detail" | "profile" | "content_list", unknown, zod_v4_core0.$ZodTypeInternals<"search" | "detail" | "profile" | "content_list", unknown>> & SchemaHasDefaultValue;
18
+ functionPageType: zod.ZodType<"search" | "content_list" | "detail" | "profile", unknown, zod_v4_core0.$ZodTypeInternals<"search" | "content_list" | "detail" | "profile", unknown>> & SchemaHasDefaultValue;
19
19
  selectData: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
20
20
  mode: zod.ZodOptional<zod.ZodEnum<{
21
21
  renderer: "renderer";
@@ -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{usePathname as s,useRouter as c,useSearchParams as l}from"next/navigation";const u=[];function d(d){let{title:f,displayCount:p=6,items:m=u,onItemClick:h,mode:g=`renderer`}=d,_=g===`editor`,v=c(),y=s(),b=l(),[x,S]=i(0),C=Math.ceil(m.length/p),w=r(()=>{if(m.length<=p)return m;let e=x%C*p;return m.slice(e,e+p)},[m,p,x,C]);if(m.length===0)return null;let T=e=>{e.stopPropagation(),S(e=>e+1)},E=e=>{if(h)h(e);else{let t=new URLSearchParams(b.toString());t.set(`q`,e);let n=y.includes(`/search`)?y:`/search`;v.push(`${n}?${t.toString()}`)}};return o(e,{className:_?`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:f||`推荐搜索`}),m.length>p&&o(e,{className:`flex items-center gap-1 cursor-pointer active:opacity-70 transition-opacity`,onClick:T,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:w.map((n,r)=>a(e,{className:`flex items-center h-[32px] cursor-pointer active:opacity-70 transition-opacity overflow-hidden`,onClick:()=>E(n.label),children:a(t,{className:`text-[14px] text-text1 leading-[22px] truncate w-full`,children:n.label})},`${x}-${r}`))})]})}export{d as TextRecommendClient};
2
+ "use client";import{Box as e}from"../../../ui/box.mjs";import{Text as t}from"../../../ui/text.mjs";import n from"../../../../assets/icons/refresh.mjs";import{useMemo as r,useState as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{useTranslations as s}from"next-intl";import{usePathname as c,useRouter as l,useSearchParams as u}from"next/navigation";const d=[];function f(f){let p=s(`components.biz.business.textRecommend`),{title:m,displayCount:h=6,items:g=d,onItemClick:_,mode:v=`renderer`}=f,y=v===`editor`,b=l(),x=c(),S=u(),[C,w]=i(0),T=Math.ceil(g.length/h),E=r(()=>{if(g.length<=h)return g;let e=C%T*h;return g.slice(e,e+h)},[g,h,C,T]);if(g.length===0)return null;let D=e=>{e.stopPropagation(),w(e=>e+1)},O=e=>{if(_)_(e);else{let t=new URLSearchParams(S.toString());t.set(`q`,e);let n=x.includes(`/search`)?x:`/search`;b.push(`${n}?${t.toString()}`)}};return o(e,{className:y?`bg-bg1 p-3 flex flex-col gap-3 w-full pointer-events-none`:`bg-bg1 p-3 flex flex-col gap-3 w-full`,children:[o(e,{className:`flex items-center justify-between w-full`,children:[a(t,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:m||p(`defaultTitle`)}),o(e,{className:`flex items-center gap-1 cursor-pointer active:opacity-70 transition-opacity`,onClick:D,children:[a(t,{className:`text-[14px] text-text3 leading-[22px]`,children:p(`refreshBatch`)}),a(n,{className:`w-3 h-3 text-text3`})]})]}),a(e,{className:`grid grid-cols-2 gap-x-1 gap-y-1 w-full`,children:E.map((n,r)=>a(e,{className:`flex items-center h-[32px] cursor-pointer active:opacity-70 transition-opacity overflow-hidden`,onClick:()=>O(n.label),children:a(t,{className:`text-[14px] text-text1 leading-[22px] truncate w-full`,children:n.label})},`${C}-${r}`))})]})}export{f as TextRecommendClient};
@@ -18,6 +18,6 @@ declare const textRecommendMaterial: DefineMaterialOption<typeof TextRecommendSe
18
18
  renderer: "renderer";
19
19
  editor: "editor";
20
20
  }>>;
21
- }, zod_v4_core0.$strip>, "text-recommend">;
21
+ }, zod_v4_core0.$strip>, "text-recommend", "内容组件">;
22
22
  //#endregion
23
23
  export { textRecommendMaterial };
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
3
- import "../../../../utils.mjs";
3
+ import "../../../../utils/schema/index.mjs";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region components/biz/business/text-recommend/schema.d.ts
@@ -12,7 +12,8 @@ interface ClientProps extends VideoHorizontalListProps {
12
12
  }
13
13
  /**
14
14
  * 视频横向列表物料组件 - 客户端部分
15
- * 展示由配置面板传入的静态数据
15
+ * - 智能铺设开启:按标签调用热门列表接口,随机铺设推荐位,T+1 自动更新
16
+ * - 智能铺设关闭:按配置的内容 ID 取数;超过 8 个时分批拉取(每批 8 个),滚动到倒数第二个时触发下一批
16
17
  */
17
18
  declare function VideoHorizontalListClient(props: ClientProps): react_jsx_runtime0.JSX.Element | null;
18
19
  //#endregion
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import e from"../../../../assets/images/frame.mjs";import t from"../../../../assets/images/subscript.mjs";import{jsx as n,jsxs as r}from"react/jsx-runtime";import i from"next/image";const a=[];function o(o){let{title:s,items:c=a,commonPlayCount:l,commonEpisodes:u,mode:d=`renderer`}=o,f=d===`editor`;return!c||c.length===0?null:r(`div`,{className:f?`bg-bg1 px-3 py-3 pointer-events-none`:`bg-bg1 px-3 py-3`,children:[s&&n(`div`,{className:`mb-3 flex items-center justify-between`,children:n(`h2`,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:s})}),n(`div`,{className:`flex overflow-x-auto pb-2 scrollbar-hide space-x-2`,children:c.map((a,o)=>{let s=a.showPlayCount??l?.enabled,c=a.playCountDelta||l?.delta,f=a.showEpisodes??u;return r(`div`,{className:`flex-shrink-0 w-[116.67px]`,children:[r(`div`,{className:`relative aspect-[116.67/155.56] rounded-lg overflow-hidden bg-bg2`,children:[d===`editor`||a.cover?n(i,{src:a.cover||e,alt:a.title,fill:!0,sizes:`116.67px`,className:`object-cover text-[10px] text-text3`}):n(`div`,{className:`w-full h-full flex items-center justify-center text-text3 text-xs`,children:`无封面`}),(d===`editor`?!0:!!a.badge)&&n(`div`,{className:`absolute top-0 right-0 w-8 h-8`,children:n(i,{src:a.badge||t,alt:``,fill:!0,sizes:`32px`,className:`object-contain`})}),r(`div`,{className:`absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent pb-1 pt-3 px-1 flex justify-between items-center`,children:[s&&c&&r(`div`,{className:`flex items-center gap-1 rounded bg-overlay px-1 py-0`,children:[n(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`10`,viewBox:`0 0 12 10`,fill:`none`,className:`shrink-0`,"aria-hidden":!0,children:n(`path`,{d:`M7.56 5.18437L5.013 6.56737C4.893 6.63337 4.761 6.66937 4.638 6.66937C4.269 6.66937 4.002 6.38737 4.002 5.99737V3.28237C4.002 2.89237 4.269 2.61037 4.638 2.61037C4.764 2.61037 4.893 2.64637 5.013 2.70937L7.572 4.09237C7.803 4.21837 7.938 4.41637 7.938 4.63237C7.938 4.85137 7.8 5.05537 7.56 5.18437ZM9.807 9.27637L2.133 8.52937C0.954 8.52937 0 7.57537 0 6.39637V2.79937C0 1.62037 0.954 0.666368 2.133 0.666368L9.81 0.000367165C10.989 0.000367165 11.943 0.954367 11.943 2.13337V7.14337C11.9422 7.70935 11.7168 8.25188 11.3163 8.65181C10.9158 9.05174 10.373 9.27637 9.807 9.27637ZM10.875 2.13337C10.875 1.99351 10.8475 1.85502 10.7939 1.72581C10.7404 1.5966 10.662 1.47919 10.5631 1.3803C10.4642 1.2814 10.3468 1.20296 10.2176 1.14944C10.0883 1.09591 9.94986 1.06837 9.81 1.06837L2.133 1.73437C1.99314 1.73437 1.85465 1.76191 1.72544 1.81544C1.59623 1.86896 1.47883 1.9474 1.37993 2.0463C1.28104 2.14519 1.20259 2.2626 1.14907 2.39181C1.09555 2.52102 1.068 2.65951 1.068 2.79937V6.39637C1.068 6.67882 1.1802 6.94971 1.37993 7.14944C1.57966 7.34916 1.85054 7.46137 2.133 7.46137L9.807 8.20837C9.94686 8.20837 10.0853 8.18082 10.2146 8.1273C10.3438 8.07378 10.4612 7.99533 10.5601 7.89644C10.659 7.79754 10.7374 7.68014 10.7909 7.55093C10.8445 7.42171 10.872 7.28323 10.872 7.14337V2.13337H10.875Z`,fill:`white`})}),n(`span`,{className:`text-white text-[12px] leading-[20px]`,children:c})]}),f&&a.contentDescription&&n(`span`,{className:`text-white text-[12px] leading-[20px]`,children:a.contentDescription})]})]}),n(`div`,{className:`mt-2 py-2`,children:n(`h3`,{className:`text-[16px] text-text1 truncate font-bold leading-[24px]`,children:a.title})})]},o)})})]})}export{o as VideoHorizontalListClient};
2
+ "use client";import e from"../../../../utils/get-res-url.mjs";import{batchGetVideoDetail as t}from"../../../../service/batch-get-video-detail.mjs";import{getPopularVideoListPost as n}from"../../../../service/get-popular-video-list-post.mjs";import r from"../../../../assets/images/frame.mjs";import i from"../../../../assets/images/subscript.mjs";import{useCallback as a,useEffect as o,useMemo as s,useRef as c,useState as l}from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import p from"next/image";import{useTranslations as m}from"next-intl";import h from"next/link";const g=[];function _(t,n){if(!t||!t.trim())return n;if(t.startsWith(`http`)||t.startsWith(`//`)||t.startsWith(`data:`))return t;let r=e();return r?`${r}${t.startsWith(`/`)?t:`/${t}`}`:t}function v(e){if(e==null)return``;let t=e;return t.img_y||t.media?.img_y||``}function y(e){if(e==null)return``;let t=e;return t.id||t.video_id||t.mid||``}function b(e){return e==null?``:e.name||``}function x(e){let t=e,n=t.type;return typeof n==`number`?n:t.is_more_link===!0||Number(t.episode_cnt||t.episode_count||t.episodes?.length||t.links?.length||0)>1?2:1}function 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 C(e,t){let n=e,r=Number(n.episode_cnt??0);if(!Number.isFinite(r)||r<=0)return``;let i=n.update_status;return t(r,i===0||i===`0`)}function w(e,t,n){return e?x(e)===2&&n?C(e,n):S(Number(e.duration??e.detail?.duration??0)):``}function T(e,t){if(!(e??``).trim())return``;let n=encodeURIComponent((t??``).trim()||``);return`/video/${e.trim()}/${n}/episode/1`}function E(e){return!e||!Array.isArray(e.tags)?[]:e.tags.map(e=>String(e).trim()).filter(Boolean)}function D(e){for(let t=e.length-1;t>0;t--){let n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e}function O(e,t){let n=[...e];return D(n),n.slice(0,Math.max(0,t))}function k(e,t){if(t<=0||!e.length)return[];if(e.length>=t)return O(e,t);let n=[];for(let t of e)n.push(t);for(;n.length<t;){let t=e[Math.floor(Math.random()*e.length)];n.push(t)}return D(n),n}function A(e,t){return(e.tags??[]).some(e=>(e.name??``).trim()===t)}function j(e,t,n){let r=new Set,i=[];for(let a=0;a<n;a++){let n=t[a]??``,o=n?e.filter(e=>!r.has(y(e))&&A(e,n)):[],s=o.length?o:e.filter(e=>!r.has(y(e))),c=s.length?s[Math.floor(Math.random()*s.length)]:void 0;c&&(r.add(y(c)),i.push(c))}return i}function M(e){if(!e)return``;let t=e,n=Number(t.static?.browse_cnt??0);if(!Number.isFinite(n)||n<=0)return``;if(n>=1e6){let e=(n/1e6).toFixed(1);return e.endsWith(`.0`)?`${e.slice(0,-2)}M`:`${e}M`}if(n>=1e3){let e=(n/1e3).toFixed(1);return e.endsWith(`.0`)?`${e.slice(0,-2)}k`:`${e}k`}return Math.floor(n).toString()}function N(){let e=new Date,t=new Date(e);return t.setHours(24,0,0,0),t.getTime()-e.getTime()}function P(e){let{title:x,items:S=g,commonPlayCount:C,commonEpisodes:D,layout:O,allEpisodesText:A,mode:P=`renderer`}=e,F=m(`components.biz.business.videoHorizontalList`),I=P===`editor`,[L,R]=l({}),[z,B]=l([]),[V,H]=l(0),U=c(null),W=!!O?.enabled,G=s(()=>E(O),[O]),K=S?.length??0,q=s(()=>W||!S?.length?[]:S.map(e=>String(e?.contentId??``).trim()).filter(Boolean),[W,S]),J=s(()=>q.length>0?Math.ceil(q.length/8):0,[q.length]),Y=a((e,t)=>F(t?`updatedTo`:`allEpisodes`,{count:e}),[F]),X=a(async(e,n)=>{if(e.length===0)return;let r=(await t({ids:e})).data?.videos??[],i={};for(let e of r){let t=y(e);t&&(i[t]=e)}R(e=>n?{...e,...i}:i)},[]);o(()=>{if(I||!S||S.length===0)return;let e=!1;async function t(){if(q.length===0){e||(R({}),H(0));return}if(q.length<=8){await X(q,!1),e||H(1);return}await X(q.slice(0,8),!1),e||H(1)}async function r(){let t=k(G,K),r=(await n({page_size:Math.max(20,K*10),tags:t.length?Array.from(new Set(t)):void 0})).data?.videos??[];e||B(j(r,t,K))}return(async()=>{try{W?await r():await t()}catch{e||(R({}),B([]),H(0))}})(),()=>{e=!0}},[I,W,S,G,K,q,X]),o(()=>{if(I||W||q.length<=8||V<1||V>=J)return;let e=U.current;if(!e)return;let t=new IntersectionObserver(e=>{let[t]=e;if(!t?.isIntersecting)return;let n=V,r=n*8,i=q.slice(r,r+8);i.length!==0&&(X(i,!0),H(n+1))},{root:null,rootMargin:`0px`,threshold:0});return t.observe(e),()=>t.disconnect()},[I,W,q,V,J,X]),o(()=>{if(I||!W||K<=0)return;let e,t=!1;function r(){e=window.setTimeout(()=>{let e=k(G,K);n({page_size:Math.max(20,K*10),tags:e.length?Array.from(new Set(e)):void 0}).then(n=>{t||B(j(n.data?.videos??[],e,K))}).catch(()=>{t||B([])}).finally(()=>{t||r()})},N())}return r(),()=>{t=!0,e!==void 0&&window.clearTimeout(e)}},[I,W,G,K]);let Z=s(()=>!S||S.length===0?g:S.map((e,t)=>{let n=String(e?.contentId??``).trim(),r=W?z[t]:n?L[n]:void 0,i=(e?.title??``).trim()||(r?b(r):``),a=(e?.cover??``).trim()||(e?.useVideoPoster?v(r):``),o=(e?.contentDescription??``).trim()||w(r,A,Y),s=(e?.playCountDelta??``).trim()||M(r);return{...e,contentId:n||(r?y(r):``),title:i,cover:a,contentDescription:o,playCountDelta:s}}),[A,Y,W,S,L,z]);if(!S||S.length===0)return null;let Q=!W&&q.length>8&&V>=1&&V<J?V*8-2:-1;return f(`div`,{className:I?`bg-bg1 px-3 py-3 pointer-events-none`:`bg-bg1 px-3 py-3`,children:[x&&d(`div`,{className:`mb-3 flex items-center justify-between`,children:d(`h2`,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:x})}),d(`div`,{className:`flex overflow-x-auto pb-2 scrollbar-hide space-x-2`,children:Z.map((e,t)=>{let n=W?C:e.showPlayCount??!1,a=e.playCountDelta,o=(W?D:e.showEpisodes??!1)&&(e.contentDescription??``).trim(),s=P===`renderer`?T(e.contentId??``,e.title??``):``,c=f(u,{children:[f(`div`,{className:`relative aspect-[116.67/155.56] rounded-lg overflow-hidden bg-bg2`,children:[I||e.cover?d(p,{src:_(e.cover,r),alt:e.title,fill:!0,sizes:`116.67px`,className:`object-cover text-[10px] text-text3`}):d(`div`,{className:`w-full h-full flex items-center justify-center text-text3 text-xs`,children:F(`noCover`)}),!W&&(e.badge??``).trim()?d(`div`,{className:`absolute top-0 right-0 w-8 h-8`,children:d(p,{src:(e.badge??``).trim()||i,alt:``,fill:!0,sizes:`32px`,className:`object-contain object-right-top`})}):null,f(`div`,{className:`absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent pb-1 pt-3 px-1 flex justify-between items-center gap-1`,children:[d(`div`,{className:`flex items-center min-w-0 shrink`,children:n&&a?f(`div`,{className:`flex items-center gap-1 rounded bg-overlay px-1 py-0`,children:[d(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`10`,viewBox:`0 0 12 10`,fill:`none`,className:`shrink-0`,"aria-hidden":!0,children:d(`path`,{d:`M7.56 5.18437L5.013 6.56737C4.893 6.63337 4.761 6.66937 4.638 6.66937C4.269 6.66937 4.002 6.38737 4.002 5.99737V3.28237C4.002 2.89237 4.269 2.61037 4.638 2.61037C4.764 2.61037 4.893 2.64637 5.013 2.70937L7.572 4.09237C7.803 4.21837 7.938 4.41637 7.938 4.63237C7.938 4.85137 7.8 5.05537 7.56 5.18437ZM9.807 9.27637L2.133 8.52937C0.954 8.52937 0 7.57537 0 6.39637V2.79937C0 1.62037 0.954 0.666368 2.133 0.666368L9.81 0.000367165C10.989 0.000367165 11.943 0.954367 11.943 2.13337V7.14337C11.9422 7.70935 11.7168 8.25188 11.3163 8.65181C10.9158 9.05174 10.373 9.27637 9.807 9.27637ZM10.875 2.13337C10.875 1.99351 10.8475 1.85502 10.7939 1.72581C10.7404 1.5966 10.662 1.47919 10.5631 1.3803C10.4642 1.2814 10.3468 1.20296 10.2176 1.14944C10.0883 1.09591 9.94986 1.06837 9.81 1.06837L2.133 1.73437C1.99314 1.73437 1.85465 1.76191 1.72544 1.81544C1.59623 1.86896 1.47883 1.9474 1.37993 2.0463C1.28104 2.14519 1.20259 2.2626 1.14907 2.39181C1.09555 2.52102 1.068 2.65951 1.068 2.79937V6.39637C1.068 6.67882 1.1802 6.94971 1.37993 7.14944C1.57966 7.34916 1.85054 7.46137 2.133 7.46137L9.807 8.20837C9.94686 8.20837 10.0853 8.18082 10.2146 8.1273C10.3438 8.07378 10.4612 7.99533 10.5601 7.89644C10.659 7.79754 10.7374 7.68014 10.7909 7.55093C10.8445 7.42171 10.872 7.28323 10.872 7.14337V2.13337H10.875Z`,fill:`white`})}),d(`span`,{className:`text-white text-[12px] leading-[20px]`,children:a})]}):null}),d(`div`,{className:`flex items-center shrink-0`,children:o?d(`span`,{className:`text-white text-[12px] leading-[20px]`,children:e.contentDescription}):null})]})]}),d(`div`,{className:`mt-2 py-2`,children:d(`h3`,{className:`text-[16px] text-text1 truncate font-bold leading-[24px]`,children:e.title})})]});return d(`div`,{ref:t===Q?U:void 0,className:`flex-shrink-0 w-[116.67px]`,children:s?d(h,{href:s,className:`block rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-primary`,children:c}):c},t)})})]})}export{P as VideoHorizontalListClient};
@@ -16,15 +16,15 @@ declare const videoHorizontalListMaterial: DefineMaterialOption<typeof VideoHori
16
16
  moduleCount: zod.ZodNumber & SchemaHasDefaultValue;
17
17
  layout: zod.ZodObject<{
18
18
  readonly enabled: zod.ZodBoolean & SchemaHasDefaultValue;
19
- readonly tag: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
20
- }, zod_v4_core0.$strip> & SchemaHasDefaultValue;
21
- commonPlayCount: zod.ZodObject<{
19
+ readonly tags: zod.ZodArray<zod.ZodString> & SchemaHasDefaultValue;
20
+ }, zod_v4_core0.$strip> | zod.ZodOptional<zod.ZodObject<{
22
21
  readonly enabled: zod.ZodBoolean & SchemaHasDefaultValue;
23
- readonly delta: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
24
- }, zod_v4_core0.$strip> & SchemaHasDefaultValue;
22
+ readonly tags: zod.ZodArray<zod.ZodString> & SchemaHasDefaultValue;
23
+ }, zod_v4_core0.$strip>>;
24
+ commonPlayCount: zod.ZodBoolean & SchemaHasDefaultValue;
25
25
  commonEpisodes: zod.ZodBoolean & SchemaHasDefaultValue;
26
26
  items: zod.ZodArray<zod.ZodObject<{
27
- content: zod.ZodString & SchemaHasDefaultValue;
27
+ contentId: zod.ZodString & SchemaHasDefaultValue;
28
28
  title: zod.ZodString & SchemaHasDefaultValue;
29
29
  contentDescription: zod.ZodString & SchemaHasDefaultValue;
30
30
  cover: zod.ZodString & SchemaHasDefaultValue;
@@ -38,6 +38,6 @@ declare const videoHorizontalListMaterial: DefineMaterialOption<typeof VideoHori
38
38
  renderer: "renderer";
39
39
  editor: "editor";
40
40
  }>>;
41
- }, zod_v4_core0.$strip>, "video-horizontal-list">;
41
+ }, zod_v4_core0.$strip>, "video-horizontal-list", "内容组件">;
42
42
  //#endregion
43
43
  export { videoHorizontalListMaterial };
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineMaterial as e}from"../../../../utils/schema/material.mjs";import{VideoHorizontalListClient as t}from"./client.mjs";import{videoHorizontalListInspectorPropsSchema as n}from"./schema.mjs";import{VideoHorizontalListServer as r}from"./server.mjs";const i=e({type:`video-horizontal-list`,name:`视频横向列表`,icon:`/static/components-thumb/search_recommend_media.png`,category:`内容组件`,serverComponent:r,clientComponent:t,propsSchema:n});export{i as videoHorizontalListMaterial};
2
+ import{defineMaterial as e}from"../../../../utils/schema/material.mjs";import{VideoHorizontalListClient as t}from"./client.mjs";import{videoHorizontalListInspectorPropsSchema as n}from"./schema.mjs";import{VideoHorizontalListServer as r}from"./server.mjs";const i=e({type:`video-horizontal-list`,name:`图文推荐`,icon:`/static/components-thumb/search_recommend_media.png`,category:`内容组件`,serverComponent:r,clientComponent:t,propsSchema:n});export{i as videoHorizontalListMaterial};
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
3
- import "../../../../utils.mjs";
3
+ import "../../../../utils/schema/index.mjs";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region components/biz/business/video-horizontal-list/schema.d.ts
@@ -12,15 +12,15 @@ declare const videoHorizontalListInspectorPropsSchema: z.ZodObject<{
12
12
  moduleCount: z.ZodNumber & SchemaHasDefaultValue;
13
13
  layout: z.ZodObject<{
14
14
  readonly enabled: z.ZodBoolean & SchemaHasDefaultValue;
15
- readonly tag: z.ZodOptional<z.ZodString> & SchemaHasDefaultValue;
16
- }, z.core.$strip> & SchemaHasDefaultValue;
17
- commonPlayCount: z.ZodObject<{
15
+ readonly tags: z.ZodArray<z.ZodString> & SchemaHasDefaultValue;
16
+ }, z.core.$strip> | z.ZodOptional<z.ZodObject<{
18
17
  readonly enabled: z.ZodBoolean & SchemaHasDefaultValue;
19
- readonly delta: z.ZodOptional<z.ZodString> & SchemaHasDefaultValue;
20
- }, z.core.$strip> & SchemaHasDefaultValue;
18
+ readonly tags: z.ZodArray<z.ZodString> & SchemaHasDefaultValue;
19
+ }, z.core.$strip>>;
20
+ commonPlayCount: z.ZodBoolean & SchemaHasDefaultValue;
21
21
  commonEpisodes: z.ZodBoolean & SchemaHasDefaultValue;
22
22
  items: z.ZodArray<z.ZodObject<{
23
- content: z.ZodString & SchemaHasDefaultValue;
23
+ contentId: z.ZodString & SchemaHasDefaultValue;
24
24
  title: z.ZodString & SchemaHasDefaultValue;
25
25
  contentDescription: z.ZodString & SchemaHasDefaultValue;
26
26
  cover: z.ZodString & SchemaHasDefaultValue;
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineNumberPropSchema as n,defineObjectPropSchema as r,defineSwitchPropSchema as i,defineTextPropSchema as a}from"../../../../utils/schema/schema.mjs";import{z as o}from"zod";const s=o.object({content:a({label:`推荐位内容`,defaultValue:``}),title:a({label:`推荐位内容名称`,defaultValue:`视频标题`}),contentDescription:a({label:`内容说明简介`,defaultValue:``}),cover:a({label:`推荐位封面`,defaultValue:``}),useVideoPoster:i({label:`沿用视频海报`,defaultValue:!0}),showPlayCount:i({label:`播放量显示`,defaultValue:!0}),playCountDelta:a({label:`播放量浮动`,defaultValue:``,required:!1}),showEpisodes:i({label:`集数展示`,defaultValue:!0}),badge:a({label:`推荐位角标`,defaultValue:``,description:`角标图片地址,可通过低代码平台配置上传;留空则使用默认角标图`})}),c=t({title:a({label:`推荐位名称`,defaultValue:`推荐视频`}),moduleCount:n({label:`推荐模块数`,defaultValue:1}),layout:r({enabled:i({label:`组件铺设`,defaultValue:!1}),tag:a({label:`取数范围标签`,defaultValue:`动作`,required:!1})},{label:`组件铺设`,defaultValue:{enabled:!1,tag:`动作`}}),commonPlayCount:r({enabled:i({label:`通用播放量`,defaultValue:!0}),delta:a({label:`播放量浮动值`,defaultValue:``,required:!1})},{label:`通用播放量`,defaultValue:{enabled:!0,delta:``}}),commonEpisodes:i({label:`通用集数`,defaultValue:!0}),items:e(s,{label:`推荐位模块`,defaultValue:[{content:``,title:`视频标题 1`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``},{content:``,title:`视频标题 2`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``},{content:``,title:`视频标题 3`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``}]})});export{c as videoHorizontalListInspectorPropsSchema};
2
+ import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineNumberPropSchema as n,defineObjectPropSchema as r,defineSwitchPropSchema as i,defineTextPropSchema as a}from"../../../../utils/schema/schema.mjs";import{z as o}from"zod";const s=o.object({contentId:a({label:`推荐位内容`,defaultValue:``}),title:a({label:`推荐位内容名称`,defaultValue:`视频标题`}),contentDescription:a({label:`内容说明简介`,defaultValue:``}),cover:a({label:`推荐位封面`,defaultValue:``}),useVideoPoster:i({label:`沿用视频海报`,defaultValue:!0}),showPlayCount:i({label:`播放量显示`,defaultValue:!1}),playCountDelta:a({label:`播放量`,defaultValue:``,required:!1}),showEpisodes:i({label:`集数展示`,defaultValue:!0}),badge:a({label:`推荐位角标`,defaultValue:``,description:`角标图片地址,可通过低代码平台配置上传;留空则使用默认角标图`})}),c=t({title:a({label:`推荐位名称`,defaultValue:`推荐视频`}),moduleCount:n({label:`推荐模块数`,defaultValue:1}),layout:r({enabled:i({label:`智能铺设`,defaultValue:!1}),tags:e(o.string(),{label:`取数范围标签`,defaultValue:[`电影`]})},{label:`组件铺设`,defaultValue:{enabled:!1,tags:[`电影`]}}),commonPlayCount:i({label:`通用播放量`,defaultValue:!0}),commonEpisodes:i({label:`通用集数`,defaultValue:!0}),items:e(s,{label:`推荐位模块`,defaultValue:[{contentId:``,title:`视频标题 1`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,playCountDelta:``,showEpisodes:!0,badge:``},{contentId:``,title:`视频标题 2`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,playCountDelta:``,showEpisodes:!0,badge:``},{contentId:``,title:`视频标题 3`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,playCountDelta:``,showEpisodes:!0,badge:``}]})});export{c as videoHorizontalListInspectorPropsSchema};
@@ -23,6 +23,6 @@ declare const exampleButtonMaterial: DefineMaterialOption<typeof Button, typeof
23
23
  renderer: "renderer";
24
24
  editor: "editor";
25
25
  }>>;
26
- }, zod_v4_core0.$strip>, "example-button">;
26
+ }, zod_v4_core0.$strip>, "example-button", "行为组件">;
27
27
  //#endregion
28
28
  export { exampleButtonMaterial };
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineMaterial as e}from"../../../../utils/schema/material.mjs";import{ButtonClient as t}from"./client.mjs";import{buttonInspectorPropsSchema as n}from"./schema.mjs";import{Button as r}from"./server.mjs";const i=e({type:`example-button`,name:`按钮`,icon:`/icon/button.png`,category:`TOP`,serverComponent:r,clientComponent:t,propsSchema:n});export{i as exampleButtonMaterial};
2
+ import{defineMaterial as e}from"../../../../utils/schema/material.mjs";import{ButtonClient as t}from"./client.mjs";import{buttonInspectorPropsSchema as n}from"./schema.mjs";import{Button as r}from"./server.mjs";const i=e({type:`example-button`,name:`按钮`,icon:`/icon/button.png`,category:`行为组件`,serverComponent:r,clientComponent:t,propsSchema:n});export{i as exampleButtonMaterial};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Box as e}from"../../../ui/box.mjs";import{List as t}from"../../../ui/list.mjs";import{Text as n}from"../../../ui/text.mjs";import{normalizeTimeToMilliseconds as r}from"../../../ui/time.mjs";import{PostListItemSkeleton as i}from"../../skeleton/post-list-item-skeleton.mjs";import{PostListItem as a}from"./post-list-item.mjs";import{useIsClient as o}from"foxact/use-is-client";import{useMemo as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{useTranslations as d}from"next-intl";import f from"next/link";import{orderBy as p}from"lodash-es";function m(e){let t=r(e);if(!t)return!1;let n=new Date(t),i=new Date;return n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate()}function h(r){let h=d(`components.ui.list`),g=o(),{list:_,loading:v,hasMore:y=!1,loadMore:b,isEditMode:x,selectedIds:S,onToggleSelection:C,emptyText:w}=r,T=s(()=>p(_,[`publishTime`],[`desc`]),[_]),{todayList:E,earlierList:D}=s(()=>{if(!g)return{todayList:[],earlierList:T};let e=[],t=[];for(let n of _)m(n.publishTime)?e.push(n):t.push(n);return{todayList:p(e,[`publishTime`],[`desc`]),earlierList:p(t,[`publishTime`],[`desc`])}},[g,_,T]),O=!!v&&_.length===0,k=g;return O?l(e,{className:`bg-bg1`,children:Array.from({length:6}).map((e,t)=>l(i,{isEditMode:x},`post-list-item-skeleton-${t}`))}):u(t,{loading:v,loadMore:b,hasMore:y,empty:`no-content`,emptyText:w||h(`postList.empty`),children:[k&&E.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:h(`postList.today`)})}),E.map(e=>x?l(a,{...e,isEditMode:x,isSelected:S?.has(e.id),onToggle:()=>C?.(e.id)},e.id):l(f,{href:`/post/${e.id}`,children:l(a,{...e,isEditMode:x,isSelected:S?.has(e.id),onToggle:()=>C?.(e.id)})},e.id))]}),D.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:h(`postList.earlier`)})}),D.map(e=>x?l(a,{...e,isEditMode:x,isSelected:S?.has(e.id),onToggle:()=>C?.(e.id)},e.id):l(f,{href:`/post/${e.id}`,children:l(a,{...e,isEditMode:x,isSelected:S?.has(e.id),onToggle:()=>C?.(e.id)})},e.id))]})]})}export{h as PostList};
2
+ "use client";import{Box as e}from"../../../ui/box.mjs";import{List as t}from"../../../ui/list.mjs";import{Text as n}from"../../../ui/text.mjs";import{normalizeTimeToMilliseconds as r}from"../../../ui/time.mjs";import{PostListItemSkeleton as i}from"../../skeleton/post-list-item-skeleton.mjs";import{PostListItem as a}from"./post-list-item.mjs";import{useIsClient as o}from"foxact/use-is-client";import{useMemo as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{useTranslations as d}from"next-intl";import f from"next/link";import{orderBy as p}from"lodash-es";function m(e){let t=r(e);if(!t)return!1;let n=new Date(t),i=new Date;return n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate()}function h(e){let t=r(e);if(!t)return!1;let n=new Date(t),i=new Date;return i.setDate(i.getDate()-1),n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate()}function g(r){let g=d(`components.ui.list`),_=o(),{list:v,loading:y,hasMore:b=!1,loadMore:x,isEditMode:S,selectedIds:C,onToggleSelection:w,emptyText:T}=r,E=s(()=>p(v,[`publishTime`],[`desc`]),[v]),{todayList:D,yesterdayList:O,earlierList:k}=s(()=>{if(!_)return{todayList:[],yesterdayList:[],earlierList:E};let e=[],t=[],n=[];for(let r of v)m(r.publishTime)?e.push(r):h(r.publishTime)?t.push(r):n.push(r);return{todayList:p(e,[`publishTime`],[`desc`]),yesterdayList:p(t,[`publishTime`],[`desc`]),earlierList:p(n,[`publishTime`],[`desc`])}},[_,v,E]),A=!!y&&v.length===0,j=_;return A?l(e,{className:`bg-bg1`,children:Array.from({length:6}).map((e,t)=>l(i,{isEditMode:S},`post-list-item-skeleton-${t}`))}):u(t,{loading:y,loadMore:x,hasMore:b,empty:`no-content`,emptyText:T||g(`postList.empty`),children:[j&&D.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:g(`postList.today`)})}),D.map(e=>S?l(a,{...e,isEditMode:S,isSelected:C?.has(e.id),onToggle:()=>w?.(e.id)},e.id):l(f,{href:`/post/${e.id}`,children:l(a,{...e,isEditMode:S,isSelected:C?.has(e.id),onToggle:()=>w?.(e.id)})},e.id))]}),j&&O.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:g(`postList.yesterday`)})}),O.map(e=>S?l(a,{...e,isEditMode:S,isSelected:C?.has(e.id),onToggle:()=>w?.(e.id)},e.id):l(f,{href:`/post/${e.id}`,children:l(a,{...e,isEditMode:S,isSelected:C?.has(e.id),onToggle:()=>w?.(e.id)})},e.id))]}),k.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:g(`postList.earlier`)})}),k.map(e=>S?l(a,{...e,isEditMode:S,isSelected:C?.has(e.id),onToggle:()=>w?.(e.id)},e.id):l(f,{href:`/post/${e.id}`,children:l(a,{...e,isEditMode:S,isSelected:C?.has(e.id),onToggle:()=>w?.(e.id)})},e.id))]})]})}export{g as PostList};
@@ -12,7 +12,7 @@ interface UserActivityListProps {
12
12
  hasMore?: boolean;
13
13
  /** 加载更多回调 */
14
14
  loadMore?: () => Promise<void>;
15
- /** 是否显示时间分组标题(今天/更早) */
15
+ /** 是否显示时间分组标题(今天/昨天/更早) */
16
16
  showGroupHeaders?: boolean;
17
17
  /** 空状态文本 */
18
18
  emptyText?: string;
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Box as e}from"../../../ui/box.mjs";import{List as t}from"../../../ui/list.mjs";import{Text as n}from"../../../ui/text.mjs";import{normalizeTimeToMilliseconds as r}from"../../../ui/time.mjs";import{UserActivityListItemSkeleton as i}from"../../skeleton/user-activity-list-item-skeleton.mjs";import{UserActivityListItem as a}from"./user-activity-list-item.mjs";import{useEffect as o,useMemo as s,useState as c}from"react";import{Fragment as l,jsx as u,jsxs as d}from"react/jsx-runtime";import{useTranslations as f}from"next-intl";function p(e){let t=r(e);if(!t)return!1;let n=new Date(t),i=new Date;return n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate()}function m(r){let m=f(`components.ui.list`),[h,g]=c(!1),{list:_,loading:v,hasMore:y=!1,loadMore:b,showGroupHeaders:x=!0,emptyText:S,canEdit:C=!1,isEditMode:w,selectedIds:T,onToggleSelection:E,onActionSuccess:D}=r,O=S??m(`userActivityList.empty`);o(()=>{g(!0)},[]);let k=x&&h,{todayList:A,earlierList:j}=s(()=>{if(!k)return{todayList:[],earlierList:_};let e=[],t=[];for(let n of _)p(n.create_time)?e.push(n):t.push(n);return{todayList:e,earlierList:t}},[_,k]);return v&&_.length===0?u(e,{className:`bg-bg1`,children:Array.from({length:3}).map((e,t)=>u(i,{isEditMode:w},`user-activity-list-item-skeleton-${t}`))}):u(l,{children:u(t,{loading:v,loadMore:b,hasMore:y,empty:`no-content`,emptyText:O,children:k?d(l,{children:[A.length>0&&d(l,{children:[u(e,{className:` `,children:u(n,{className:`text-lg text-text1`,children:m(`userActivityList.today`)})}),A.map(e=>u(a,{...e,canEdit:C,isEditMode:w,isSelected:T?.has(e.content_id??``),onToggle:()=>E?.(e.content_id??``),onActionSuccess:D,is_dislike:e.interaction?.is_dislike||e.is_dislike,is_liked:e.interaction?.is_liked||e.is_liked,is_collected:e.is_collected||e.interaction?.is_collected},e.content_id))]}),j.length>0&&d(l,{children:[u(e,{className:` `,children:u(n,{className:`text-lg text-text1`,children:m(`userActivityList.earlier`)})}),j.map(e=>u(a,{...e,canEdit:C,isEditMode:w,isSelected:T?.has(e.content_id??``),onToggle:()=>E?.(e.content_id??``),onActionSuccess:D,is_dislike:e.interaction?.is_dislike||e.is_dislike,is_liked:e.interaction?.is_liked||e.is_liked,is_collected:e.is_collected||e.interaction?.is_collected},e.content_id))]})]}):_.map(e=>u(a,{...e,canEdit:C,isEditMode:w,isSelected:T?.has(e.content_id??``),onToggle:()=>E?.(e.content_id??``),onActionSuccess:D,is_dislike:e.interaction?.is_dislike||e.is_dislike,is_liked:e.interaction?.is_liked||e.is_liked,is_collected:e.is_collected||e.interaction?.is_collected},e.content_id??``))})})}export{m as UserActivityList};
2
+ "use client";import{Box as e}from"../../../ui/box.mjs";import{List as t}from"../../../ui/list.mjs";import{Text as n}from"../../../ui/text.mjs";import{normalizeTimeToMilliseconds as r}from"../../../ui/time.mjs";import{UserActivityListItemSkeleton as i}from"../../skeleton/user-activity-list-item-skeleton.mjs";import{UserActivityListItem as a}from"./user-activity-list-item.mjs";import{useEffect as o,useMemo as s,useState as c}from"react";import{Fragment as l,jsx as u,jsxs as d}from"react/jsx-runtime";import{useTranslations as f}from"next-intl";function p(e){let t=r(e);if(!t)return!1;let n=new Date(t),i=new Date;return n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate()}function m(e){let t=r(e);if(!t)return!1;let n=new Date(t),i=new Date;return i.setDate(i.getDate()-1),n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate()}function h(r){let h=f(`components.ui.list`),[g,_]=c(!1),{list:v,loading:y,hasMore:b=!1,loadMore:x,showGroupHeaders:S=!0,emptyText:C,canEdit:w=!1,isEditMode:T,selectedIds:E,onToggleSelection:D,onActionSuccess:O}=r,k=C??h(`userActivityList.empty`);o(()=>{_(!0)},[]);let A=S&&g,{todayList:j,yesterdayList:M,earlierList:N}=s(()=>{if(!A)return{todayList:[],yesterdayList:[],earlierList:v};let e=[],t=[],n=[];for(let r of v)p(r.create_time)?e.push(r):m(r.create_time)?t.push(r):n.push(r);return{todayList:e,yesterdayList:t,earlierList:n}},[v,A]);return y&&v.length===0?u(e,{className:`bg-bg1`,children:Array.from({length:3}).map((e,t)=>u(i,{isEditMode:T},`user-activity-list-item-skeleton-${t}`))}):u(l,{children:u(t,{loading:y,loadMore:x,hasMore:b,empty:`no-content`,emptyText:k,children:A?d(l,{children:[j.length>0&&d(l,{children:[u(e,{className:` `,children:u(n,{className:`text-lg text-text1`,children:h(`userActivityList.today`)})}),j.map(e=>u(a,{...e,canEdit:w,isEditMode:T,isSelected:E?.has(e.content_id??``),onToggle:()=>D?.(e.content_id??``),onActionSuccess:O,is_dislike:e.interaction?.is_dislike||e.is_dislike,is_liked:e.interaction?.is_liked||e.is_liked,is_collected:e.is_collected||e.interaction?.is_collected},e.content_id))]}),M.length>0&&d(l,{children:[u(e,{className:` `,children:u(n,{className:`text-lg text-text1`,children:h(`userActivityList.yesterday`)})}),M.map(e=>u(a,{...e,canEdit:w,isEditMode:T,isSelected:E?.has(e.content_id??``),onToggle:()=>D?.(e.content_id??``),onActionSuccess:O,is_dislike:e.interaction?.is_dislike||e.is_dislike,is_liked:e.interaction?.is_liked||e.is_liked,is_collected:e.is_collected||e.interaction?.is_collected},e.content_id))]}),N.length>0&&d(l,{children:[u(e,{className:` `,children:u(n,{className:`text-lg text-text1`,children:h(`userActivityList.earlier`)})}),N.map(e=>u(a,{...e,canEdit:w,isEditMode:T,isSelected:E?.has(e.content_id??``),onToggle:()=>D?.(e.content_id??``),onActionSuccess:O,is_dislike:e.interaction?.is_dislike||e.is_dislike,is_liked:e.interaction?.is_liked||e.is_liked,is_collected:e.is_collected||e.interaction?.is_collected},e.content_id))]})]}):v.map(e=>u(a,{...e,canEdit:w,isEditMode:T,isSelected:E?.has(e.content_id??``),onToggle:()=>D?.(e.content_id??``),onActionSuccess:O,is_dislike:e.interaction?.is_dislike||e.is_dislike,is_liked:e.interaction?.is_liked||e.is_liked,is_collected:e.is_collected||e.interaction?.is_collected},e.content_id??``))})})}export{h as UserActivityList};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Box as e}from"../../../ui/box.mjs";import{List as t}from"../../../ui/list.mjs";import{Text as n}from"../../../ui/text.mjs";import{normalizeTimeToMilliseconds as r}from"../../../ui/time.mjs";import{VideoListItemSkeleton as i}from"../../skeleton/video-list-item-skeleton.mjs";import{VideoListItem as a}from"./video-list-item.mjs";import{useIsClient as o}from"foxact/use-is-client";import{useMemo as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{useTranslations as d}from"next-intl";import f from"next/link";import{orderBy as p}from"lodash-es";function m(e){let t=r(e);if(!t)return!1;let n=new Date(t),i=new Date;return n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate()}function h(r){let h=d(`components.ui.list`),g=o(),{list:_,showVideoProgress:v,loading:y,hasMore:b=!1,loadMore:x,isEditMode:S,selectedIds:C,onToggleSelection:w,emptyText:T}=r,E=s(()=>p(_,[`publishTime`],[`desc`]),[_]),{todayList:D,earlierList:O}=s(()=>{if(!g)return{todayList:[],earlierList:E};let e=[],t=[];for(let n of _)m(n.publishTime)?e.push(n):t.push(n);return{todayList:p(e,[`publishTime`],[`desc`]),earlierList:p(t,[`publishTime`],[`desc`])}},[g,_,E]),k=!!y&&_.length===0,A=g;return k?l(e,{className:`bg-bg1`,children:Array.from({length:6}).map((e,t)=>l(i,{isEditMode:S,showVideoProgress:v},`video-list-item-skeleton-${t}`))}):u(t,{loading:y,loadMore:x,hasMore:b,empty:`no-content`,emptyText:T||h(`videoList.empty`),children:[A&&D.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:h(`videoList.today`)})}),D.map(e=>S?l(a,{showVideoProgress:v,isEditMode:S,isSelected:C?.has(e.id),...e,onToggle:()=>w?.(e.id)},e.id):l(f,{href:`/video/${e.id}/${e.title}`,children:l(a,{showVideoProgress:v,isEditMode:S,isSelected:C?.has(e.id),...e,onToggle:()=>w?.(e.id)},e.id)},e.id))]}),O.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:h(`videoList.earlier`)})}),O.map(e=>S?l(a,{showVideoProgress:v,isEditMode:S,isSelected:C?.has(e.id),...e,onToggle:()=>w?.(e.id)},e.id):l(f,{href:`/video/${e.id}/${e.title}`,children:l(a,{showVideoProgress:v,isEditMode:S,isSelected:C?.has(e.id),...e,onToggle:()=>w?.(e.id)},e.id)},e.id))]})]})}export{h as VideoList};
2
+ "use client";import{Box as e}from"../../../ui/box.mjs";import{List as t}from"../../../ui/list.mjs";import{Text as n}from"../../../ui/text.mjs";import{normalizeTimeToMilliseconds as r}from"../../../ui/time.mjs";import{VideoListItemSkeleton as i}from"../../skeleton/video-list-item-skeleton.mjs";import{VideoListItem as a}from"./video-list-item.mjs";import{useIsClient as o}from"foxact/use-is-client";import{useMemo as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{useTranslations as d}from"next-intl";import f from"next/link";import{orderBy as p}from"lodash-es";function m(e){let t=r(e);if(!t)return!1;let n=new Date(t),i=new Date;return n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate()}function h(e){let t=r(e);if(!t)return!1;let n=new Date(t),i=new Date;return i.setDate(i.getDate()-1),n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate()}function g(r){let g=d(`components.ui.list`),_=o(),{list:v,showVideoProgress:y,loading:b,hasMore:x=!1,loadMore:S,isEditMode:C,selectedIds:w,onToggleSelection:T,emptyText:E}=r,D=s(()=>p(v,[`publishTime`],[`desc`]),[v]),{todayList:O,yesterdayList:k,earlierList:A}=s(()=>{if(!_)return{todayList:[],yesterdayList:[],earlierList:D};let e=[],t=[],n=[];for(let r of v)m(r.publishTime)?e.push(r):h(r.publishTime)?t.push(r):n.push(r);return{todayList:p(e,[`publishTime`],[`desc`]),yesterdayList:p(t,[`publishTime`],[`desc`]),earlierList:p(n,[`publishTime`],[`desc`])}},[_,v,D]),j=!!b&&v.length===0,M=_;return j?l(e,{className:`bg-bg1`,children:Array.from({length:6}).map((e,t)=>l(i,{isEditMode:C,showVideoProgress:y},`video-list-item-skeleton-${t}`))}):u(t,{loading:b,loadMore:S,hasMore:x,empty:`no-content`,emptyText:E||g(`videoList.empty`),children:[M&&O.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:g(`videoList.today`)})}),O.map(e=>C?l(a,{showVideoProgress:y,isEditMode:C,isSelected:w?.has(e.id),...e,onToggle:()=>T?.(e.id)},e.id):l(f,{href:`/video/${e.id}/${e.title}`,children:l(a,{showVideoProgress:y,isEditMode:C,isSelected:w?.has(e.id),...e,onToggle:()=>T?.(e.id)},e.id)},e.id))]}),M&&k.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:g(`videoList.yesterday`)})}),k.map(e=>C?l(a,{showVideoProgress:y,isEditMode:C,isSelected:w?.has(e.id),...e,onToggle:()=>T?.(e.id)},e.id):l(f,{href:`/video/${e.id}/${e.title}`,children:l(a,{showVideoProgress:y,isEditMode:C,isSelected:w?.has(e.id),...e,onToggle:()=>T?.(e.id)},e.id)},e.id))]}),A.length>0&&u(c,{children:[l(e,{className:` `,children:l(n,{className:`text-lg text-text1`,children:g(`videoList.earlier`)})}),A.map(e=>C?l(a,{showVideoProgress:y,isEditMode:C,isSelected:w?.has(e.id),...e,onToggle:()=>T?.(e.id)},e.id):l(f,{href:`/video/${e.id}/${e.title}`,children:l(a,{showVideoProgress:y,isEditMode:C,isSelected:w?.has(e.id),...e,onToggle:()=>T?.(e.id)},e.id)},e.id))]})]})}export{g as VideoList};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{useFollowIdsState as e}from"../../../../../store/modules/follow-ids-store.mjs";import{useUserStore as t}from"../../../../../store/modules/user-store.mjs";import{pInteractionFollow as n,pInteractionUnfollow as r}from"../../../../../service/generated/client.mjs";import{useEffect as i,useState as a}from"react";import{Fragment as o,jsx as s}from"react/jsx-runtime";import{useTranslations as c}from"next-intl";function l(l){let u=c(`components.pages.follow.components.followButton`),{userId:d,hasFollow:f,followText:p=``,onChange:m}=l,h=p||u(`follow`),[g,_]=a(f),{isLogin:v,userInfo:y,userId:b}=t(),{followIds:x}=e(),S=b||y?.userId||``,C=y?.userId===d,w=f||x.includes(d);i(()=>{_(w)},[w]);async function T(){try{g?await r({follower_id:S,followee_id:d}):await n({follower_id:S,followee_id:d}),window.sensors?.track(`detail_follow_click`,{object_id:``,action:g?`取消关注`:`关注`,author_id:d}),sessionStorage.setItem(`user_page_refresh`,`1`)}catch(e){console.error(`关注或取消关注失败:`,e)}_(!g),m?.(!g)}function E(){T(),v&&(g||T())}return C?null:s(`button`,{className:` h-7 rounded-full px-4 py-1.5 border border-solid cursor-pointer flex items-center justify-center ${g?`border-text3`:`border-theme5`}`,onClick:()=>E(),children:g?s(o,{children:s(`span`,{className:`text-text3 text-xs leading-4.5 ml-1 shrink-0`,children:u(`following`)})}):s(o,{children:s(`span`,{className:`block text-theme5 text-xs leading-4.5 ml-1 shrink-0`,children:h})})})}export{l as FollowButton};
2
+ "use client";import{useFollowIdsState as e}from"../../../../../store/modules/follow-ids-store.mjs";import{useUserStore as t}from"../../../../../store/modules/user-store.mjs";import{pInteractionFollow as n,pInteractionUnfollow as r}from"../../../../../service/generated/client.mjs";import{useEffect as i,useState as a}from"react";import{Fragment as o,jsx as s}from"react/jsx-runtime";import{useTranslations as c}from"next-intl";function l(l){let u=c(`components.pages.follow.components.followButton`),{userId:d,hasFollow:f,followText:p=``,onChange:m}=l,h=p||u(`follow`),[g,_]=a(f),{isLogin:v,userInfo:y,userId:b}=t(),{followIds:x}=e(),S=b||y?.userId||``,C=y?.userId===d,w=f||x.includes(d);i(()=>{_(w)},[w]);async function T(){if(!v){_(g),m?.(!1);return}try{g?await r({follower_id:S,followee_id:d}):await n({follower_id:S,followee_id:d}),window.sensors?.track(`detail_follow_click`,{object_id:``,action:g?`取消关注`:`关注`,author_id:d}),sessionStorage.setItem(`user_page_refresh`,`1`)}catch(e){console.error(`关注或取消关注失败:`,e)}_(!g),m?.(!g)}function E(){T(),v&&(g||T())}return C?null:s(`button`,{className:` h-7 rounded-full px-4 py-1.5 border border-solid cursor-pointer flex items-center justify-center ${g?`border-text3`:`border-theme5`}`,onClick:()=>E(),children:g?s(o,{children:s(`span`,{className:`text-text3 text-xs leading-4.5 ml-1 shrink-0`,children:u(`following`)})}):s(o,{children:s(`span`,{className:`block text-theme5 text-xs leading-4.5 ml-1 shrink-0`,children:h})})})}export{l as FollowButton};