@funhub/platform 0.2.1-beta.0 → 0.2.1-beta.2

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
- import{getCookie as e}from"../../../../utils/common.mjs";import{getOrCreateDeviceId as t}from"../../../../utils/device-id.mjs";const n=process.env.NEXT_PUBLIC_APP_CODE||`APP001`;async function r(n){let r=n.userId??await e(`userId`),i=n.deviceId??t();return{...n,userId:r||void 0,deviceId:i||void 0}}function i(e){return e?.trim()||n}function a(e){let t=e?.adExtData;if(!t)return{};try{let e=JSON.parse(t);return typeof e==`object`&&e?e:{}}catch{return{}}}function o(e){return[...e??[]].sort((e,t)=>Number(e?.sort??0)-Number(t?.sort??0))}function s(e){return!!(e?.hit&&Array.isArray(e.materials)&&e.materials.length>0)}function c(e){return o(e?.materials).find(e=>!!(e?.advertiseIcon&&e?.advertiseUrl))}function l(e){let t=c(e);if(t)return{materialUrl:t.advertiseIcon||``,jumpUrl:t.advertiseUrl||``,name:t.advertiseName||``}}function u(e){let t=o(e?.materials).filter(e=>e.advertiseIcon&&e.advertiseUrl).map(e=>({title:a(e).title||e.advertiseName||``,icon:e.advertiseIcon||``,jumpUrl:e.advertiseUrl||``,badgeText:`广告`})).filter(e=>e.title&&e.icon&&e.jumpUrl);return{displayCount:m(e?.config,t.length),items:t}}function d(e){let t=o(e?.materials).map(e=>({text:e.advertiseName||e.advertiseDesc||``,jumpUrl:e.advertiseUrl||``})).filter(e=>e.text);return{displayCount:m(e?.config,t.length),items:t}}function f(e){let t=o(e?.materials).filter(e=>e.advertiseIcon&&e.advertiseUrl),n=t.map(e=>{let t=a(e);return{coverUrl:e.advertiseIcon||``,jumpUrl:e.advertiseUrl||``,title:t.title||e.advertiseName||``}}).filter(e=>e.coverUrl&&e.jumpUrl);return{displayCount:m(e?.config,n.length),switchInterval:h(e?.config,t),styleSize:g(e?.config,t),items:n}}function p(e){return o(e?.materials).map(e=>{let t=a(e);return{id:e.advertiseCode||``,title:t.title||e.advertiseName||``,jumpUrl:e.advertiseUrl||``,materialUrl:e.advertiseIcon||``,desc:e.advertiseDesc||``}}).filter(e=>e.id&&e.materialUrl&&e.jumpUrl)}function m(e,t=0){let n=Number(e?.displayCount??t);return!Number.isFinite(n)||n<=0?t:Math.min(Math.floor(n),t)}function h(e,t){let n=a(t?.[0]),r=Number(e?.switchInterval??n.switchInterval??3e3);return!Number.isFinite(r)||r<=0?3e3:r}function g(e,t){let n=a(t?.[0]),r=String(e?.styleSize??n.styleSize??`large`);return r===`small`||r===`medium`||r===`large`?r:`large`}export{f as adaptBannerAdProps,l as adaptFloatingAdItem,u as adaptIconAdProps,p as adaptPopupAdMaterials,d as adaptTextAdProps,r as buildAdsMatchRequest,c as getFirstMatchedMaterial,s as hasMatchedAds,a as parseAdsMatchExtData,i as resolveAdsAppCode,o as sortAdsMatchMaterials};
2
+ import{getCookie as e}from"../../../../utils/common.mjs";import{getOrCreateDeviceId as t}from"../../../../utils/device-id.mjs";const n=process.env.NEXT_PUBLIC_APP_CODE||`APP001`;async function r(n){let r=n.userId??await e(`userId`),i=n.deviceId??t();return{...n,userId:r||void 0,deviceId:i||void 0}}function i(e){return e?.trim()||n}function a(e){let t=e?.adExtData;if(!t)return{};try{let e=JSON.parse(t);return typeof e==`object`&&e?e:{}}catch{return{}}}function o(e){return[...e??[]].sort((e,t)=>Number(e?.sort??0)-Number(t?.sort??0))}function s(e){return!!(e?.hit&&Array.isArray(e.materials)&&e.materials.length>0)}function c(e){return o(e?.materials).find(e=>!!(e?.advertiseIcon&&e?.advertiseUrl))}function l(e){let t=c(e);if(t)return{materialUrl:t.advertiseIcon||``,jumpUrl:t.advertiseUrl||``,name:t.advertiseName||``}}function u(e){let t=o(e?.materials).filter(e=>e.advertiseIcon&&e.advertiseUrl).map(e=>({title:a(e).title||e.advertiseName||``,icon:e.advertiseIcon||``,jumpUrl:e.advertiseUrl||``,badgeText:`广告`})).filter(e=>e.title&&e.icon&&e.jumpUrl);return{displayCount:m(e?.config,t.length),items:t}}function d(e){let t=o(e?.materials).map(e=>({text:e.advertiseName||e.advertiseDesc||``,jumpUrl:e.advertiseUrl||``})).filter(e=>e.text);return{displayCount:m(e?.config,t.length),items:t}}function f(e){let t=o(e?.materials).filter(e=>e.advertiseIcon&&e.advertiseUrl),n=t.map(e=>{let t=a(e);return{coverUrl:e.advertiseIcon||``,jumpUrl:e.advertiseUrl||``,title:t.title||e.advertiseName||``}}).filter(e=>e.coverUrl&&e.jumpUrl);return{displayCount:m(e?.config,n.length),switchInterval:h(e?.config,t),styleSize:g(e?.config,t),items:n}}function p(e){return o(e?.materials).map(e=>{let t=a(e);return{id:e.advertiseCode||``,title:t.title||e.advertiseName||``,jumpUrl:e.advertiseUrl||``,materialUrl:e.advertiseIcon||``,desc:e.advertiseDesc||``}}).filter(e=>e.id&&e.materialUrl&&e.jumpUrl)}function m(e,t=0){let n=Number(e?.displayCount??t);return!Number.isFinite(n)||n<=0?t:Math.min(Math.floor(n),t)}function h(e,t){let n=a(t?.[0]),r=Number(e?.switchInterval??n.switchInterval??3e3);return!Number.isFinite(r)||r<=0?3e3:r}function g(e,t){let n=a(t?.[0]),r=String(e?.styleSize??n.styleSize??`large`);return r===`700x400`||r===`700x200`||r===`720x150`||r===`720x300`?r:r===`small`?`720x150`:r===`medium`?`700x200`:`700x400`}export{f as adaptBannerAdProps,l as adaptFloatingAdItem,u as adaptIconAdProps,p as adaptPopupAdMaterials,d as adaptTextAdProps,r as buildAdsMatchRequest,c as getFirstMatchedMaterial,s as hasMatchedAds,a as parseAdsMatchExtData,i as resolveAdsAppCode,o as sortAdsMatchMaterials};
@@ -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{Carousel as n,CarouselContent as r,CarouselItem as i}from"../../../../ui/carousel.mjs";import{Text as a}from"../../../../ui/text.mjs";import o from"../../../../ui/link.mjs";import{adaptBannerAdProps as s,hasMatchedAds as c}from"../ad-match.mjs";import{useAdProvider as l}from"../ad-provider.mjs";import{bannerAdInspectorDefaultProps as u}from"./schema.mjs";import d from"clsx";import{useEffect as f,useMemo as p,useRef as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";const v={small:{minHeight:`140px`,aspectRatio:`2.3 / 1`},medium:{minHeight:`180px`,aspectRatio:`2 / 1`},large:{aspectRatio:`7 / 4`}};function y({mode:y=`renderer`,displayCount:b,switchInterval:x=3e3,styleSize:S=`large`,items:C,pointerEventsDisabled:w=!1}){let T=y===`editor`?{...u,displayCount:b,switchInterval:x,styleSize:S,items:C}:{displayCount:b,switchInterval:x,styleSize:S,items:C},E=l(),D=p(()=>c(E?.matchData)?s(E?.matchData):{displayCount:T.displayCount,switchInterval:T.switchInterval,styleSize:T.styleSize,items:T.items},[E?.matchData,T.displayCount,T.items,T.styleSize,T.switchInterval]),[O,k]=h(),[A,j]=h(0),M=m(null),N=p(()=>typeof D.displayCount==`number`?D.items.slice(0,Math.max(D.displayCount,0)):D.items,[D]);if(f(()=>{if(!O||N.length<=1)return;let e=()=>{j(O.selectedScrollSnap())};return O.on(`select`,e),e(),()=>{O.off(`select`,e)}},[O,N.length]),f(()=>{if(!(!O||N.length<=1))return M.current=setInterval(()=>{if(O.canScrollNext()){O.scrollNext();return}O.scrollTo(0)},D.switchInterval??3e3),()=>{M.current&&=(clearInterval(M.current),null)}},[O,D.switchInterval,N.length]),N.length===0)return null;let P=D.styleSize??`large`,F=v[P];return g(t,{as:`section`,className:`w-full px-[12px] py-[12px]`,"aria-label":`Banner 广告`,style:{pointerEvents:w?`none`:void 0},children:_(n,{setApi:k,opts:{align:`start`,loop:N.length>1},className:`w-full`,children:[g(r,{className:`ml-0`,children:N.map((n,r)=>g(i,{className:`pl-0`,children:_(o,{href:n.jumpUrl,className:d(`relative block w-full overflow-hidden bg-white`),style:{minHeight:F.minHeight,aspectRatio:F.aspectRatio,borderRadius:`10px`},children:[g(t,{className:`absolute inset-0`,children:g(e,{src:n.coverUrl,alt:n.title||`Banner 广告`,fill:!0,className:`object-cover object-center`,unoptimized:!0})}),g(t,{className:`absolute inset-x-0 bottom-0`,style:{height:`28%`,background:`linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.8) 100%)`,opacity:.84}}),g(t,{className:`absolute right-0 top-0 overflow-hidden`,style:{width:`56px`,height:`25px`,backgroundColor:`rgba(255, 255, 255, 0.16)`,borderBottomLeftRadius:`8px`},children:g(a,{className:`flex h-full items-center justify-center text-white`,style:{fontSize:`12px`,lineHeight:`normal`,fontWeight:400},children:`广告`})}),n.title?g(a,{className:`absolute line-clamp-2 text-white`,style:{left:`16px`,bottom:`16px`,maxWidth:`calc(100% - 120px)`,fontSize:P===`large`?`14px`:P===`medium`?`26px`:`20px`,lineHeight:`normal`,fontWeight:500},children:n.title}):null]})},`${n.jumpUrl}-${r}`))}),N.length>1?g(t,{className:`pointer-events-none absolute bottom-[18px] right-[16px] z-10 flex items-center gap-[6px]`,children:N.map((e,n)=>g(t,{className:`rounded-full transition-all duration-300`,style:{width:n===A?`16px`:`8px`,height:`8px`,backgroundColor:n===A?`#FFFFFF`:`rgba(255, 255, 255, 0.78)`}},n))}):null]})})}export{y as BannerAd};
2
+ "use client";import{Image as e}from"../../../../ui/image.mjs";import{Box as t}from"../../../../ui/box.mjs";import{Carousel as n,CarouselContent as r,CarouselItem as i}from"../../../../ui/carousel.mjs";import{Text as a}from"../../../../ui/text.mjs";import o from"../../../../ui/link.mjs";import{adaptBannerAdProps as s,hasMatchedAds as c}from"../ad-match.mjs";import{useAdProvider as l}from"../ad-provider.mjs";import{bannerAdInspectorDefaultProps as u}from"./schema.mjs";import d from"clsx";import{useEffect as f,useMemo as p,useRef as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";const v={"700x400":{minHeight:`400px`,aspectRatio:`7 / 4`,titleFontSize:`14px`},"700x200":{minHeight:`200px`,aspectRatio:`7 / 2`,titleFontSize:`14px`},"720x150":{minHeight:`150px`,aspectRatio:`24 / 5`,titleFontSize:`12px`},"720x300":{minHeight:`300px`,aspectRatio:`12 / 5`,titleFontSize:`14px`}};function y(e,t){return Array.isArray(e)&&e.length>0?e:t??[]}function b(e,t){return typeof e==`number`&&e>0?e:t}function x(e,t){return typeof e==`number`&&e>0?e:t}function S(e,t){return e??t}function C({mode:C=`renderer`,displayCount:w,switchInterval:T=3e3,styleSize:E=`700x400`,items:D,pointerEventsDisabled:O=!1}){let k=C===`editor`?{displayCount:b(w,u.displayCount),switchInterval:x(T,u.switchInterval),styleSize:S(E,u.styleSize),items:y(D,u.items)}:{displayCount:w,switchInterval:T,styleSize:E,items:D},A=l(),j=p(()=>c(A?.matchData)?s(A?.matchData):{displayCount:k.displayCount,switchInterval:k.switchInterval,styleSize:k.styleSize,items:k.items},[A?.matchData,k.displayCount,k.items,k.styleSize,k.switchInterval]),[M,N]=h(),[P,F]=h(0),I=m(null),L=p(()=>typeof j.displayCount==`number`?j.items.slice(0,Math.max(j.displayCount,0)):j.items,[j]);if(f(()=>{if(!M||L.length<=1)return;let e=()=>{F(M.selectedScrollSnap())};return M.on(`select`,e),e(),()=>{M.off(`select`,e)}},[M,L.length]),f(()=>{if(!(!M||L.length<=1))return I.current=setInterval(()=>{if(M.canScrollNext()){M.scrollNext();return}M.scrollTo(0)},j.switchInterval??3e3),()=>{I.current&&=(clearInterval(I.current),null)}},[M,j.switchInterval,L.length]),L.length===0)return null;let R=v[j.styleSize??`700x400`];return g(t,{as:`section`,className:`w-full px-[12px] py-[12px]`,"aria-label":`Banner 广告`,style:{pointerEvents:O?`none`:void 0},children:_(n,{setApi:N,opts:{align:`start`,loop:L.length>1},className:`w-full`,children:[g(r,{className:`ml-0`,children:L.map((n,r)=>g(i,{className:`pl-0`,children:_(o,{href:n.jumpUrl,className:d(`relative block w-full overflow-hidden bg-white`),style:{minHeight:R.minHeight,aspectRatio:R.aspectRatio,borderRadius:`10px`},children:[g(t,{className:`absolute inset-0`,children:g(e,{src:n.coverUrl,alt:n.title||`Banner 广告`,fill:!0,className:`object-cover object-center`,unoptimized:!0})}),g(t,{className:`absolute inset-x-0 bottom-0`,style:{height:`28%`,background:`linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.8) 100%)`,opacity:.84}}),g(t,{className:`absolute right-0 top-0 overflow-hidden`,style:{width:`56px`,height:`25px`,backgroundColor:`rgba(255, 255, 255, 0.16)`,borderBottomLeftRadius:`8px`},children:g(a,{className:`flex h-full items-center justify-center text-white`,style:{fontSize:`12px`,lineHeight:`normal`,fontWeight:400},children:`广告`})}),n.title?g(a,{className:`absolute line-clamp-2 text-white`,style:{left:`16px`,bottom:`16px`,maxWidth:`calc(100% - 120px)`,fontSize:R.titleFontSize,lineHeight:`normal`,fontWeight:500},children:n.title}):null]})},`${n.jumpUrl}-${r}`))}),L.length>1?g(t,{className:`pointer-events-none absolute bottom-[18px] right-[16px] z-10 flex items-center gap-[6px]`,children:L.map((e,n)=>g(t,{className:`rounded-full transition-all duration-300`,style:{width:n===P?`16px`:`8px`,height:`8px`,backgroundColor:n===P?`#FFFFFF`:`rgba(255, 255, 255, 0.78)`}},n))}):null]})})}export{C as BannerAd};
@@ -14,7 +14,7 @@ import * as zod_v4_core0 from "zod/v4/core";
14
14
  declare const bannerAdMaterial: DefineMaterialOption<typeof BannerAdServer, typeof BannerAd, zod.ZodObject<{
15
15
  readonly displayCount: zod.ZodNumber & SchemaHasDefaultValue;
16
16
  readonly switchInterval: zod.ZodNumber & SchemaHasDefaultValue;
17
- readonly styleSize: zod.ZodType<"medium" | "small" | "large", unknown, zod_v4_core0.$ZodTypeInternals<"medium" | "small" | "large", unknown>> & SchemaHasDefaultValue;
17
+ readonly styleSize: zod.ZodType<"700x400" | "700x200" | "720x150" | "720x300", unknown, zod_v4_core0.$ZodTypeInternals<"700x400" | "700x200" | "720x150" | "720x300", unknown>> & SchemaHasDefaultValue;
18
18
  readonly items: zod.ZodArray<zod.ZodObject<{
19
19
  coverUrl: zod.ZodString & SchemaHasDefaultValue;
20
20
  jumpUrl: zod.ZodString & SchemaHasDefaultValue;
@@ -8,7 +8,7 @@ import z$1 from "zod";
8
8
  /**
9
9
  * Banner 尺寸选项。
10
10
  */
11
- declare const bannerAdStyleSizeOptions: readonly ["small", "medium", "large"];
11
+ declare const bannerAdStyleSizeOptions: readonly ["700x400", "700x200", "720x150", "720x300"];
12
12
  /**
13
13
  * Banner 广告样式尺寸。
14
14
  */
@@ -36,7 +36,7 @@ interface BannerAdItem {
36
36
  declare const bannerAdInspectorPropsSchema: z$1.ZodObject<{
37
37
  readonly displayCount: z$1.ZodNumber & SchemaHasDefaultValue;
38
38
  readonly switchInterval: z$1.ZodNumber & SchemaHasDefaultValue;
39
- readonly styleSize: z$1.ZodType<"medium" | "small" | "large", unknown, z$1.core.$ZodTypeInternals<"medium" | "small" | "large", unknown>> & SchemaHasDefaultValue;
39
+ readonly styleSize: z$1.ZodType<"700x400" | "700x200" | "720x150" | "720x300", unknown, z$1.core.$ZodTypeInternals<"700x400" | "700x200" | "720x150" | "720x300", unknown>> & SchemaHasDefaultValue;
40
40
  readonly items: z$1.ZodArray<z$1.ZodObject<{
41
41
  coverUrl: z$1.ZodString & SchemaHasDefaultValue;
42
42
  jumpUrl: z$1.ZodString & SchemaHasDefaultValue;
@@ -51,7 +51,7 @@ declare const bannerAdInspectorPropsSchema: z$1.ZodObject<{
51
51
  declare const bannerAdInspectorDefaultProps: {
52
52
  readonly displayCount: number;
53
53
  readonly switchInterval: number;
54
- readonly styleSize: "medium" | "small" | "large";
54
+ readonly styleSize: "700x400" | "700x200" | "720x150" | "720x300";
55
55
  readonly items: {
56
56
  coverUrl: string;
57
57
  jumpUrl: string;
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineComponentPropsSchema as e,getSchemaDefaultProps as t}from"../../../../../utils/schema/schema.mjs";import n from"zod";const r=[`small`,`medium`,`large`],i=e(e=>({displayCount:e.number(1,{label:`轮播数量`,required:!0}).refine(e=>e>=1&&e<=5,`轮播数量必须为 1-5`),switchInterval:e.number(3e3,{label:`轮播切换时间`,required:!0}),styleSize:e.enum(r,`large`,{label:`样式尺寸选择`,required:!0}),items:e.array(n.object({coverUrl:e.string(``,{label:`封面图`,required:!0}),jumpUrl:e.string(``,{label:`跳转链接`,required:!0}),title:e.string(`Banner 广告`,{label:`标题`,required:!1})}),{label:`Banner 列表`,required:!0,defaultValue:[{coverUrl:`/static/components-resource/banner.png`,jumpUrl:`/search`,title:`Banner 广告一`},{coverUrl:`/static/components-resource/banner.png`,jumpUrl:`/search`,title:`Banner 广告二`}]})})),a=t(i);export{a as bannerAdInspectorDefaultProps,i as bannerAdInspectorPropsSchema,r as bannerAdStyleSizeOptions};
2
+ import{defineComponentPropsSchema as e,getSchemaDefaultProps as t}from"../../../../../utils/schema/schema.mjs";import n from"zod";const r=[`700x400`,`700x200`,`720x150`,`720x300`],i=e(e=>({displayCount:e.number(1,{label:`轮播数量`,required:!0}).refine(e=>e>=1&&e<=5,`轮播数量必须为 1-5`),switchInterval:e.number(3e3,{label:`轮播切换时间`,required:!0}),styleSize:e.enum(r,`700x400`,{label:`样式尺寸选择`,required:!0}),items:e.array(n.object({coverUrl:e.string(``,{label:`封面图`,required:!0}),jumpUrl:e.string(``,{label:`跳转链接`,required:!0}),title:e.string(`Banner 广告`,{label:`标题`,required:!1})}),{label:`Banner 列表`,required:!0,defaultValue:[{coverUrl:`/static/components-resource/banner.png`,jumpUrl:`/search`,title:`Banner 广告一`},{coverUrl:`/static/components-resource/banner.png`,jumpUrl:`/search`,title:`Banner 广告二`},{coverUrl:`/static/components-resource/banner.png`,jumpUrl:`/search`,title:`Banner 广告三`},{coverUrl:`/static/components-resource/banner.png`,jumpUrl:`/search`,title:`Banner 广告四`},{coverUrl:`/static/components-resource/banner.png`,jumpUrl:`/search`,title:`Banner 广告五`}]})})),a=t(i);export{a as bannerAdInspectorDefaultProps,i as bannerAdInspectorPropsSchema,r as bannerAdStyleSizeOptions};
@@ -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 n from"../../../../ui/link.mjs";import{adaptFloatingAdItem as r}from"../ad-match.mjs";import{useAdProvider as i}from"../ad-provider.mjs";import{floatingAdInspectorDefaultProps as a}from"./schema.mjs";import{useMemo as o}from"react";import{jsx as s}from"react/jsx-runtime";function c({mode:c=`renderer`,ad:l,materialUrl:u,jumpUrl:d,name:f,bottomOffset:p=100,rightOffset:m=20,pointerEventsDisabled:h=!1,onClick:g}){let _=c===`editor`?{...a,materialUrl:u,jumpUrl:d,name:f}:{materialUrl:u,jumpUrl:d,name:f},v=i(),y=o(()=>{let e=l??{materialUrl:_.materialUrl||``,jumpUrl:_.jumpUrl||``,name:_.name};return r(v?.matchData)??e},[l,v?.matchData,_.jumpUrl,_.materialUrl,_.name]);if(!y.materialUrl||!y.jumpUrl)return null;let b=s(t,{className:`relative flex h-full w-full overflow-hidden`,style:{borderRadius:`8px`},"aria-label":y.name||`悬浮广告`,children:s(t,{className:`absolute inset-0`,children:s(e,{src:y.materialUrl,alt:y.name||`悬浮广告`,fill:!0,className:`object-cover object-center`,unoptimized:!0})})}),x={bottom:`${p}px`,right:`${m}px`,width:`75px`,height:`75px`,pointerEvents:h?`none`:void 0};return g?s(t,{className:`fixed z-50 block cursor-pointer`,style:x,onClick:g,children:b}):s(n,{href:y.jumpUrl,className:`fixed z-50 block`,style:x,children:b})}export{c as FloatingAd};
2
+ "use client";import{Image as e}from"../../../../ui/image.mjs";import{Box as t}from"../../../../ui/box.mjs";import n from"../../../../ui/link.mjs";import{adaptFloatingAdItem as r}from"../ad-match.mjs";import{useAdProvider as i}from"../ad-provider.mjs";import{floatingAdInspectorDefaultProps as a}from"./schema.mjs";import{useMemo as o}from"react";import{jsx as s}from"react/jsx-runtime";function c(e,t){return e&&e.trim()?e:t}function l({mode:l=`renderer`,ad:u,materialUrl:d,jumpUrl:f,name:p,bottomOffset:m=100,rightOffset:h=20,pointerEventsDisabled:g=!1,onClick:_}){let v=l===`editor`?{materialUrl:c(d,a.materialUrl),jumpUrl:c(f,a.jumpUrl),name:c(p,a.name)}:{materialUrl:d,jumpUrl:f,name:p},y=i(),b=o(()=>{let e=u??{materialUrl:v.materialUrl||``,jumpUrl:v.jumpUrl||``,name:v.name};return r(y?.matchData)??e},[u,y?.matchData,v.jumpUrl,v.materialUrl,v.name]);if(!b.materialUrl||!b.jumpUrl)return null;let x=s(t,{className:`relative flex h-full w-full overflow-hidden`,style:{borderRadius:`8px`},"aria-label":b.name||`悬浮广告`,children:s(t,{className:`absolute inset-0`,children:s(e,{src:b.materialUrl,alt:b.name||`悬浮广告`,fill:!0,className:`object-cover object-center`,unoptimized:!0})})}),S={bottom:`${m}px`,right:`${h}px`,width:`75px`,height:`75px`,pointerEvents:g?`none`:void 0};return _?s(t,{className:`fixed z-50 block cursor-pointer`,style:S,onClick:_,children:x}):s(n,{href:b.jumpUrl,className:`fixed z-50 block`,style:S,children:x})}export{l as FloatingAd};
@@ -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"../../../../ui/link.mjs";import{adaptIconAdProps as i,hasMatchedAds as a}from"../ad-match.mjs";import{useAdProvider as o}from"../ad-provider.mjs";import{iconAdInspectorDefaultProps as s}from"./schema.mjs";import{useMemo as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";function d({mode:d=`renderer`,displayCount:f,items:p,pointerEventsDisabled:m=!1}){let h=d===`editor`?{...s,displayCount:f,items:p}:{displayCount:f,items:p},g=o(),_=c(()=>a(g?.matchData)?i(g?.matchData):{displayCount:h.displayCount,items:h.items},[g?.matchData,h.displayCount,h.items]),v=Math.min(Math.max(_.displayCount,0),Math.min(_.items.length,5)),y=_.items.slice(0,v);return y.length===0?null:l(t,{as:`section`,className:`w-full`,"aria-label":`图标广告`,style:{pointerEvents:m?`none`:void 0},children:l(t,{className:`flex overflow-x-auto`,style:{gap:`8px`,padding:`16px 24px`,backgroundColor:`#131313`,alignItems:`center`,justifyContent:y.length>=5?`space-between`:`flex-start`},children:y.map((i,a)=>l(r,{href:i.jumpUrl,className:`block shrink-0`,style:{width:`100px`},children:u(t,{className:`flex flex-col items-center`,style:{gap:`12px`},children:[l(t,{className:`relative overflow-hidden`,style:{width:`100px`,height:`61px`,borderRadius:`10px`,backgroundColor:`#616161`},children:l(e,{src:i.icon,alt:i.title||`图标广告`,fill:!0,className:`object-cover object-center`,unoptimized:!0})}),l(n,{className:`truncate text-center text-white`,style:{width:`100px`,fontSize:`12px`,lineHeight:1,fontWeight:500},children:i.title}),l(t,{className:`flex items-center justify-center`,style:{minWidth:`35px`,padding:`2px 8px`,borderRadius:`4px`,backgroundColor:`rgba(255, 255, 255, 0.33)`},children:l(n,{className:`whitespace-nowrap text-white`,style:{fontSize:`10px`,lineHeight:`normal`,fontWeight:400},children:i.badgeText||`广告`})})]})},`${i.jumpUrl}-${a}`))})})}export{d as IconAd};
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"../../../../ui/link.mjs";import{adaptIconAdProps as i,hasMatchedAds as a}from"../ad-match.mjs";import{useAdProvider as o}from"../ad-provider.mjs";import{iconAdInspectorDefaultProps as s}from"./schema.mjs";import{useMemo as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";function d(e,t){return Array.isArray(e)&&e.length>0?e:t??[]}function f(e,t){return typeof e==`number`&&e>0?e:t}function p({mode:p=`renderer`,displayCount:m,items:h,pointerEventsDisabled:g=!1}){let _=p===`editor`?{displayCount:f(m,s.displayCount),items:d(h,s.items)}:{displayCount:m,items:h},v=o(),y=c(()=>a(v?.matchData)?i(v?.matchData):{displayCount:_.displayCount,items:_.items},[v?.matchData,_.displayCount,_.items]),b=y.displayCount??y.items.length,x=Math.min(Math.max(b,0),Math.min(y.items.length,5)),S=y.items.slice(0,x);return S.length===0?null:l(t,{as:`section`,className:`w-full`,"aria-label":`图标广告`,style:{pointerEvents:g?`none`:void 0},children:l(t,{className:`flex overflow-x-auto`,style:{gap:`8px`,padding:`16px 24px`,backgroundColor:`#131313`,alignItems:`center`,justifyContent:S.length>=5?`space-between`:`flex-start`},children:S.map((i,a)=>l(r,{href:i.jumpUrl,className:`block shrink-0`,style:{width:`100px`},children:u(t,{className:`flex flex-col items-center`,style:{gap:`12px`},children:[l(t,{className:`relative overflow-hidden`,style:{width:`100px`,height:`61px`,borderRadius:`10px`,backgroundColor:`#616161`},children:l(e,{src:i.icon,alt:i.title||`图标广告`,fill:!0,className:`object-cover object-center`,unoptimized:!0})}),l(n,{className:`truncate text-center text-white`,style:{width:`100px`,fontSize:`12px`,lineHeight:1,fontWeight:500},children:i.title}),l(t,{className:`flex items-center justify-center`,style:{minWidth:`35px`,padding:`2px 8px`,borderRadius:`4px`,backgroundColor:`rgba(255, 255, 255, 0.33)`},children:l(n,{className:`whitespace-nowrap text-white`,style:{fontSize:`10px`,lineHeight:`normal`,fontWeight:400},children:i.badgeText||`广告`})})]})},`${i.jumpUrl}-${a}`))})})}export{p as IconAd};
@@ -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`;let p=null;function m(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 h(e,t){return m(e.closedAt,t)}function g(){if(p)return p;if(typeof window>`u`)return{};let e=window.localStorage.getItem(f);if(!e)return p={},{};try{let t=JSON.parse(e);return p=t&&typeof t==`object`?t:{},p}catch{return p={},{}}}function _(e){p=e,!(typeof window>`u`)&&window.localStorage.setItem(f,JSON.stringify(e))}function v(e){return g()[e]??{}}function y(e,t){_({...g(),[e]:t})}function b({displayCount:f,items:p,mode:m=`renderer`}){let g=m===`editor`?{...o,displayCount:f,items:p}:{displayCount:f,items:p},_=a(),b=e(),x=m===`editor`,[S,C]=l(!1),[w,T]=l(x),[E,D]=l(x),O=c(()=>i(_?.matchData)?r(_?.matchData):{displayCount:g.displayCount,items:g.items},[_?.matchData,g.displayCount,g.items]),k=c(()=>{let e=O.items.filter(e=>e.text?.trim());return typeof O.displayCount==`number`?e.slice(0,Math.max(O.displayCount,0)):e},[O]),A=k[0],j=c(()=>k.map(e=>`${e.text}:${e.jumpUrl||``}`).join(`|`),[k]);if(s(()=>{C(!0)},[]),s(()=>{if(S){if(x){T(!0),D(!0);return}if(!j||!A){T(!1),D(!0);return}T(!h(v(j),`daily`)),D(!0)}},[A,x,S,j]),!A||!x&&(!S||!E||!w))return null;function M(){j&&y(j,{...v(j),closedAt:Date.now()})}function N(e){e.jumpUrl&&b.push(e.jumpUrl)}function P(e){e.stopPropagation(),T(!1),M()}function F(){x||(T(!1),M(),N(A))}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:F,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:`广告`})}),u(n,{className:`truncate`,style:{flex:`1 0 0`,color:`#FD4C5E`,fontSize:`14px`,lineHeight:`normal`,fontWeight:400},children:A.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:P,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{b as TextAd};
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`;let p=null;function m(e,t){return Array.isArray(e)&&e.length>0?e:t??[]}function h(e,t){return typeof e==`number`&&e>0?e:t}function g(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 _(e,t){return g(e.closedAt,t)}function v(){if(p)return p;if(typeof window>`u`)return{};let e=window.localStorage.getItem(f);if(!e)return p={},{};try{let t=JSON.parse(e);return p=t&&typeof t==`object`?t:{},p}catch{return p={},{}}}function y(e){p=e,!(typeof window>`u`)&&window.localStorage.setItem(f,JSON.stringify(e))}function b(e){return v()[e]??{}}function x(e,t){y({...v(),[e]:t})}function S({displayCount:f,items:p,mode:g=`renderer`}){let v=g===`editor`?{displayCount:h(f,o.displayCount),items:m(p,o.items)}:{displayCount:f,items:p},y=a(),S=e(),C=g===`editor`,[w,T]=l(!1),[E,D]=l(C),[O,k]=l(C),A=c(()=>i(y?.matchData)?r(y?.matchData):{displayCount:v.displayCount,items:v.items},[y?.matchData,v.displayCount,v.items]),j=c(()=>{let e=A.items.filter(e=>e.text?.trim());return typeof A.displayCount==`number`?e.slice(0,Math.max(A.displayCount,0)):e},[A]),M=j[0],N=c(()=>j.map(e=>`${e.text}:${e.jumpUrl||``}`).join(`|`),[j]);if(s(()=>{T(!0)},[]),s(()=>{if(w){if(C){D(!0),k(!0);return}if(!N||!M){D(!1),k(!0);return}D(!_(b(N),`daily`)),k(!0)}},[M,C,w,N]),!M||!C&&(!w||!O||!E))return null;function P(){N&&x(N,{...b(N),closedAt:Date.now()})}function F(e){e.jumpUrl&&S.push(e.jumpUrl)}function I(e){e.stopPropagation(),D(!1),P()}function L(){C||(D(!1),P(),F(M))}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:L,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:`广告`})}),u(n,{className:`truncate`,style:{flex:`1 0 0`,color:`#FD4C5E`,fontSize:`14px`,lineHeight:`normal`,fontWeight:400},children:M.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:I,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{S as TextAd};
@@ -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" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
11
+ size?: "icon" | "default" | "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> & {
@@ -34,7 +34,7 @@ type EmptyStateProps = React.ComponentProps<'div'> & {
34
34
  };
35
35
  /** emptyMediaVariants 工具定义。 */
36
36
  declare const emptyMediaVariants: (props?: ({
37
- variant?: "default" | "icon" | null | undefined;
37
+ variant?: "icon" | "default" | null | undefined;
38
38
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
39
39
  /** EmptyMedia 组件。 */
40
40
  declare function EmptyMedia({
@@ -82,7 +82,7 @@ declare function Item({
82
82
  }: ItemProps): React.ReactElement;
83
83
  /** itemMediaVariants 工具定义。 */
84
84
  declare const itemMediaVariants: (props?: ({
85
- variant?: "default" | "icon" | "image" | null | undefined;
85
+ variant?: "icon" | "default" | "image" | null | undefined;
86
86
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
87
87
  /** ItemMedia 组件。 */
88
88
  declare function ItemMedia({
@@ -6,10 +6,10 @@ type InspectorFieldOption<T> = Omit<T, 'type'>;
6
6
  declare const stringInspectorFieldSchema: z.ZodObject<{
7
7
  type: z.ZodLiteral<"string">;
8
8
  fieldType: z.ZodOptional<z.ZodEnum<{
9
+ select: "select";
9
10
  input: "input";
10
11
  textarea: "textarea";
11
12
  color: "color";
12
- select: "select";
13
13
  }>>;
14
14
  defaultValue: z.ZodOptional<z.ZodString>;
15
15
  label: z.ZodOptional<z.ZodString>;
@@ -68,10 +68,10 @@ type ObjectInspectorFieldOption = InspectorFieldOption<z.infer<typeof objectInsp
68
68
  declare const componentInspectorFieldMetaSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
69
69
  type: z.ZodLiteral<"string">;
70
70
  fieldType: z.ZodOptional<z.ZodEnum<{
71
+ select: "select";
71
72
  input: "input";
72
73
  textarea: "textarea";
73
74
  color: "color";
74
- select: "select";
75
75
  }>>;
76
76
  defaultValue: z.ZodOptional<z.ZodString>;
77
77
  label: z.ZodOptional<z.ZodString>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@funhub/platform",
3
3
  "type": "module",
4
- "version": "0.2.1-beta.0",
4
+ "version": "0.2.1-beta.2",
5
5
  "private": false,
6
6
  "sideEffects": [
7
7
  "**/*.css"