@funhub/platform 0.2.21 → 0.2.22

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,5 +1,5 @@
1
1
 
2
- "use client";import{trackAdClick as e,trackAdImpression as t,trackAdvertising as n}from"../../../../../utils/tracking.mjs";import{Button as r}from"../../../../ui/button.mjs";import{Image as i}from"../../../../ui/image.mjs";import{Box as a}from"../../../../ui/box.mjs";import{Dialog as o,DialogContent as s}from"../../../../ui/dialog.mjs";import c from"../../../../ui/link.mjs";import l from"../../../../common/video-player/index.mjs";import{adaptPopupAdMaterials as u,hasMatchedAds as d}from"../ad-match.mjs";import{useAdProvider as f}from"../ad-provider.mjs";import{useEffect as p,useMemo as m,useRef as h,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";const y=[{id:`popup-ad-1`,title:`弹窗广告标题`,jumpUrl:`/search`,materialUrl:`/static/components-resource/banner.png`,desc:`这里是弹窗广告描述`}];function b(e,t){return Array.isArray(e)&&e.length>0?e:t??[]}function x(e){return Number(e?.advertiseType)===2&&!!e?.videoUrl}function S(e){return e?.resolution||`1080x1920`}function C({items:C,mode:w=`renderer`,pageKey:T=`home`,pageName:E=`首页`}){let D=f(),O=m(()=>d(D?.matchData)?u(D?.matchData):w===`editor`?b(C,y):C??[],[D?.matchData,w,C]),[k,A]=g(0),[j,M]=g(!1),N=h(null),P=D?.matchData?.advertiseLocationCode||`home_popup`;p(()=>{A(0)},[O]),p(()=>{M(!1)},[k,O]),p(()=>()=>{N.current&&window.clearTimeout(N.current)},[]);let F=O[k],I=x(F);p(()=>{F?.id&&t({page_key:T,page_name:E,ad_slot_key:P,ad_slot_name:`弹窗广告`,ad_id:F.id,ad_type:`pop-ups-600800`})},[F?.id,P,T,E]);function L(){A(e=>e+1)}function R(){j||(M(!0),N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>{N.current=null,L()},260))}function z(e){e||R()}function B(){F?.id&&e({page_key:T,page_name:E,ad_slot_key:P,ad_slot_name:`弹窗广告`,ad_id:F.id,ad_type:`pop-ups-600800`})}function V(){F?.id&&(n({event_type:`close`,advertising_key:P,advertising_name:`弹窗广告`,advertising_id:F.id}),R())}return F?_(o,{open:!0,onOpenChange:z,disablePointerDismissal:!0,children:v(s,{showCloseButton:!1,className:`w-[320px] max-w-[calc(100vw-32px)] border-none bg-transparent p-0 shadow-none`,children:[v(a,{className:`flex flex-col items-center gap-[24px]`,style:{animation:j?`funhub-popup-ad-exit 260ms cubic-bezier(0.4, 0, 0.2, 1) both`:`funhub-popup-ad-enter 420ms cubic-bezier(0.2, 0.9, 0.2, 1) both, funhub-popup-ad-float 3.2s ease-in-out 420ms infinite`,transformOrigin:`center bottom`},children:[_(a,{className:`w-full overflow-hidden rounded-[20px] bg-[#434343]`,style:{boxShadow:`0 18px 48px rgba(0, 0, 0, 0.26)`},onClick:B,children:I?v(a,{className:`w-full bg-black`,children:[_(a,{className:`relative aspect-[9/16] w-full overflow-hidden bg-black`,children:_(l,{plyerId:`popup-ad-${F.id}`,resolution:S(F),poster:F.materialUrl||``,videoUrl:F.videoUrl||``,mergeConfig:{fitVideoSize:`fixWidth`,autoplayMuted:!0}})}),F.jumpUrl?_(a,{className:`p-4 pt-3`,children:_(c,{href:F.jumpUrl,className:`block rounded-[14px] bg-white px-4 py-3 text-center text-sm font-medium text-black`,children:F.title||`查看详情`})}):null]}):_(c,{href:F.jumpUrl,className:`block w-full overflow-hidden bg-[#434343]`,children:_(a,{className:`w-full overflow-hidden bg-[#434343]`,children:_(i,{src:F.materialUrl,alt:F.title||`弹窗广告`,width:1200,height:1600,className:`block w-full h-auto`,unoptimized:!0})})})}),_(r,{type:`button`,"aria-label":`关闭弹窗广告`,variant:`ghost`,size:`icon-lg`,className:`relative h-[54px] w-[54px] rounded-full border-[3px] border-white bg-transparent p-0 text-white hover:bg-white/8`,onClick:V,style:{animation:j?`funhub-popup-ad-close-exit 260ms ease-out both`:`funhub-popup-ad-close-breathe 2.4s ease-in-out 480ms infinite`},children:v(a,{className:`relative h-[24px] w-[24px]`,children:[_(a,{className:`absolute left-1/2 top-1/2 h-[4px] w-full -translate-x-1/2 -translate-y-1/2 rotate-45 rounded-full bg-current`}),_(a,{className:`absolute left-1/2 top-1/2 h-[4px] w-full -translate-x-1/2 -translate-y-1/2 -rotate-45 rounded-full bg-current`})]})})]},F.id),_(`style`,{children:`
2
+ "use client";import{trackAdClick as e,trackAdImpression as t,trackAdvertising as n}from"../../../../../utils/tracking.mjs";import{Button as r}from"../../../../ui/button.mjs";import{Image as i}from"../../../../ui/image.mjs";import{Box as a}from"../../../../ui/box.mjs";import{Dialog as o,DialogContent as s}from"../../../../ui/dialog.mjs";import c from"../../../../ui/link.mjs";import l from"../../../../common/video-player/index.mjs";import{adaptPopupAdMaterials as u,hasMatchedAds as d}from"../ad-match.mjs";import{useAdProvider as f}from"../ad-provider.mjs";import{useEffect as p,useMemo as m,useRef as h,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";const y=[{id:`popup-ad-1`,title:`弹窗广告标题`,jumpUrl:`/search`,materialUrl:`/static/components-resource/banner.png`,desc:`这里是弹窗广告描述`}];function b(e,t){return Array.isArray(e)&&e.length>0?e:t??[]}function x(e){return Number(e?.advertiseType)===2&&!!e?.videoUrl}function S(e){return e?.resolution||`1080x1920`}function C({items:C,mode:w=`renderer`,pageKey:T=`home`,pageName:E=`首页`}){let D=f(),O=m(()=>d(D?.matchData)?u(D?.matchData):w===`editor`?b(C,y):C??[],[D?.matchData,w,C]),[k,A]=g(0),[j,M]=g(!1),N=h(null),P=D?.matchData?.advertiseLocationCode||`home_popup`;p(()=>{A(0)},[O]),p(()=>{M(!1)},[k,O]),p(()=>()=>{N.current&&window.clearTimeout(N.current)},[]);let F=O[k],I=x(F);p(()=>{F?.id&&t({page_key:T,page_name:E,ad_slot_key:P,ad_slot_name:`弹窗广告`,ad_id:F.id,ad_type:`pop-ups-600800`})},[F?.id,P,T,E]);function L(){A(e=>e+1)}function R(){j||(M(!0),N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>{N.current=null,L()},260))}function z(e){e||R()}function B(){F?.id&&e({page_key:T,page_name:E,ad_slot_key:P,ad_slot_name:`弹窗广告`,ad_id:F.id,ad_type:`pop-ups-600800`})}function V(){F?.id&&(n({event_type:`close`,advertising_key:P,advertising_name:`弹窗广告`,advertising_id:F.id}),R())}return F?_(o,{open:!0,onOpenChange:z,disablePointerDismissal:!0,children:v(s,{showCloseButton:!1,className:`w-[320px] max-w-[calc(100vw-32px)] border-none bg-transparent p-0 shadow-none`,children:[v(a,{className:`flex flex-col items-center gap-[24px]`,style:{animation:j?`funhub-popup-ad-exit 260ms cubic-bezier(0.4, 0, 0.2, 1) both`:`funhub-popup-ad-enter 420ms cubic-bezier(0.2, 0.9, 0.2, 1) both, funhub-popup-ad-float 3.2s ease-in-out 420ms infinite`,transformOrigin:`center bottom`},children:[_(a,{className:`w-full overflow-hidden rounded-[20px] bg-[#434343]`,style:{boxShadow:`0 18px 48px rgba(0, 0, 0, 0.26)`},onClick:B,children:I?_(a,{className:`w-full bg-black`,children:v(a,{className:`relative aspect-[9/16] w-full cursor-pointer overflow-hidden bg-black`,children:[_(l,{plyerId:`popup-ad-${F.id}`,resolution:S(F),poster:F.materialUrl||``,videoUrl:F.videoUrl||``,mergeConfig:{fitVideoSize:`fixWidth`,autoplayMuted:!0,controls:!1}}),_(c,{href:F.jumpUrl,"aria-label":F.title||`跳转广告详情`,className:`absolute inset-0 z-10 block`})]})}):_(c,{href:F.jumpUrl,className:`block w-full overflow-hidden bg-[#434343]`,children:_(a,{className:`w-full overflow-hidden bg-[#434343]`,children:_(i,{src:F.materialUrl,alt:F.title||`弹窗广告`,width:1200,height:1600,className:`block w-full h-auto`,unoptimized:!0})})})}),_(r,{type:`button`,"aria-label":`关闭弹窗广告`,variant:`ghost`,size:`icon-lg`,className:`relative h-[54px] w-[54px] rounded-full border-[3px] border-white bg-transparent p-0 text-white hover:bg-white/8`,onClick:V,style:{animation:j?`funhub-popup-ad-close-exit 260ms ease-out both`:`funhub-popup-ad-close-breathe 2.4s ease-in-out 480ms infinite`},children:v(a,{className:`relative h-[24px] w-[24px]`,children:[_(a,{className:`absolute left-1/2 top-1/2 h-[4px] w-full -translate-x-1/2 -translate-y-1/2 rotate-45 rounded-full bg-current`}),_(a,{className:`absolute left-1/2 top-1/2 h-[4px] w-full -translate-x-1/2 -translate-y-1/2 -rotate-45 rounded-full bg-current`})]})})]},F.id),_(`style`,{children:`
3
3
  @keyframes funhub-popup-ad-enter {
4
4
  0% {
5
5
  opacity: 0;
@@ -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.21",
4
+ "version": "0.2.22",
5
5
  "private": false,
6
6
  "sideEffects": [
7
7
  "**/*.css"