@funhub/platform 0.2.17 → 0.2.19

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 (45) hide show
  1. package/dist/common.d.mts +2 -1
  2. package/dist/common.mjs +1 -1
  3. package/dist/components/biz/business/channel-list/client.mjs +1 -1
  4. package/dist/components/biz/business/detail/video-detail-actions/client.mjs +1 -1
  5. package/dist/components/biz/business/header-search/header-avatar-logo-search/client.mjs +1 -1
  6. package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
  7. package/dist/components/biz/business/home-recommend/shared/home-recommend-preview.mjs +1 -1
  8. package/dist/components/biz/business/large-feature-grid/client.mjs +1 -1
  9. package/dist/components/biz/business/marquee/client.mjs +1 -1
  10. package/dist/components/biz/business/nav-bar/variants/basic-nav-bar/runtime/client.mjs +1 -1
  11. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/client.mjs +1 -1
  12. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.mjs +1 -1
  13. package/dist/components/biz/business/shortcut-grid/client.mjs +1 -1
  14. package/dist/components/biz/business/tab-bar/client.mjs +1 -1
  15. package/dist/components/common/analytics-init/index.d.mts +1 -0
  16. package/dist/components/common/analytics-init/page-lifecycle-tracker.d.mts +15 -0
  17. package/dist/components/common/analytics-init/page-lifecycle-tracker.mjs +2 -0
  18. package/dist/components/common/list/waterfall-recommend/waterfall-recommend.mjs +1 -1
  19. package/dist/components/common/tab-bar/index.mjs +1 -1
  20. package/dist/components/pages/(follow)/_components/header-nav/index.mjs +1 -1
  21. package/dist/components/pages/collection-add/page.mjs +1 -1
  22. package/dist/components/pages/collection-create/form.mjs +1 -1
  23. package/dist/components/pages/collection-detail/detail.mjs +1 -1
  24. package/dist/components/pages/edit/page.mjs +1 -1
  25. package/dist/components/pages/feed-series/feed-series-client.mjs +1 -1
  26. package/dist/components/pages/feedback/_components/feedback-form.mjs +1 -1
  27. package/dist/components/pages/fullscreen-feed/page.mjs +1 -1
  28. package/dist/components/pages/home/client.mjs +1 -1
  29. package/dist/components/pages/login/index.mjs +1 -1
  30. package/dist/components/pages/post-detail/post-detail-client.mjs +1 -1
  31. package/dist/components/pages/publish/page-client.mjs +1 -1
  32. package/dist/components/pages/search/page-client.mjs +1 -1
  33. package/dist/components/pages/search/search-result/search-video-info.mjs +1 -1
  34. package/dist/components/pages/search-result/page-client.mjs +1 -1
  35. package/dist/components/pages/settings/_components/settings.mjs +1 -1
  36. package/dist/components/pages/user-follow/_components/post-tab.mjs +1 -1
  37. package/dist/components/pages/video-detail/video-detail-client.mjs +1 -1
  38. package/dist/components/pages/video-list/video-list-client.mjs +1 -1
  39. package/dist/components/ui/badge.d.mts +1 -1
  40. package/dist/components/ui/button.d.mts +1 -1
  41. package/dist/components/ui/image.d.mts +4 -4
  42. package/dist/utils/common.mjs +1 -1
  43. package/dist/utils/tracking.mjs +1 -1
  44. package/package.json +1 -1
  45. package/theme.css +47 -0
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{cn as e}from"../../../utils/cn.mjs";import{pContentGetNewstVideoList as t,pContentGetTopRatedVideoList as n}from"../../../service/generated/client.mjs";import{pContentGetNewstVideoListKey as r,pContentGetTopRatedVideoListKey as i}from"../../../service/generated/tanstack.mjs";import{usePageLifecycle as a}from"../../../utils/tracking.mjs";import{useRouter as o}from"../../../utils/use-compatible-router.mjs";import{Button as s}from"../../ui/button.mjs";import{Box as c}from"../../ui/box.mjs";import{InfiniteScroll as l}from"../../ui/infinite-scroll.mjs";import{Text as u}from"../../ui/text.mjs";import{usePaginated as d}from"../../../hooks/query/use-query.mjs";import f from"../../../assets/icons/left_arrow.mjs";import{getNextVideoListPageParam as p,resolveNextCursor as m}from"./types.mjs";import{VideoListRecommendItem as h}from"./video-list-recommend-item.mjs";import{VideoListSkeleton as g}from"./video-list-skeleton.mjs";import{useEffect as _,useMemo as v,useState as y}from"react";import{jsx as b,jsxs as x}from"react/jsx-runtime";const S=[];function C({title:C=`列表页`,tags:w=S}){let T=o();a(`page_video_list`,`视频列表`);let[E,D]=y(`hot`),O=v(()=>({page_size:10,tags:w.length?w:void 0}),[w]),{data:k,fetchNextPage:A,hasNextPage:j,isPending:M,isFetching:N}=d({key:v(()=>E===`hot`?i(O):r(O),[O,E]),queryFn:async e=>{let r={page_size:10,cursor:e||void 0,tags:w.length?w:void 0},i=(E===`hot`?await n(r):await t(r)).data,a=Array.isArray(i?.videos)?i.videos:[];return{list:a,nextCursor:a.length<10?``:m(i)}},getNextPageParam:p,initialPageParam:``,options:{staleTime:0,refetchOnMount:`always`,refetchOnWindowFocus:!1,refetchOnReconnect:!1}}),P=v(()=>k?.pages?.flatMap(e=>e.list)??[],[k?.pages]),F=(k?.pages?.length??0)>0,I=v(()=>F?j??!1:!0,[F,j]),L=P.length===0&&(!F||M||N);_(()=>{typeof window>`u`||window.scrollTo({top:0,behavior:`auto`})},[E]);function R(){T.back()}let z=v(()=>P.map(e=>{let t=e.id??e.mid??``;return b(h,{item:e,href:`/video/${t}/${e.name??``}`},t)}),[P]);return L?b(g,{}):x(c,{as:`main`,className:`min-h-[100dvh] bg-[linear-gradient(180deg,#160320_0%,#2a0a56_100%)] text-white`,children:[x(c,{className:`sticky top-0 z-20 bg-[linear-gradient(180deg,rgba(22,3,32,0.98)_0%,rgba(22,3,32,0.92)_100%)] px-[16px] pb-[12px] pt-[10px] backdrop-blur-[16px]`,children:[x(c,{as:`header`,className:`flex items-center justify-between`,children:[b(s,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:R,className:`h-[24px] w-[24px] rounded-none p-0 text-white hover:bg-transparent`,children:b(f,{className:`h-[16px] w-[16px]`})}),b(u,{as:`h1`,className:`min-w-0 flex-1 truncate px-[16px] text-center text-[18px] font-medium leading-[22px] text-white`,children:C}),b(c,{className:`h-[24px] w-[24px] shrink-0 opacity-0`,"aria-hidden":!0})]}),x(c,{as:`nav`,className:`mt-[12px] flex gap-[14px]`,children:[b(s,{type:`button`,variant:`ghost`,onClick:()=>D(`hot`),className:e(`h-[28px] min-w-[64px] rounded-[100px] px-[16px] text-[14px] font-normal leading-[20px] text-white`,E===`hot`?`bg-[linear-gradient(90deg,#9756e3_0%,#6c43ee_100%)] shadow-[0_8px_20px_rgba(122,76,255,0.35)] hover:bg-transparent`:`bg-white/20 hover:bg-white/25`),children:`最热`}),b(s,{type:`button`,variant:`ghost`,onClick:()=>D(`latest`),className:e(`h-[28px] min-w-[64px] rounded-[100px] px-[16px] text-[14px] font-normal leading-[20px] text-white`,E===`latest`?`bg-[linear-gradient(90deg,#9756e3_0%,#6c43ee_100%)] shadow-[0_8px_20px_rgba(122,76,255,0.35)] hover:bg-transparent`:`bg-white/20 hover:bg-white/25`),children:`最新`})]})]}),b(l,{loadMore:()=>A().then(()=>void 0),hasMore:I,noMoreText:`没有更多了`,threshold:300,className:`px-[16px] pb-[24px]`,children:b(c,{as:`section`,className:`flex flex-col gap-[16px]`,children:z})},E)]})}export{C as default};
2
+ "use client";import{cn as e}from"../../../utils/cn.mjs";import{pContentGetNewstVideoList as t,pContentGetTopRatedVideoList as n}from"../../../service/generated/client.mjs";import{pContentGetNewstVideoListKey as r,pContentGetTopRatedVideoListKey as i}from"../../../service/generated/tanstack.mjs";import{useRouter as a}from"../../../utils/use-compatible-router.mjs";import{Button as o}from"../../ui/button.mjs";import{Box as s}from"../../ui/box.mjs";import{InfiniteScroll as c}from"../../ui/infinite-scroll.mjs";import{Text as l}from"../../ui/text.mjs";import{usePaginated as u}from"../../../hooks/query/use-query.mjs";import d from"../../../assets/icons/left_arrow.mjs";import{getNextVideoListPageParam as f,resolveNextCursor as p}from"./types.mjs";import{VideoListRecommendItem as m}from"./video-list-recommend-item.mjs";import{VideoListSkeleton as h}from"./video-list-skeleton.mjs";import{useEffect as g,useMemo as _,useState as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";const x=[];function S({title:S=`列表页`,tags:C=x}){let w=a(),[T,E]=v(`hot`),D=_(()=>({page_size:10,tags:C.length?C:void 0}),[C]),{data:O,fetchNextPage:k,hasNextPage:A,isPending:j,isFetching:M}=u({key:_(()=>T===`hot`?i(D):r(D),[D,T]),queryFn:async e=>{let r={page_size:10,cursor:e||void 0,tags:C.length?C:void 0},i=(T===`hot`?await n(r):await t(r)).data,a=Array.isArray(i?.videos)?i.videos:[];return{list:a,nextCursor:a.length<10?``:p(i)}},getNextPageParam:f,initialPageParam:``,options:{staleTime:0,refetchOnMount:`always`,refetchOnWindowFocus:!1,refetchOnReconnect:!1}}),N=_(()=>O?.pages?.flatMap(e=>e.list)??[],[O?.pages]),P=(O?.pages?.length??0)>0,F=_(()=>P?A??!1:!0,[P,A]),I=N.length===0&&(!P||j||M);g(()=>{typeof window>`u`||window.scrollTo({top:0,behavior:`auto`})},[T]);function L(){w.back()}let R=_(()=>N.map(e=>{let t=e.id??e.mid??``;return y(m,{item:e,href:`/video/${t}/${e.name??``}`},t)}),[N]);return I?y(h,{}):b(s,{as:`main`,className:`min-h-[100dvh] bg-[linear-gradient(180deg,#160320_0%,#2a0a56_100%)] text-white`,children:[b(s,{className:`sticky top-0 z-20 bg-[linear-gradient(180deg,rgba(22,3,32,0.98)_0%,rgba(22,3,32,0.92)_100%)] px-[16px] pb-[12px] pt-[10px] backdrop-blur-[16px]`,children:[b(s,{as:`header`,className:`flex items-center justify-between`,children:[y(o,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:L,className:`h-[24px] w-[24px] rounded-none p-0 text-white hover:bg-transparent`,children:y(d,{className:`h-[16px] w-[16px]`})}),y(l,{as:`h1`,className:`min-w-0 flex-1 truncate px-[16px] text-center text-[18px] font-medium leading-[22px] text-white`,children:S}),y(s,{className:`h-[24px] w-[24px] shrink-0 opacity-0`,"aria-hidden":!0})]}),b(s,{as:`nav`,className:`mt-[12px] flex gap-[14px]`,children:[y(o,{type:`button`,variant:`ghost`,onClick:()=>E(`hot`),className:e(`h-[28px] min-w-[64px] rounded-[100px] px-[16px] text-[14px] font-normal leading-[20px] text-white`,T===`hot`?`bg-[linear-gradient(90deg,#9756e3_0%,#6c43ee_100%)] shadow-[0_8px_20px_rgba(122,76,255,0.35)] hover:bg-transparent`:`bg-white/20 hover:bg-white/25`),children:`最热`}),y(o,{type:`button`,variant:`ghost`,onClick:()=>E(`latest`),className:e(`h-[28px] min-w-[64px] rounded-[100px] px-[16px] text-[14px] font-normal leading-[20px] text-white`,T===`latest`?`bg-[linear-gradient(90deg,#9756e3_0%,#6c43ee_100%)] shadow-[0_8px_20px_rgba(122,76,255,0.35)] hover:bg-transparent`:`bg-white/20 hover:bg-white/25`),children:`最新`})]})]}),y(c,{loadMore:()=>k().then(()=>void 0),hasMore:F,noMoreText:`没有更多了`,threshold:300,className:`px-[16px] pb-[24px]`,children:y(s,{as:`section`,className:`flex flex-col gap-[16px]`,children:R})},T)]})}export{S as default};
@@ -6,7 +6,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
6
6
  //#region components/ui/badge.d.ts
7
7
  /** badgeVariants 工具定义。 */
8
8
  declare const badgeVariants: (props?: ({
9
- variant?: "default" | "destructive" | "secondary" | "outline" | "ghost" | "link" | null | undefined;
9
+ variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
10
10
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
11
11
  /** Badge 组件。 */
12
12
  declare function Badge({
@@ -7,7 +7,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
7
7
  //#region components/ui/button.d.ts
8
8
  /** buttonVariants 工具定义。 */
9
9
  declare const buttonVariants: (props?: ({
10
- variant?: "default" | "destructive" | "secondary" | "outline" | "ghost" | "link" | null | undefined;
10
+ variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
11
11
  size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
12
12
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
13
13
  /** Button 组件属性。 */
@@ -1,11 +1,11 @@
1
1
 
2
2
  import * as React from "react";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
- import NextImage from "next/image";
4
+ import Image from "next/image";
5
5
 
6
6
  //#region components/ui/image.d.ts
7
7
  /** BaseImageProps 属性定义。 */
8
- type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof NextImage>, 'className' | 'src' | 'alt' | 'width' | 'height' | 'loading' | 'priority' | 'fill' | 'style'>;
8
+ type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof Image>, 'className' | 'src' | 'alt' | 'width' | 'height' | 'loading' | 'priority' | 'fill' | 'style'>;
9
9
  type CommonImageProps = BaseImageProps & {
10
10
  /** 图片地址,支持普通 URL、默认资源路径和加密地址。 */src: string; /** 图片替代文本。 */
11
11
  alt?: string; /** 图片类名。 */
@@ -27,6 +27,6 @@ type ImagePropsWithSize = CommonImageProps & {
27
27
  /** ImageProps 属性定义。 */
28
28
  type ImageProps = ImagePropsWithFill | ImagePropsWithSize;
29
29
  /** 图片组件:支持 bnc 解密、默认资源域名拼接与错误占位。 */
30
- declare function Image(props: ImageProps): react_jsx_runtime0.JSX.Element;
30
+ declare function Image$1(props: ImageProps): react_jsx_runtime0.JSX.Element;
31
31
  //#endregion
32
- export { BaseImageProps, CommonImageProps, Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
32
+ export { BaseImageProps, CommonImageProps, Image$1 as Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
@@ -1,2 +1,2 @@
1
1
 
2
- import e from"crypto-js";function t(e=8){return Array.from({length:e},()=>Math.random().toString(36)[2]).join(``)}function n(){return typeof window<`u`}function r(){return typeof navigator>`u`?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function i(e){return e==null?`0`:String(e)}function a(e){if(e==null)return 0;if(typeof e==`number`)return e;let t=Number(e);return Number.isNaN(t)?0:t}function o(e){let t=typeof e==`string`?Number(String(e).trim()):Number(e??0);if(!Number.isFinite(t)||t<0)return`0`;let n=Math.floor(t);return n<1e3?String(n):n<1e6?`${(n/1e3).toFixed(1)}k`:`${(n/1e6).toFixed(1)}m`}function s(){return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}function c(e){return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,`0`)}`}function l(e){let t=0,n=0;try{if(e){let[r,i]=e.split(`x`);t=Number.parseInt(r||`0`,10)||0,n=Number.parseInt(i||`0`,10)||0}}catch(e){console.warn(`parseResolution failed`,e)}return{width:t,height:n}}function u(e,t=`yyyy-MM-dd hh:mm`){if(typeof e!=`number`||Number.isNaN(e)||e<0)return``;let n=new Date(e*1e3);if(Number.isNaN(n.getTime()))return``;let r=n.getFullYear().toString(),i=String(n.getMonth()+1).padStart(2,`0`),a=String(n.getDate()).padStart(2,`0`),o=String(n.getHours()).padStart(2,`0`),s=String(n.getMinutes()).padStart(2,`0`);return t.replace(`yyyy`,r).replace(`yy`,r.slice(-2)).replace(`MM`,i).replace(`dd`,a).replace(`hh`,o).replace(`mm`,s)}function d(){return Math.floor(Date.now()/1e3)}const f=/<span class="mention" contenteditable="false" data-id="(\w+)">(.*?)<\/span>/g,p=/<@_user>(\w+)<\/@_user>/g;function m(e){let t=[];if(!e)return t;let n;for(;(n=f.exec(e))!==null;)t.push(n[1]);return t}function h(e){return e?e.replace(f,`<@_user>$1</@_user>`):``}function g(e){let{text:t=``,atUsers:n=[]}=e;return t?t.replace(p,(e,t)=>`<span class="mention" data-id="${t}">@${n.find(e=>e.user_id===t||e.userId===t)?.name||``}</span>`):``}function _(e){return`<span class="mention" contenteditable="false" data-id="${e.user_id}">@${e.name}</span>`}function v(e){return e?e.replace(/<[^>]+>/g,``):``}function y(e,t){let n=null;return((...r)=>{n&&clearTimeout(n),n=setTimeout(()=>e(...r),t)})}async function b(e){try{if(n()){let t=document.cookie.split(`; `).find(t=>t.startsWith(`${e}=`))?.split(`=`)[1];return t?decodeURIComponent(t):``}else{let{cookies:t}=await import(`next/headers`);return(await t()).get(e)?.value??``}}catch(t){return console.error(`获取 Cookie "${e}" 失败:`,t),``}}function x(e,t,n){let r=[`${e}=${encodeURIComponent(t)}`];if(n.expires)r.push(`expires=${n.expires.toUTCString()}`);else if(n.maxAge){let e=new Date(Date.now()+n.maxAge*1e3);r.push(`expires=${e.toUTCString()}`)}return n.path&&r.push(`path=${n.path}`),n.domain&&r.push(`domain=${n.domain}`),n.secure&&r.push(`secure`),n.sameSite&&r.push(`samesite=${n.sameSite}`),r.join(`; `)}function S(e,t,r={}){if(!n())throw Error(`setCookie 只能在客户端环境中使用`);let i={maxAge:360*24*60*60,httpOnly:!1,secure:process.env.NODE_ENV===`production`,sameSite:process.env.NODE_ENV===`production`?`none`:`lax`,path:`/`,...r};try{let n=x(e,t,i);document.cookie=n}catch(t){throw console.error(`设置 Cookie "${e}" 失败:`,t),Error(`无法设置 Cookie: ${t}`)}}function C(e){if(!n())throw Error(`removeCookie 只能在客户端环境中使用`);document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`}function w(t){if(!t||t.length<10)return``;let n=t.length,r=n%5+2,i=t.substring(0,r),a=t.substring(n-r);return e.MD5(`${i}gst#2026!idy_1-16${a}`).toString()}function T(t){return e.SHA256(t).toString(e.enc.Hex)}function E(){let e=window.localStorage.getItem(`user-store`);return e?JSON.parse(e)?.state?.userId:``}function D(e){let t=new URL(window.location.href);Object.entries(e).forEach(([e,n])=>{t.searchParams.set(e,n)}),window.history.replaceState({},``,t.toString())}export{y as debounceFun,o as formatCompactCount,c as formatVideoDuration,w as generateDynamicSign,s as generateUUID,_ as getAtUserElement,b as getCookie,d as getCurrentSecondTime,E as getUserId,T as hashPassword,n as isClient,r as isMobileDevice,i as numToString,l as parseResolution,m as parseTextAtUserIds,t as randomString,C as removeCookie,h as replaceAtUserElement,g as replaceAtUserElementHtmlStr,u as secondToTime,S as setCookie,a as stringToNumber,v as stripHtmlTags,D as updateUrlParams};
2
+ import e from"crypto-js";function t(e=8){return Array.from({length:e},()=>Math.random().toString(36)[2]).join(``)}function n(){return typeof window<`u`}function r(){return typeof navigator>`u`?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function i(e){return e==null?`0`:String(e)}function a(e){if(e==null)return 0;if(typeof e==`number`)return e;let t=Number(e);return Number.isNaN(t)?0:t}function o(e){let t=typeof e==`string`?Number(String(e).trim()):Number(e??0);if(!Number.isFinite(t)||t<0)return`0`;let n=Math.floor(t);return n<1e3?String(n):n<1e6?`${(n/1e3).toFixed(1)}K`:`${(n/1e6).toFixed(1)}M`}function s(){return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}function c(e){return`${Math.floor(e/60)}:${Math.floor(e%60).toString().padStart(2,`0`)}`}function l(e){let t=0,n=0;try{if(e){let[r,i]=e.split(`x`);t=Number.parseInt(r||`0`,10)||0,n=Number.parseInt(i||`0`,10)||0}}catch(e){console.warn(`parseResolution failed`,e)}return{width:t,height:n}}function u(e,t=`yyyy-MM-dd hh:mm`){if(typeof e!=`number`||Number.isNaN(e)||e<0)return``;let n=new Date(e*1e3);if(Number.isNaN(n.getTime()))return``;let r=n.getFullYear().toString(),i=String(n.getMonth()+1).padStart(2,`0`),a=String(n.getDate()).padStart(2,`0`),o=String(n.getHours()).padStart(2,`0`),s=String(n.getMinutes()).padStart(2,`0`);return t.replace(`yyyy`,r).replace(`yy`,r.slice(-2)).replace(`MM`,i).replace(`dd`,a).replace(`hh`,o).replace(`mm`,s)}function d(){return Math.floor(Date.now()/1e3)}const f=/<span class="mention" contenteditable="false" data-id="(\w+)">(.*?)<\/span>/g,p=/<@_user>(\w+)<\/@_user>/g;function m(e){let t=[];if(!e)return t;let n;for(;(n=f.exec(e))!==null;)t.push(n[1]);return t}function h(e){return e?e.replace(f,`<@_user>$1</@_user>`):``}function g(e){let{text:t=``,atUsers:n=[]}=e;return t?t.replace(p,(e,t)=>`<span class="mention" data-id="${t}">@${n.find(e=>e.user_id===t||e.userId===t)?.name||``}</span>`):``}function _(e){return`<span class="mention" contenteditable="false" data-id="${e.user_id}">@${e.name}</span>`}function v(e){return e?e.replace(/<[^>]+>/g,``):``}function y(e,t){let n=null;return((...r)=>{n&&clearTimeout(n),n=setTimeout(()=>e(...r),t)})}async function b(e){try{if(n()){let t=document.cookie.split(`; `).find(t=>t.startsWith(`${e}=`))?.split(`=`)[1];return t?decodeURIComponent(t):``}else{let{cookies:t}=await import(`next/headers`);return(await t()).get(e)?.value??``}}catch(t){return console.error(`获取 Cookie "${e}" 失败:`,t),``}}function x(e,t,n){let r=[`${e}=${encodeURIComponent(t)}`];if(n.expires)r.push(`expires=${n.expires.toUTCString()}`);else if(n.maxAge){let e=new Date(Date.now()+n.maxAge*1e3);r.push(`expires=${e.toUTCString()}`)}return n.path&&r.push(`path=${n.path}`),n.domain&&r.push(`domain=${n.domain}`),n.secure&&r.push(`secure`),n.sameSite&&r.push(`samesite=${n.sameSite}`),r.join(`; `)}function S(e,t,r={}){if(!n())throw Error(`setCookie 只能在客户端环境中使用`);let i={maxAge:360*24*60*60,httpOnly:!1,secure:process.env.NODE_ENV===`production`,sameSite:process.env.NODE_ENV===`production`?`none`:`lax`,path:`/`,...r};try{let n=x(e,t,i);document.cookie=n}catch(t){throw console.error(`设置 Cookie "${e}" 失败:`,t),Error(`无法设置 Cookie: ${t}`)}}function C(e){if(!n())throw Error(`removeCookie 只能在客户端环境中使用`);document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`}function w(t){if(!t||t.length<10)return``;let n=t.length,r=n%5+2,i=t.substring(0,r),a=t.substring(n-r);return e.MD5(`${i}gst#2026!idy_1-16${a}`).toString()}function T(t){return e.SHA256(t).toString(e.enc.Hex)}function E(){let e=window.localStorage.getItem(`user-store`);return e?JSON.parse(e)?.state?.userId:``}function D(e){let t=new URL(window.location.href);Object.entries(e).forEach(([e,n])=>{t.searchParams.set(e,n)}),window.history.replaceState({},``,t.toString())}export{y as debounceFun,o as formatCompactCount,c as formatVideoDuration,w as generateDynamicSign,s as generateUUID,_ as getAtUserElement,b as getCookie,d as getCurrentSecondTime,E as getUserId,T as hashPassword,n as isClient,r as isMobileDevice,i as numToString,l as parseResolution,m as parseTextAtUserIds,t as randomString,C as removeCookie,h as replaceAtUserElement,g as replaceAtUserElementHtmlStr,u as secondToTime,S as setCookie,a as stringToNumber,v as stripHtmlTags,D as updateUrlParams};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{useEffect as e}from"react";function t(e,t,n,r,i){if(typeof window>`u`)return;console.log(`trackPageClick${r}`);let a=n?.pageX??0,o=n?.pageY??0,s=window.innerWidth||1,c=window.innerHeight||1,l={page_key:e,page_name:t,element_name:r,click_page_x:Math.round(a),click_page_y:Math.round(o),click_x_percent:Math.round(a/s*100),click_y_percent:Math.round(o/c*100),screen_width:window.screen.width,screen_height:window.screen.height,recommend_trace_id:``,...i};window.WebSDK?.track?.({event:`page_click`,payload:l}),window.sensors?.track?.(`page_click`,l)}function n(e){if(console.log(`trackrecommend_list_click`,e.page_name),typeof window>`u`)return;let t={recommend_trace_id:``,recommend_id:``,recommend_trace_info:``,...e};window.WebSDK?.track?.({event:`recommend_list_click`,payload:t}),window.sensors?.track?.(`recommend_list_click`,t)}const r=new Set;function i(e){if(typeof window>`u`)return;let t=e.ad_id.split(`,`).map(e=>e.trim()).filter(Boolean),n=(e.creative_id??``).split(`,`).map(e=>e.trim()),i=t.reduce((t,n,i)=>(r.has(`${e.ad_slot_key}::${n}`)||t.push(i),t),[]);if(i.length===0)return;for(let n of i)r.add(`${e.ad_slot_key}::${t[n]}`);let a={...e,ad_id:i.map(e=>t[e]).join(`,`),creative_id:i.map(e=>n[e]??``).join(`,`)};window.WebSDK?.track?.({event:`ad_impression`,payload:a}),window.sensors?.track?.(`ad_impression`,a)}function a(e){typeof window>`u`||(window.WebSDK?.track?.({event:`advertising`,payload:e}),window.sensors?.track?.(`advertising`,e))}function o(e){typeof window>`u`||(console.log(`navigaition`,e.navigation_name),window.WebSDK?.track?.({event:`navigation`,payload:e}),window.sensors?.track?.(`navigation`,e))}function s(e){typeof window>`u`||(window.WebSDK?.track?.({event:`video_event`,payload:e}),window.sensors?.track?.(`video_event`,e))}function c(e){typeof window>`u`||(console.log(`keywordclick`,e.keyword),window.WebSDK?.track?.({event:`keyword_click`,payload:e}),window.sensors?.track?.(`keyword_click`,e))}function l(e){if(typeof window>`u`)return;let t={creative_id:``,...e};window.WebSDK?.track?.({event:`ad_click`,payload:t}),window.sensors?.track?.(`ad_click`,t)}function u(e){if(console.log(`trackPageView`,e.page_name),typeof window>`u`)return;let t={user_type:`normal`,referrer_page_key:``,referrer_page_name:``,page_load_time:0,recommend_trace_id:``,...e};window.WebSDK?.track?.({event:`app_page_view`,payload:t}),window.sensors?.track?.(`app_page_view`,t)}function d(e){typeof window>`u`||(console.log(`[trackPageLifecycle]`,e.page_name),window.WebSDK?.track?.({event:`page_lifecycle`,payload:e}),window.sensors?.track?.(`page_lifecycle`,e))}function f(t,n){e(()=>{let e=Date.now();d({lifecycle_status:`show`,page_key:t,page_name:n,duration:0});let r=setInterval(()=>{document.visibilityState!==`hidden`&&d({lifecycle_status:`show`,page_key:t,page_name:n,duration:Math.floor((Date.now()-e)/1e3)})},600*1e3);return()=>{clearInterval(r)}},[])}export{l as trackAdClick,i as trackAdImpression,a as trackAdvertising,u as trackAppPageView,c as trackKeywordClick,o as trackNavigation,t as trackPageClick,d as trackPageLifecycle,n as trackRecommendListClick,s as trackVideoEvent,f as usePageLifecycle};
2
+ "use client";import{useEffect as e}from"react";function t(e,t,n,r,i){if(typeof window>`u`)return;console.log(`trackPageClick${r}`);let a=n?.pageX??0,o=n?.pageY??0,s=window.innerWidth||1,c=window.innerHeight||1,l={page_key:e,page_name:t,element_name:r,click_page_x:Math.round(a),click_page_y:Math.round(o),click_x_percent:Math.round(a/s*100),click_y_percent:Math.round(o/c*100),screen_width:window.screen.width,screen_height:window.screen.height,recommend_trace_id:``,...i};window.WebSDK?.track?.({event:`page_click`,payload:l}),window.sensors?.track?.(`page_click`,l)}function n(e){if(console.log(`trackrecommend_list_click`,e.page_name),typeof window>`u`)return;let t={recommend_trace_id:``,recommend_id:``,recommend_trace_info:``,...e};window.WebSDK?.track?.({event:`recommend_list_click`,payload:t}),window.sensors?.track?.(`recommend_list_click`,t)}const r=new Set;function i(e){if(typeof window>`u`)return;let t=e.ad_id.split(`,`).map(e=>e.trim()).filter(Boolean),n=(e.creative_id??``).split(`,`).map(e=>e.trim()),i=t.reduce((t,n,i)=>(r.has(`${e.ad_slot_key}::${n}`)||t.push(i),t),[]);if(i.length===0)return;for(let n of i)r.add(`${e.ad_slot_key}::${t[n]}`);let a={...e,ad_id:i.map(e=>t[e]).join(`,`),creative_id:i.map(e=>n[e]??``).join(`,`)};console.log(`[trackAdImpression]`,a.ad_slot_key,a.ad_id),window.WebSDK?.track?.({event:`ad_impression`,payload:a}),window.sensors?.track?.(`ad_impression`,a)}function a(e){typeof window>`u`||(console.log(`[trackAdvertising]`,e.advertising_key,e.event_type),window.WebSDK?.track?.({event:`advertising`,payload:e}),window.sensors?.track?.(`advertising`,e))}function o(e){typeof window>`u`||(console.log(`navigaition`,e.navigation_name),window.WebSDK?.track?.({event:`navigation`,payload:e}),window.sensors?.track?.(`navigation`,e))}function s(e){typeof window>`u`||(console.log(`[trackVideoEvent]`,e.video_behavior_key,e.video_id),window.WebSDK?.track?.({event:`video_event`,payload:e}),window.sensors?.track?.(`video_event`,e))}function c(e){typeof window>`u`||(console.log(`keywordclick`,e.keyword),window.WebSDK?.track?.({event:`keyword_click`,payload:e}),window.sensors?.track?.(`keyword_click`,e))}function l(e){if(typeof window>`u`)return;let t={creative_id:``,...e};console.log(`[trackAdClick]`,t.ad_slot_key,t.ad_id),window.WebSDK?.track?.({event:`ad_click`,payload:t}),window.sensors?.track?.(`ad_click`,t)}function u(e){if(console.log(`trackPageView`,e.page_name),typeof window>`u`)return;let t={user_type:`normal`,referrer_page_key:``,referrer_page_name:``,page_load_time:0,recommend_trace_id:``,...e};window.WebSDK?.track?.({event:`app_page_view`,payload:t}),window.sensors?.track?.(`app_page_view`,t)}function d(e){typeof window>`u`||(console.log(`[trackPageLifecycle]`,e.page_name,e.duration,e.lifecycle_status),window.WebSDK?.track?.({event:`page_lifecycle`,payload:e}),window.sensors?.track?.(`page_lifecycle`,e))}function f(t,n){e(()=>{let e=Date.now();d({lifecycle_status:`show`,page_key:t,page_name:n,duration:0});let r=setInterval(()=>{document.visibilityState!==`hidden`&&d({lifecycle_status:`show`,page_key:t,page_name:n,duration:Math.floor((Date.now()-e)/1e3)})},600*1e3);return()=>{clearInterval(r)}},[])}export{l as trackAdClick,i as trackAdImpression,a as trackAdvertising,u as trackAppPageView,c as trackKeywordClick,o as trackNavigation,t as trackPageClick,d as trackPageLifecycle,n as trackRecommendListClick,s as trackVideoEvent,f as usePageLifecycle};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@funhub/platform",
3
3
  "type": "module",
4
- "version": "0.2.17",
4
+ "version": "0.2.19",
5
5
  "private": false,
6
6
  "sideEffects": [
7
7
  "**/*.css"
package/theme.css CHANGED
@@ -222,3 +222,50 @@
222
222
  --sidebar-border: oklch(1 0 0 / 10%);
223
223
  --sidebar-ring: var(--color-brand-primary);
224
224
  }
225
+
226
+ .no-vw-x-16 {
227
+ padding-left: 16px;
228
+ /* px-to-viewport-ignore */
229
+ padding-right: 16px;
230
+ /* px-to-viewport-ignore */
231
+ }
232
+
233
+ .no-vw-pl-16 {
234
+ padding-left: 16px;
235
+ /* px-to-viewport-ignore */
236
+ }
237
+
238
+ .no-vw-pr-16 {
239
+ padding-right: 16px;
240
+ /* px-to-viewport-ignore */
241
+ }
242
+
243
+ .no-vw-pt-16 {
244
+ padding-top: 16px;
245
+ /* px-to-viewport-ignore */
246
+ }
247
+
248
+ .no-vw-pb-16 {
249
+ padding-bottom: 16px;
250
+ /* px-to-viewport-ignore */
251
+ }
252
+
253
+ .no-vw-ml-16 {
254
+ margin-left: 16px;
255
+ /* px-to-viewport-ignore */
256
+ }
257
+
258
+ .no-vw-mr-16 {
259
+ margin-right: 16px;
260
+ /* px-to-viewport-ignore */
261
+ }
262
+
263
+ .no-vw-mt-16 {
264
+ margin-top: 16px;
265
+ /* px-to-viewport-ignore */
266
+ }
267
+
268
+ .no-vw-mb-16 {
269
+ margin-bottom: 16px;
270
+ /* px-to-viewport-ignore */
271
+ }