@funhub/platform 0.2.3-beta.1 → 0.2.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useRouter as e}from"../../../../../utils/use-compatible-router.mjs";import{Box as t}from"../../../../ui/box.mjs";import{Text as n}from"../../../../ui/text.mjs";import{adaptTextAdProps as r,hasMatchedAds as i}from"../ad-match.mjs";import{useAdProvider as a}from"../ad-provider.mjs";import{textAdInspectorDefaultProps as o}from"./schema.mjs";import{useEffect as s,useMemo as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";const f=`text_ad_list`,p=[{text:`这是第一条文字广告`,jumpUrl:`/search`},{text:`这是第二条文字广告`,jumpUrl:`/search`}];let m=null;function h(e,t){return Array.isArray(e)&&e.length>0?e:t??[]}function g(e,t){return typeof e==`number`&&e>0?e:t}function _(e,t){if(!e)return!1;if(t===`once`)return!0;let n=new Date(e),r=new Date;return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function v(e,t){return _(e.closedAt,t)}function y(){if(m)return m;if(typeof window>`u`)return{};let e=window.localStorage.getItem(f);if(!e)return m={},{};try{let t=JSON.parse(e);return m=t&&typeof t==`object`?t:{},m}catch{return m={},{}}}function b(e){m=e,!(typeof window>`u`)&&window.localStorage.setItem(f,JSON.stringify(e))}function x(e){return y()[e]??{}}function S(e,t){b({...y(),[e]:t})}function C({displayCount:f,items:m,mode:_=`renderer`}){let y=_===`editor`?{displayCount:g(f,o.displayCount),items:h(m,p)}:{displayCount:f,items:m},b=a(),C=e(),w=_===`editor`,[T,E]=l(!1),[D,O]=l(w),[k,A]=l(w),j=c(()=>i(b?.matchData)?r(b?.matchData):{displayCount:y.displayCount,items:y.items},[b?.matchData,y.displayCount,y.items]),
|
|
2
|
+
"use client";import{useRouter as e}from"../../../../../utils/use-compatible-router.mjs";import{Box as t}from"../../../../ui/box.mjs";import{Text as n}from"../../../../ui/text.mjs";import{adaptTextAdProps as r,hasMatchedAds as i}from"../ad-match.mjs";import{useAdProvider as a}from"../ad-provider.mjs";import{textAdInspectorDefaultProps as o}from"./schema.mjs";import{useEffect as s,useMemo as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";const f=`text_ad_list`,p=[{text:`这是第一条文字广告`,jumpUrl:`/search`},{text:`这是第二条文字广告`,jumpUrl:`/search`}];let m=null;function h(e,t){return Array.isArray(e)&&e.length>0?e:t??[]}function g(e,t){return typeof e==`number`&&e>0?e:t}function _(e,t){if(!e)return!1;if(t===`once`)return!0;let n=new Date(e),r=new Date;return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function v(e,t){return _(e.closedAt,t)}function y(){if(m)return m;if(typeof window>`u`)return{};let e=window.localStorage.getItem(f);if(!e)return m={},{};try{let t=JSON.parse(e);return m=t&&typeof t==`object`?t:{},m}catch{return m={},{}}}function b(e){m=e,!(typeof window>`u`)&&window.localStorage.setItem(f,JSON.stringify(e))}function x(e){return y()[e]??{}}function S(e,t){b({...y(),[e]:t})}function C({displayCount:f,items:m,mode:_=`renderer`}){let y=_===`editor`?{displayCount:g(f,o.displayCount),items:h(m,p)}:{displayCount:f,items:m},b=a(),C=e(),w=_===`editor`,[T,E]=l(!1),[D,O]=l(w),[k,A]=l(w),[j,M]=l(0),[N,P]=l(`idle`),F=c(()=>i(b?.matchData)?r(b?.matchData):{displayCount:y.displayCount,items:y.items},[b?.matchData,y.displayCount,y.items]),I=c(()=>{let e=F.items.filter(e=>e.text?.trim());return typeof F.displayCount==`number`?e.slice(0,Math.max(F.displayCount,0)):e},[F]),L=I[j],R=(j+1)%Math.max(I.length,1),z=I.length>1?I[R]:null,B=c(()=>I.map(e=>`${e.text}:${e.jumpUrl||``}`).join(`|`),[I]);if(s(()=>{E(!0)},[]),s(()=>{if(T){if(w){O(!0),A(!0);return}if(!B||!L){O(!1),A(!0);return}O(!v(x(B),`daily`)),A(!0)}},[L,w,T,B]),s(()=>{M(0),P(`idle`)},[B]),s(()=>{if(!D||I.length<=1)return;let e=setInterval(()=>{P(`animating`)},3e3);return()=>clearInterval(e)},[D,I.length]),s(()=>{if(N!==`animating`)return;let e=setTimeout(()=>{M(e=>(e+1)%I.length),P(`idle`)},350);return()=>clearTimeout(e)},[N,I.length]),!L||!w&&(!T||!k||!D))return null;function V(){B&&S(B,{...x(B),closedAt:Date.now()})}function H(e){e.jumpUrl&&C.push(e.jumpUrl)}function U(e){e.stopPropagation(),O(!1),V()}function W(){w||(O(!1),V(),H(L))}return u(t,{className:`w-full`,style:{backgroundColor:`#131313`,padding:`8px 16px`},children:d(t,{className:`relative flex w-full items-center justify-between overflow-hidden cursor-pointer`,style:{minHeight:`40px`,backgroundColor:`#FFE7E7`,padding:`0 8px`},onClick:W,children:[d(t,{className:`flex min-w-0 items-center`,style:{gap:`8px`,width:`280px`},children:[u(t,{className:`shrink-0`,style:{padding:`4px 8px`,borderRadius:`8px`,backgroundColor:`rgba(0, 0, 0, 0.33)`},children:u(n,{className:`flex h-full items-center justify-center text-white`,style:{fontSize:`12px`,lineHeight:`normal`,fontWeight:400},children:`广告`})}),d(t,{className:`relative overflow-hidden`,style:{flex:`1 0 0`,height:`20px`},children:[u(n,{className:`absolute w-full truncate`,style:{color:`#FD4C5E`,fontSize:`14px`,lineHeight:`20px`,fontWeight:400,transform:N===`animating`?`translateY(-100%)`:`translateY(0)`,transition:N===`animating`?`transform 0.35s ease, opacity 0.35s ease`:`none`,opacity:N===`animating`?0:1},children:L.text}),z&&u(n,{className:`absolute w-full truncate`,style:{color:`#FD4C5E`,fontSize:`14px`,lineHeight:`20px`,fontWeight:400,transform:N===`animating`?`translateY(0)`:`translateY(100%)`,transition:N===`animating`?`transform 0.35s ease, opacity 0.35s ease`:`none`,opacity:N===`animating`?1:0},children:z.text})]})]}),d(t,{className:`flex shrink-0 items-center`,style:{gap:`6px`,width:`54px`},children:[u(t,{className:`flex shrink-0 items-center justify-center`,style:{width:`20px`,height:`34px`},children:u(`svg`,{width:`10`,height:`17`,viewBox:`0 0 10 17`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,children:u(`path`,{d:`M1 1L8.5 8.5L1 16`,stroke:`#FD4C5E`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`})})}),d(`button`,{type:`button`,"aria-label":`关闭文字广告`,className:`relative shrink-0 border-none p-0`,style:{width:`17px`,height:`17px`,borderRadius:`999px`,backgroundColor:`#F9A9AE`},onClick:U,children:[u(t,{className:`absolute left-1/2 top-1/2`,style:{width:`9px`,height:`2px`,borderRadius:`999px`,backgroundColor:`#FFFFFF`,transform:`translate(-50%, -50%) rotate(45deg)`}}),u(t,{className:`absolute left-1/2 top-1/2`,style:{width:`9px`,height:`2px`,borderRadius:`999px`,backgroundColor:`#FFFFFF`,transform:`translate(-50%, -50%) rotate(-45deg)`}})]})]})]})})}export{C as TextAd};
|
|
@@ -19,7 +19,7 @@ declare const marqueeMaterial: DefineMaterialOption<typeof MarqueeServer, typeof
|
|
|
19
19
|
}, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
|
|
20
20
|
readonly click: zod.ZodObject<{
|
|
21
21
|
readonly enabled: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
22
|
-
readonly redirectType: zod.ZodOptional<zod.ZodType<"
|
|
22
|
+
readonly redirectType: zod.ZodOptional<zod.ZodType<"content" | "link" | "content_list", unknown, zod_v4_core0.$ZodTypeInternals<"content" | "link" | "content_list", unknown>>> & SchemaHasDefaultValue;
|
|
23
23
|
readonly link: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
|
|
24
24
|
}, zod_v4_core0.$strip> & SchemaHasDefaultValue;
|
|
25
25
|
readonly close: zod.ZodObject<{
|
|
@@ -24,7 +24,7 @@ declare const marqueeInspectorPropsSchema: zod.ZodObject<{
|
|
|
24
24
|
}, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
|
|
25
25
|
readonly click: zod.ZodObject<{
|
|
26
26
|
readonly enabled: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
27
|
-
readonly redirectType: zod.ZodOptional<zod.ZodType<"
|
|
27
|
+
readonly redirectType: zod.ZodOptional<zod.ZodType<"content" | "link" | "content_list", unknown, zod_v4_core0.$ZodTypeInternals<"content" | "link" | "content_list", unknown>>> & SchemaHasDefaultValue;
|
|
28
28
|
readonly link: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
|
|
29
29
|
}, zod_v4_core0.$strip> & SchemaHasDefaultValue;
|
|
30
30
|
readonly close: zod.ZodObject<{
|