@funhub/platform 0.1.144 → 0.1.145
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common.d.mts +3 -1
- package/dist/common.mjs +1 -1
- package/dist/components/common/collection-popup/index.d.mts +27 -0
- package/dist/components/common/collection-popup/index.mjs +1 -1
- package/dist/components/common/funhub-provider/funhub-provider.mjs +1 -1
- package/dist/components/common/user-info-initializer/index.d.mts +8 -0
- package/dist/components/common/user-info-initializer/index.mjs +2 -0
- package/dist/components/pages/settings/_components/reset-password-drawer.mjs +2 -2
- package/dist/components/ui/button.d.mts +1 -1
- package/dist/components/ui/image.d.mts +4 -4
- package/package.json +28 -28
package/dist/common.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ import { UserActivityListItem, UserActivityListItemProps, UserActivityMediaGrid,
|
|
|
3
3
|
import { BlockedDialog } from "./components/common/blocked-dialog/blocked-dialog.mjs";
|
|
4
4
|
import "./components/common/blocked-dialog/index.mjs";
|
|
5
5
|
import { MiniThreeCard } from "./components/common/cards/mini-three-card.mjs";
|
|
6
|
+
import { CollectionPopupComponent, CollectionPopupHost } from "./components/common/collection-popup/index.mjs";
|
|
6
7
|
import { DebugLocaleSwitcher } from "./components/common/debug-locale-switcher/index.mjs";
|
|
7
8
|
import { DeleteConfirmDialog, DeleteConfirmDialogProps } from "./components/common/delete-confirm-dialog/delete-confirm-dialog.mjs";
|
|
8
9
|
import "./components/common/delete-confirm-dialog/index.mjs";
|
|
@@ -52,6 +53,7 @@ import "./components/common/share-popup/index.mjs";
|
|
|
52
53
|
import { TabBar } from "./components/common/tab-bar/index.mjs";
|
|
53
54
|
import { ThemeSync } from "./components/common/theme-sync/index.mjs";
|
|
54
55
|
import { TopNavBarServer } from "./components/common/top-nav-bar/index.mjs";
|
|
56
|
+
import { UserInfoInitializer } from "./components/common/user-info-initializer/index.mjs";
|
|
55
57
|
import { CommonPlayer, CommonPlayerRef } from "./components/common/video-player/index.mjs";
|
|
56
58
|
import { WaitLoading } from "./components/common/wait-loading.mjs";
|
|
57
|
-
export { ActionButton, AddIcon, BlockedDialog, CollectionList, CollectionListItem, CollectionListItemProps, CollectionListMediaItem, CollectionListProps, CommentIcon, CommonPhotoGrid, CommonPlayer, CommonPlayerRef, DebugLocaleSwitcher, DeleteConfirmDialog, DeleteConfirmDialogProps, DeleteIcon, Empty, FunhubProvider, FunhubProviderProps, GenderPicker, GenderPickerOption, GenderPickerProps, HeaderNav, IntlProvider, IntlProviderProps, LeftArrowIcon, LocaleSync, LoginDialog, MediaPreview, MiniThreeCard, MoreIcon, PageSkeleton, SeriesEpisodePage as PhotoGrid, PopupVideo, PostList, PostListItem, PostListItemProps, PostListProps, RightArrowIcon, SeriesEpisodes, SeriesEpisodesProps, SettingIcon, ShareContent, ShareDataType, ShareDrawer, ShareDrawerProps, ShareIcon, SharePlatform, SharePopupComponent, TabBar, ThemeSync, TopNavBarServer, UserActivityList, UserActivityListItem, UserActivityListItemProps, UserActivityListProps, UserActivityMediaGrid, UserActivityMediaGridProps, MediaPreview as UserActivityMediaPreview, VideoList, VideoListItem, VideoListItemProps, VideoListProps, WaitLoading, closePhotoPreview, defaultActions, defaultPlatforms, photoPreview, useMediaPreview };
|
|
59
|
+
export { ActionButton, AddIcon, BlockedDialog, CollectionList, CollectionListItem, CollectionListItemProps, CollectionListMediaItem, CollectionListProps, CollectionPopupComponent, CollectionPopupHost, CommentIcon, CommonPhotoGrid, CommonPlayer, CommonPlayerRef, DebugLocaleSwitcher, DeleteConfirmDialog, DeleteConfirmDialogProps, DeleteIcon, Empty, FunhubProvider, FunhubProviderProps, GenderPicker, GenderPickerOption, GenderPickerProps, HeaderNav, IntlProvider, IntlProviderProps, LeftArrowIcon, LocaleSync, LoginDialog, MediaPreview, MiniThreeCard, MoreIcon, PageSkeleton, SeriesEpisodePage as PhotoGrid, PopupVideo, PostList, PostListItem, PostListItemProps, PostListProps, RightArrowIcon, SeriesEpisodes, SeriesEpisodesProps, SettingIcon, ShareContent, ShareDataType, ShareDrawer, ShareDrawerProps, ShareIcon, SharePlatform, SharePopupComponent, TabBar, ThemeSync, TopNavBarServer, UserActivityList, UserActivityListItem, UserActivityListItemProps, UserActivityListProps, UserActivityMediaGrid, UserActivityMediaGridProps, MediaPreview as UserActivityMediaPreview, UserInfoInitializer, VideoList, VideoListItem, VideoListItemProps, VideoListProps, WaitLoading, closePhotoPreview, defaultActions, defaultPlatforms, photoPreview, useMediaPreview };
|
package/dist/common.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{MediaPreview as e,useMediaPreview as t}from"./components/common/media-preview/index.mjs";import n from"./components/common/share-popup/share-content.mjs";import{ShareDrawer as
|
|
2
|
+
import{MediaPreview as e,useMediaPreview as t}from"./components/common/media-preview/index.mjs";import{CollectionPopupComponent as n,CollectionPopupHost as r}from"./components/common/collection-popup/index.mjs";import i from"./components/common/share-popup/share-content.mjs";import{ShareDrawer as a}from"./components/common/share-popup/share-drawer.mjs";import{IntlProvider as o}from"./components/common/intl-provider/intl-provider.mjs";import{SharePopupComponent as s,defaultActions as c,defaultPlatforms as l}from"./components/common/share-popup/share-popup.mjs";import u from"./components/common/video-player/index.mjs";import{BlockedDialog as d}from"./components/common/blocked-dialog/blocked-dialog.mjs";import{MiniThreeCard as f}from"./components/common/cards/mini-three-card.mjs";import{DebugLocaleSwitcher as p}from"./components/common/debug-locale-switcher/index.mjs";import{DeleteConfirmDialog as m}from"./components/common/delete-confirm-dialog/delete-confirm-dialog.mjs";import h from"./components/common/empty/index.mjs";import{FunhubProvider as g}from"./components/common/funhub-provider/funhub-provider.mjs";import{LeftArrowIcon as _}from"./components/common/icons/left-arrow.mjs";import{HeaderNav as v}from"./components/common/header-nav/client.mjs";import{AddIcon as y}from"./components/common/icons/add.mjs";import{CommentIcon as b}from"./components/common/icons/comment.mjs";import{DeleteIcon as x}from"./components/common/icons/delete.mjs";import{MoreIcon as S}from"./components/common/icons/more.mjs";import{RightArrowIcon as C}from"./components/common/icons/right-arrow.mjs";import{SettingIcon as w}from"./components/common/icons/setting.mjs";import{ShareIcon as T}from"./components/common/icons/share.mjs";import{CollectionListItem as E}from"./components/common/list/collection-list/collection-list-item.mjs";import{CollectionList as D}from"./components/common/list/collection-list/collection-list.mjs";import{PostListItem as O}from"./components/common/list/post-list/post-list-item.mjs";import{PostList as k}from"./components/common/list/post-list/post-list.mjs";import{UserActivityList as A}from"./components/common/list/user-activity-list/user-activity-list.mjs";import{UserActivityListItem as j,UserActivityMediaGrid as M}from"./components/common/list/user-activity-list/user-activity-list-item.mjs";import{VideoListItem as N}from"./components/common/list/video-list/video-list-item.mjs";import{VideoList as P}from"./components/common/list/video-list/video-list.mjs";import{LocaleSync as F}from"./components/common/locale-sync/locale-sync.mjs";import{LoginDialog as I}from"./components/common/login-dialog/login-dialog.mjs";import{PageSkeleton as L}from"./components/common/page-skeleton/page-skeleton.mjs";import R from"./components/common/photo-grid/index.mjs";import z from"./components/common/photo-grid/common-photo-grid.mjs";import{closePhotoPreview as B,photoPreview as V}from"./components/common/photo-preview/index.mjs";import{GenderPicker as H}from"./components/common/picker/gender-picker/gender-picker.mjs";import U from"./components/common/popup-video/index.mjs";import{SeriesEpisodes as W}from"./components/common/series-episodes/index.mjs";import{TabBar as G}from"./components/common/tab-bar/index.mjs";import{ThemeSync as K}from"./components/common/theme-sync/index.mjs";import{TopNavBarServer as q}from"./components/common/top-nav-bar/index.mjs";import{UserInfoInitializer as J}from"./components/common/user-info-initializer/index.mjs";import{WaitLoading as Y}from"./components/common/wait-loading.mjs";export{y as AddIcon,d as BlockedDialog,D as CollectionList,E as CollectionListItem,n as CollectionPopupComponent,r as CollectionPopupHost,b as CommentIcon,z as CommonPhotoGrid,u as CommonPlayer,p as DebugLocaleSwitcher,m as DeleteConfirmDialog,x as DeleteIcon,h as Empty,g as FunhubProvider,H as GenderPicker,v as HeaderNav,o as IntlProvider,_ as LeftArrowIcon,F as LocaleSync,I as LoginDialog,e as MediaPreview,f as MiniThreeCard,S as MoreIcon,L as PageSkeleton,R as PhotoGrid,U as PopupVideo,k as PostList,O as PostListItem,C as RightArrowIcon,W as SeriesEpisodes,w as SettingIcon,i as ShareContent,a as ShareDrawer,T as ShareIcon,s as SharePopupComponent,G as TabBar,K as ThemeSync,q as TopNavBarServer,A as UserActivityList,j as UserActivityListItem,M as UserActivityMediaGrid,e as UserActivityMediaPreview,J as UserInfoInitializer,P as VideoList,N as VideoListItem,Y as WaitLoading,B as closePhotoPreview,c as defaultActions,l as defaultPlatforms,V as photoPreview,t as useMediaPreview};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region components/common/collection-popup/index.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* 合集弹窗参数。
|
|
7
|
+
*/
|
|
8
|
+
interface CollectionPopupProps {
|
|
9
|
+
/** 是否显示弹窗。 */
|
|
10
|
+
visible: boolean;
|
|
11
|
+
/** 弹窗模式:收藏到合集/选择收藏夹。 */
|
|
12
|
+
mode?: 'favorite' | 'select';
|
|
13
|
+
/** 弹窗关闭回调。 */
|
|
14
|
+
onClose?: () => void;
|
|
15
|
+
/** 点击「创建合集」回调。 */
|
|
16
|
+
toCreateCollection?: () => void;
|
|
17
|
+
/** 选择合集后的回调,参数为合集 ID。 */
|
|
18
|
+
onCollect?: (id: string) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 收藏到合集弹窗主体。
|
|
22
|
+
* @param props 组件参数
|
|
23
|
+
*/
|
|
24
|
+
declare function CollectionPopupComponent(props: CollectionPopupProps): react_jsx_runtime0.JSX.Element;
|
|
25
|
+
declare function CollectionPopupHost(): react_jsx_runtime0.JSX.Element | null;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { CollectionPopupComponent, CollectionPopupHost };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{createStore as e}from"../../../store/create-store.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetUserCollections as n}from"../../../service/generated/client.mjs";import{Image as r}from"../../ui/image.mjs";import{InfiniteScroll as i}from"../../ui/infinite-scroll.mjs";import a from"../../../assets/icons/close.mjs";import o from"../../../assets/icons/common/right_arrow.mjs";import s from"../../../assets/icons/detail/min-collection.mjs";import c from"../../../assets/icons/empty/img-empty-nodata.mjs";import l from"../../ui/popup.mjs";import{CollectionCreateModal as u}from"./collection-create-modal.mjs";import d from"../page-loading/index.mjs";import{useCallback as f,useEffect as p,useMemo as m,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{toast as y}from"sonner";import{useTranslations as b}from"next-intl";const x=e(e=>({isOpen:!1,options:null,open:t=>e(e=>({...e,isOpen:!0,options:t})),close:()=>e(e=>({...e,isOpen:!1,options:null}))}),{name:`collection-popup-store`,persist:!1});function S(e){return{id:String(e?.collection_id||``),cover:e?.cover_image||``,title:e?.title||``,contentCount:Number(e?.content_count||0)}}function C(e){let x=b(`components.common.collectionPopup`),{visible:C,mode:w=`favorite`,onClose:T,toCreateCollection:E,onCollect:D}=e,{userInfo:O,userId:k}=t(),[A,j]=h(!0),[M,N]=h([]),[P,F]=h(!0),[I,L]=h(1),[R,z]=h(!1),B=m(()=>String(k||O?.userId||`0`),[k,O?.userId]),V=f(async e=>{if(!B||!e?.reset&&(!P||A&&M.length>0))return;let t=e?.nextPage??I;j(!0);try{let e=await n({page:t,page_size:10});if(e.code!==0){F(!1);return}let r=(e.data?.data?.collections??[]).map(S);N(e=>t===1?r:[...e,...r]),e.data?.data?.has_more===!1||r.length<10?F(!1):(F(!0),L(t+1))}catch(e){console.error(`获取合集列表失败:`,e),F(!1)}finally{j(!1)}},[M.length,P,A,I,10,B]);p(()=>{C&&V()},[V,C]);let[H,U]=h(!0);p(()=>{U(!A&&M.length===0)},[M.length,A]);function W(e){e||T?.()}function G(){if(w===`select`){z(!0);return}E?.()}function K(e){D?.(e),w===`favorite`&&y.message(x(`collectSuccess`))}function q(e){return function(){K(e)}}function J(){return V()}let Y=f(()=>{F(!0),L(1),N([]),V({nextPage:1,reset:!0})},[V]);return v(l,{open:C,onOpenChange:W,showCloseButton:!1,className:`z-[1000] h-[450px] rounded-t-[16px] bg-bg1 p-0 text-text1`,children:[v(`div`,{className:`bg-bg1 h-[450px] pb-[24px] flex flex-col`,children:[v(`div`,{className:`w-full px-[16px] relative`,children:[v(`div`,{className:`w-full h-[60px] flex items-center justify-center`,children:[_(`button`,{type:`button`,className:`cursor-pointer absolute w-[48px] h-[60px] left-0 top-0 flex items-center justify-center focus:outline-none`,onClick:T,children:_(a,{className:`w-[16px] h-[16px] text-text1`})}),_(`div`,{className:`text-[18px] text-text1 font-semibold`,children:x(w===`select`?`selectTitle`:`favoriteToCollectionTitle`)}),w===`select`&&_(`button`,{type:`button`,className:`absolute right-0 top-0 h-[60px] px-[16px] text-[14px] text-theme5 font-semibold`,onClick:G,children:x(`newCollection`)})]}),w===`favorite`&&v(`button`,{type:`button`,className:`cursor-pointer w-full h-[48px] rounded-[16px] px-[12px] border border-solid border-line1 flex items-center justify-between`,onClick:G,children:[v(`div`,{className:`flex items-center`,children:[_(s,{className:`w-[24px] h-[24px]`}),_(`span`,{className:`ml-[8px] text-text1 text-[14px] font-semibold leading-[18px]`,children:x(`createCollection`)})]}),_(o,{className:`text-text2 w-[12px] h-[12px]`})]})]}),_(`div`,{className:`w-full px-[16px] flex-1 h-[0] overflow-y-auto`,children:A?_(d,{}):H?v(`div`,{className:`flex flex-col items-center justify-center py-[48px] text-text2`,children:[_(c,{className:`w-[120px] h-[120px]`}),v(`span`,{className:`mt-[16px] text-[14px]`,children:[x(`noCollections`),`,`,x(`createCollectionHint`)]})]}):v(g,{children:[M.map((e,t)=>v(`button`,{type:`button`,className:`cursor-pointer w-full h-[92px] flex items-center text-left`,onClick:q(e.id),children:[_(`div`,{className:`w-[60px] h-[60px] bg-bg2 rounded-[8px] overflow-hidden relative`,children:e.cover&&_(r,{src:e.cover,fill:!0,objectFit:`cover`,alt:x(`coverAlt`)})}),v(`div`,{className:`ml-[12px] flex flex-col justify-center`,children:[_(`span`,{className:`max-w-[200px] text-text1 text-[18px] leading-[24px] font-semibold line-clamp-1`,children:e.title||``}),v(`span`,{className:`mt-[3px] text-text2 text-[14px]`,children:[e.contentCount||0,x(`postsCountSuffix`)]})]})]},e.id||`collection-${t}`)),M.length>0&&_(i,{loadMore:J,hasMore:P})]})})]}),_(u,{visible:R,onClose:()=>z(!1),onCreated:()=>{z(!1),Y()}})]})}function w(){let{isOpen:e,options:t,close:n}=x();return e?_(C,{visible:e,mode:t?.mode,onClose:()=>{n(),t?.onClose?.()},toCreateCollection:()=>{n(),t?.toCreateCollection?.()},onCollect:e=>{n(),t?.onCollect?.(e)}}):null}var T=class{static show(e){x.getState().open(e)}static clear(){x.getState().close()}};export{w as CollectionPopupHost,T as default};
|
|
2
|
+
"use client";import{createStore as e}from"../../../store/create-store.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetUserCollections as n}from"../../../service/generated/client.mjs";import{Image as r}from"../../ui/image.mjs";import{InfiniteScroll as i}from"../../ui/infinite-scroll.mjs";import a from"../../../assets/icons/close.mjs";import o from"../../../assets/icons/common/right_arrow.mjs";import s from"../../../assets/icons/detail/min-collection.mjs";import c from"../../../assets/icons/empty/img-empty-nodata.mjs";import l from"../../ui/popup.mjs";import{CollectionCreateModal as u}from"./collection-create-modal.mjs";import d from"../page-loading/index.mjs";import{useCallback as f,useEffect as p,useMemo as m,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{toast as y}from"sonner";import{useTranslations as b}from"next-intl";const x=e(e=>({isOpen:!1,options:null,open:t=>e(e=>({...e,isOpen:!0,options:t})),close:()=>e(e=>({...e,isOpen:!1,options:null}))}),{name:`collection-popup-store`,persist:!1});function S(e){return{id:String(e?.collection_id||``),cover:e?.cover_image||``,title:e?.title||``,contentCount:Number(e?.content_count||0)}}function C(e){let x=b(`components.common.collectionPopup`),{visible:C,mode:w=`favorite`,onClose:T,toCreateCollection:E,onCollect:D}=e,{userInfo:O,userId:k}=t(),[A,j]=h(!0),[M,N]=h([]),[P,F]=h(!0),[I,L]=h(1),[R,z]=h(!1),B=m(()=>String(k||O?.userId||`0`),[k,O?.userId]),V=f(async e=>{if(!B||!e?.reset&&(!P||A&&M.length>0))return;let t=e?.nextPage??I;j(!0);try{let e=await n({page:t,page_size:10});if(e.code!==0){F(!1);return}let r=(e.data?.data?.collections??[]).map(S);N(e=>t===1?r:[...e,...r]),e.data?.data?.has_more===!1||r.length<10?F(!1):(F(!0),L(t+1))}catch(e){console.error(`获取合集列表失败:`,e),F(!1)}finally{j(!1)}},[M.length,P,A,I,10,B]);p(()=>{C&&V()},[V,C]);let[H,U]=h(!0);p(()=>{U(!A&&M.length===0)},[M.length,A]);function W(e){e||T?.()}function G(){if(w===`select`){z(!0);return}E?.()}function K(e){D?.(e),w===`favorite`&&y.message(x(`collectSuccess`))}function q(e){return function(){K(e)}}function J(){return V()}let Y=f(()=>{F(!0),L(1),N([]),V({nextPage:1,reset:!0})},[V]);return v(l,{open:C,onOpenChange:W,showCloseButton:!1,className:`z-[1000] h-[450px] rounded-t-[16px] bg-bg1 p-0 text-text1`,children:[v(`div`,{className:`bg-bg1 h-[450px] pb-[24px] flex flex-col`,children:[v(`div`,{className:`w-full px-[16px] relative`,children:[v(`div`,{className:`w-full h-[60px] flex items-center justify-center`,children:[_(`button`,{type:`button`,className:`cursor-pointer absolute w-[48px] h-[60px] left-0 top-0 flex items-center justify-center focus:outline-none`,onClick:T,children:_(a,{className:`w-[16px] h-[16px] text-text1`})}),_(`div`,{className:`text-[18px] text-text1 font-semibold`,children:x(w===`select`?`selectTitle`:`favoriteToCollectionTitle`)}),w===`select`&&_(`button`,{type:`button`,className:`absolute right-0 top-0 h-[60px] px-[16px] text-[14px] text-theme5 font-semibold`,onClick:G,children:x(`newCollection`)})]}),w===`favorite`&&v(`button`,{type:`button`,className:`cursor-pointer w-full h-[48px] rounded-[16px] px-[12px] border border-solid border-line1 flex items-center justify-between`,onClick:G,children:[v(`div`,{className:`flex items-center`,children:[_(s,{className:`w-[24px] h-[24px]`}),_(`span`,{className:`ml-[8px] text-text1 text-[14px] font-semibold leading-[18px]`,children:x(`createCollection`)})]}),_(o,{className:`text-text2 w-[12px] h-[12px]`})]})]}),_(`div`,{className:`w-full px-[16px] flex-1 h-[0] overflow-y-auto`,children:A?_(d,{}):H?v(`div`,{className:`flex flex-col items-center justify-center py-[48px] text-text2`,children:[_(c,{className:`w-[120px] h-[120px]`}),v(`span`,{className:`mt-[16px] text-[14px]`,children:[x(`noCollections`),`,`,x(`createCollectionHint`)]})]}):v(g,{children:[M.map((e,t)=>v(`button`,{type:`button`,className:`cursor-pointer w-full h-[92px] flex items-center text-left`,onClick:q(e.id),children:[_(`div`,{className:`w-[60px] h-[60px] bg-bg2 rounded-[8px] overflow-hidden relative`,children:e.cover&&_(r,{src:e.cover,fill:!0,objectFit:`cover`,alt:x(`coverAlt`)})}),v(`div`,{className:`ml-[12px] flex flex-col justify-center`,children:[_(`span`,{className:`max-w-[200px] text-text1 text-[18px] leading-[24px] font-semibold line-clamp-1`,children:e.title||``}),v(`span`,{className:`mt-[3px] text-text2 text-[14px]`,children:[e.contentCount||0,x(`postsCountSuffix`)]})]})]},e.id||`collection-${t}`)),M.length>0&&_(i,{loadMore:J,hasMore:P})]})})]}),_(u,{visible:R,onClose:()=>z(!1),onCreated:()=>{z(!1),Y()}})]})}function w(){let{isOpen:e,options:t,close:n}=x();return e?_(C,{visible:e,mode:t?.mode,onClose:()=>{n(),t?.onClose?.()},toCreateCollection:()=>{n(),t?.toCreateCollection?.()},onCollect:e=>{n(),t?.onCollect?.(e)}}):null}var T=class{static show(e){x.getState().open(e)}static clear(){x.getState().close()}};export{C as CollectionPopupComponent,w as CollectionPopupHost,T as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useUserStore as e}from"../../../store/modules/user-store.mjs";import{
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../store/modules/user-store.mjs";import{useRouter as t}from"../../../utils/use-compatible-router.mjs";import{Toaster as n}from"../../ui/sonner.mjs";import{MediaPreview as r}from"../media-preview/index.mjs";import{IntlProvider as i}from"../intl-provider/intl-provider.mjs";import{useEffect as a,useRef as o,useState as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{QueryClient as d,QueryClientProvider as f}from"@tanstack/react-query";import{NuqsAdapter as p}from"nuqs/adapters/next/app";function m(m){let{queryClient:h,intl:g,children:_}=m,[v]=s(()=>new d),y=h??v,b=t(),x=e(e=>e.isLogin&&!!e.token&&!!e.userId),S=o(x);a(()=>{S.current&&!x&&(y.clear(),b.refresh()),S.current=x},[x,y,b]);let C=u(c,{children:[_,l(n,{position:`top-center`}),l(r,{})]});return l(f,{client:y,children:l(p,{children:l(i,{...g,children:C})})})}export{m as FunhubProvider};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../store/modules/user-store.mjs";import{gUserGetUserInfo as t}from"../../../service/generated/client.mjs";import{useRequest as n}from"../../../hooks/query/use-query.mjs";import{useEffect as r}from"react";function i(){let{userId:i,setUserInfo:a}=e(),o={code:0,message:``,data:{}},{data:s}=n([`user-init`,i],()=>i?t({user_id:i}):Promise.resolve(o),{enabled:!!i});return r(()=>{if(!i)return;let e=s?.data;e&&a(e)},[a,i,s]),null}export{i as UserInfoInitializer};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../../ui/button.mjs";import{hashPassword as t}from"../../../../utils/common.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{pUserResetPassword as r,pUserSendResetPasswordEmailCode as i,pUserVerifyResetPasswordEmailCode as a}from"../../../../service/generated/client.mjs";import{getPasswordValidationErrorText as o,validatePasswordPair as ee}from"../../../../utils/password-validator.mjs";import{Box as s}from"../../../ui/box.mjs";import{Drawer as c,DrawerContent as
|
|
2
|
+
"use client";import{Button as e}from"../../../ui/button.mjs";import{hashPassword as t}from"../../../../utils/common.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{pUserResetPassword as r,pUserSendResetPasswordEmailCode as i,pUserVerifyResetPasswordEmailCode as a}from"../../../../service/generated/client.mjs";import{getPasswordValidationErrorText as o,validatePasswordPair as ee}from"../../../../utils/password-validator.mjs";import{Box as s}from"../../../ui/box.mjs";import{Drawer as c,DrawerContent as l,DrawerDescription as te,DrawerHeader as ne,DrawerTitle as u}from"../../../ui/drawer.mjs";import{Text as d}from"../../../ui/text.mjs";import f from"../../../ui/legacy/button.mjs";import{HeaderNav as re}from"../../../common/header-nav/client.mjs";import{EyeIcon as p}from"../../../../assets/icons/eye-icon.mjs";import{EyeOffIcon as m}from"../../../../assets/icons/eye-off-icon.mjs";import h from"../../../ui/legacy/input.mjs";import{useEffect as g,useMemo as _,useRef as v,useState as y}from"react";import{jsx as b,jsxs as x}from"react/jsx-runtime";import{toast as S}from"sonner";import{useTranslations as ie}from"next-intl";function ae(e){let[t,n]=e.split(`@`);return!t||!n?e:`${t.slice(0,3)}***${t.length>3?t.slice(-1):``}@${n}`}function C(C){let w=ie(`components.pages.settings.components`),{open:oe,onOpenChange:T}=C,E=n(e=>e.userInfo),[D,O]=y([,,,,,,].fill(``)),[k,A]=y(0),j=v(null),M=D.includes(``),[N,P]=y(``),F=v(null),[se,I]=y(60),[L,R]=y(!1),z=_(()=>ae(E?.email||``),[E?.email]);async function B(){if(L)return;let e=S.loading(w(`resetPasswordDrawer.sending`));try{let t=await i({user_id:E?.user_id});t.code===0?(S.success(w(`resetPasswordDrawer.codeSentSuccess`),{id:e}),R(!0),I(60),P(``)):S.error(t.message||w(`resetPasswordDrawer.sendFailed`),{id:e})}catch(t){console.error(t),S.error(w(`resetPasswordDrawer.sendFailed`),{id:e})}}function V(){W(e=>e===1?e:e+1)}async function H(){let e=S.loading(w(`resetPasswordDrawer.verifying`));try{P(``);let t=await a({user_id:E?.user_id,email_code:D.join(``)});t.code===0?(S.success(w(`resetPasswordDrawer.verifySuccess`),{id:e}),V()):(P(t.message||w(`resetPasswordDrawer.verifyFailed`)),S.error(t.message||w(`resetPasswordDrawer.verifyFailed`),{id:e}))}catch(t){console.error(t),P(w(`resetPasswordDrawer.verifyFailed`)),S.error(w(`resetPasswordDrawer.verifyFailed`),{id:e})}}g(()=>{if(L)return F.current=setInterval(()=>{I(e=>e<=1?(F.current&&clearInterval(F.current),R(!1),60):e-1)},1e3),()=>{F.current&&clearInterval(F.current)}},[L]);let[U,W]=y(0);g(()=>{U===0&&j.current?.focus()},[U]);let[G,K]=y({password:``,confirmPassword:``}),[q,J]=y(!1),[Y,ce]=y(!1),[X,le]=y(!1),Z=_(()=>ee(G.password,G.confirmPassword),[G.password,G.confirmPassword]),Q=_(()=>o(Z),[Z]),$=_(()=>q||G.password.length===0||G.confirmPassword.length===0||Z.type!==`none`,[q,G.password.length,G.confirmPassword.length,Z.type]);async function ue(){if($)return;let e=S.loading(w(`resetPasswordDrawer.submitting`));try{J(!0);let n=await r({user_id:E?.user_id,password:t(G.password)});n.code===0?(S.success(w(`resetPasswordDrawer.passwordResetSuccess`),{id:e}),K({password:``,confirmPassword:``}),O([,,,,,,].fill(``)),A(0),T(!1)):S.error(n.message||w(`resetPasswordDrawer.resetFailed`),{id:e})}catch(t){console.error(t),S.error(w(`resetPasswordDrawer.resetFailed`),{id:e})}finally{J(!1)}}function de(e){let t=e.target.value.replace(/\D/g,``);if(t.length===0)return;let n=[...D],r=t.split(``),i=k;for(let e of r){if(i>=6)break;n[i]=e,i+=1}O(n),A(Math.min(i,5)),N&&P(``)}function fe(e){if(e.key===`Backspace`){e.preventDefault();let t=[...D];t[k]?t[k]=``:k>0&&(t[k-1]=``,A(k-1)),O(t),N&&P(``);return}e.key===`ArrowLeft`&&k>0&&A(k-1),e.key===`ArrowRight`&&k<5&&A(k+1)}function pe(e){A(e),j.current?.focus()}let me=x(s,{className:`p-6`,children:[x(s,{className:`space-y-[12px]`,children:[b(d,{className:`text-[24px] leading-[32px] font-bold text-text1`,children:`请输入验证码`}),x(s,{className:`flex items-center justify-between gap-[8px]`,children:[x(d,{className:`min-w-0 flex-1 truncate text-[12px] leading-[16px] text-text2`,children:[w(`resetPasswordDrawer.boundEmailNotice`),b(d,{className:`dark:text-white text-white`,children:z}),w(`resetPasswordDrawer.verifyHint`)]}),b(e,{variant:`link`,disabled:L,onClick:B,className:`h-auto shrink-0 rounded-[10px] bg-line1 px-[10px] py-[4px] text-[10px] leading-[12px] text-text1 no-underline hover:no-underline disabled:opacity-60`,children:L?`${w(`resetPasswordDrawer.sendCode`)} (${se}s)`:w(`resetPasswordDrawer.sendCode`)})]})]}),x(s,{className:`mt-[28px]`,children:[x(s,{className:`relative`,children:[b(`input`,{ref:j,type:`text`,inputMode:`numeric`,pattern:`[0-9]*`,value:``,onChange:de,onKeyDown:fe,className:`absolute inset-0 h-full w-full opacity-0 pointer-events-none`,autoComplete:`one-time-code`}),b(s,{className:`flex justify-between gap-[10px]`,children:D.map((e,t)=>b(s,{onClick:()=>pe(t),className:`
|
|
3
3
|
h-[48px] flex-1 rounded-[6px] border-2 flex items-center justify-center cursor-pointer transition-all duration-200
|
|
4
4
|
${N?`border-theme5 bg-line1`:t===k?`border-theme3 bg-theme3/10`:`border-transparent bg-line1`}
|
|
5
|
-
`,children:b(
|
|
5
|
+
`,children:b(d,{className:`text-[24px] leading-none font-semibold text-text1 select-none`,children:e})},`${t}-${e||`empty`}`))})]}),b(s,{className:`min-h-[22px] pt-[8px]`,children:b(d,{className:`text-[12px] leading-[18px] text-theme5`,children:N})}),b(f,{onClick:H,disabled:M,className:`mt-[180px] w-full h-15 !rounded-[30px] !text-[18px] font-bold leading-6.5 bg-theme6 disabled:bg-theme6/40 disabled:text-text3 active:opacity-90 !px-0 !py-0`,children:`提交`})]})]}),he=x(s,{className:`p-6`,children:[b(s,{children:b(d,{className:`text-text2`,children:w(`resetPasswordDrawer.setNewPasswordHint`)})}),x(s,{className:`mt-6 space-y-6`,children:[x(s,{className:`flex relative items-center px-2 rounded-[50px] h-16.5 bg-line1 border ${Q?`border-theme5`:`border-line1`}`,children:[b(h,{value:G.password,onChange:e=>K(t=>({...t,password:e})),placeholder:w(`resetPasswordDrawer.passwordPlaceholder`),type:Y?`text`:`password`,autoComplete:`new-password`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`pr-10`}),b(`button`,{type:`button`,onClick:()=>ce(!Y),className:`absolute right-4 top-1/2 -translate-y-1/2 text-text2 hover:text-text1 transition-colors`,children:b(Y?m:p,{className:`w-5 h-5`})})]}),x(s,{className:`flex relative items-center px-2 rounded-[50px] h-16.5 bg-line1 border ${Z.type===`not-match`?`border-theme5`:`border-line1`}`,children:[b(h,{value:G.confirmPassword,onChange:e=>K(t=>({...t,confirmPassword:e})),placeholder:w(`resetPasswordDrawer.confirmPasswordPlaceholder`),type:X?`text`:`password`,autoComplete:`new-password`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`pr-10`}),b(`button`,{type:`button`,onClick:()=>le(!X),className:`absolute right-4 top-1/2 -translate-y-1/2 text-text2 hover:text-text1 transition-colors`,children:b(X?m:p,{className:`w-5 h-5`})})]}),Q?b(s,{children:b(d,{className:`min-h-[22px] text-[14px] text-theme5 px-[12px]`,children:Q})}):null,b(f,{onClick:ue,disabled:$,className:`w-full h-15 !rounded-[30px] !text-[18px] font-bold leading-6.5 bg-theme6 disabled:bg-theme6/40 disabled:text-text3 active:opacity-90 !px-0 !py-0`,children:w(q?`resetPasswordDrawer.submitting`:`resetPasswordDrawer.resetPassword`)})]})]});return x(c,{open:oe,onOpenChange:T,direction:`right`,handleOnly:!0,children:[x(ne,{className:`hidden`,children:[b(u,{children:w(`resetPasswordDrawer.title`)}),b(te,{children:w(`resetPasswordDrawer.title`)})]}),x(l,{className:`!w-full`,children:[b(re,{onBack:()=>T(!1),title:w(`resetPasswordDrawer.title`)}),U===0&&me,U===1&&he]})]})}export{C as ResetPasswordDrawer};
|
|
@@ -8,7 +8,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
8
8
|
/** buttonVariants 工具定义。 */
|
|
9
9
|
declare const buttonVariants: (props?: ({
|
|
10
10
|
variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
|
|
11
|
-
size?: "default" | "
|
|
11
|
+
size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
12
12
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
13
13
|
/** Button 组件属性。 */
|
|
14
14
|
type ButtonProps = Button.Props & VariantProps<typeof buttonVariants> & {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
-
import
|
|
4
|
+
import Image from "next/image";
|
|
5
5
|
|
|
6
6
|
//#region components/ui/image.d.ts
|
|
7
7
|
/** BaseImageProps 属性定义。 */
|
|
8
|
-
type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof
|
|
8
|
+
type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof Image>, 'className' | 'src' | 'alt' | 'width' | 'height' | 'loading' | 'priority' | 'fill' | 'style'>;
|
|
9
9
|
type CommonImageProps = BaseImageProps & {
|
|
10
10
|
/** 图片地址,支持普通 URL、默认资源路径和加密地址。 */src: string; /** 图片替代文本。 */
|
|
11
11
|
alt?: string; /** 图片类名。 */
|
|
@@ -27,6 +27,6 @@ type ImagePropsWithSize = CommonImageProps & {
|
|
|
27
27
|
/** ImageProps 属性定义。 */
|
|
28
28
|
type ImageProps = ImagePropsWithFill | ImagePropsWithSize;
|
|
29
29
|
/** 图片组件:支持 bnc 解密、默认资源域名拼接与错误占位。 */
|
|
30
|
-
declare function Image(props: ImageProps): react_jsx_runtime0.JSX.Element;
|
|
30
|
+
declare function Image$1(props: ImageProps): react_jsx_runtime0.JSX.Element;
|
|
31
31
|
//#endregion
|
|
32
|
-
export { BaseImageProps, CommonImageProps, Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
|
|
32
|
+
export { BaseImageProps, CommonImageProps, Image$1 as Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funhub/platform",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.145",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"**/*.css"
|
|
@@ -70,30 +70,6 @@
|
|
|
70
70
|
"dist",
|
|
71
71
|
"theme.css"
|
|
72
72
|
],
|
|
73
|
-
"scripts": {
|
|
74
|
-
"dev:web": "next dev",
|
|
75
|
-
"build:web": "next build",
|
|
76
|
-
"prebuild": "pnpm i18n:build",
|
|
77
|
-
"build": "cross-env TSDOWN_ENV=production tsdown",
|
|
78
|
-
"predev": "pnpm i18n:build",
|
|
79
|
-
"dev": "node scripts/dev-with-i18n-watch.mjs",
|
|
80
|
-
"dev:core": "cross-env TSDOWN_ENV=development tsdown --watch",
|
|
81
|
-
"publish:platform": "node scripts/publish-platform.mjs",
|
|
82
|
-
"gen:api": "node ./scripts/generate-from-swagger.cjs",
|
|
83
|
-
"pp": "pnpm publish:platform",
|
|
84
|
-
"start": "next start",
|
|
85
|
-
"prelint": "pnpm i18n:build",
|
|
86
|
-
"lint": "eslint . --fix",
|
|
87
|
-
"pretypecheck": "pnpm i18n:build",
|
|
88
|
-
"typecheck": "tsc --noEmit",
|
|
89
|
-
"i18n:find": "node scripts/i18n-locale-tool.mjs find",
|
|
90
|
-
"i18n:set": "node scripts/i18n-locale-tool.mjs set",
|
|
91
|
-
"i18n:flatten": "node scripts/i18n-flat-sync.mjs flatten",
|
|
92
|
-
"i18n:build": "node scripts/i18n-flat-sync.mjs build",
|
|
93
|
-
"i18n:watch": "node scripts/i18n-flat-sync.mjs watch",
|
|
94
|
-
"i18n:check": "node scripts/i18n-flat-sync.mjs check",
|
|
95
|
-
"pretest": "pnpm i18n:build"
|
|
96
|
-
},
|
|
97
73
|
"peerDependencies": {
|
|
98
74
|
"@tanstack/query-core": ">=5",
|
|
99
75
|
"@tanstack/react-query": ">=5",
|
|
@@ -142,7 +118,6 @@
|
|
|
142
118
|
"zustand": "^5.0.9"
|
|
143
119
|
},
|
|
144
120
|
"devDependencies": {
|
|
145
|
-
"@funhub/eslint-config": "workspace:*",
|
|
146
121
|
"@svgr/webpack": "^8.1.0",
|
|
147
122
|
"@types/crypto-js": "^4.2.2",
|
|
148
123
|
"@types/lodash-es": "^4.17.12",
|
|
@@ -151,6 +126,31 @@
|
|
|
151
126
|
"rollup-plugin-postcss": "^4.0.2",
|
|
152
127
|
"rollup-preserve-directives": "^1.1.3",
|
|
153
128
|
"tsdown": "0.20.3",
|
|
154
|
-
"vite-plugin-svgr": "^4.3.0"
|
|
129
|
+
"vite-plugin-svgr": "^4.3.0",
|
|
130
|
+
"@funhub/eslint-config": "0.0.1"
|
|
131
|
+
},
|
|
132
|
+
"scripts": {
|
|
133
|
+
"dev:web": "next dev",
|
|
134
|
+
"build:web": "next build",
|
|
135
|
+
"prebuild": "pnpm i18n:build",
|
|
136
|
+
"build": "cross-env TSDOWN_ENV=production tsdown",
|
|
137
|
+
"predev": "pnpm i18n:build",
|
|
138
|
+
"dev": "node scripts/dev-with-i18n-watch.mjs",
|
|
139
|
+
"dev:core": "cross-env TSDOWN_ENV=development tsdown --watch",
|
|
140
|
+
"publish:platform": "node scripts/publish-platform.mjs",
|
|
141
|
+
"gen:api": "node ./scripts/generate-from-swagger.cjs",
|
|
142
|
+
"pp": "pnpm publish:platform",
|
|
143
|
+
"start": "next start",
|
|
144
|
+
"prelint": "pnpm i18n:build",
|
|
145
|
+
"lint": "eslint . --fix",
|
|
146
|
+
"pretypecheck": "pnpm i18n:build",
|
|
147
|
+
"typecheck": "tsc --noEmit",
|
|
148
|
+
"i18n:find": "node scripts/i18n-locale-tool.mjs find",
|
|
149
|
+
"i18n:set": "node scripts/i18n-locale-tool.mjs set",
|
|
150
|
+
"i18n:flatten": "node scripts/i18n-flat-sync.mjs flatten",
|
|
151
|
+
"i18n:build": "node scripts/i18n-flat-sync.mjs build",
|
|
152
|
+
"i18n:watch": "node scripts/i18n-flat-sync.mjs watch",
|
|
153
|
+
"i18n:check": "node scripts/i18n-flat-sync.mjs check",
|
|
154
|
+
"pretest": "pnpm i18n:build"
|
|
155
155
|
}
|
|
156
|
-
}
|
|
156
|
+
}
|