@funhub/platform 0.2.4-beta.0 → 0.2.4-beta.1

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,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};
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`},{text:`这是第三条文字广告`,jumpUrl:`/search`},{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};
@@ -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?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
9
+ variant?: "default" | "link" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
10
10
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
11
11
  /** Badge 组件。 */
12
12
  declare function Badge({
@@ -7,8 +7,8 @@ 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?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
11
- size?: "icon" | "default" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
10
+ variant?: "default" | "link" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
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> & {
@@ -34,7 +34,7 @@ type EmptyStateProps = React.ComponentProps<'div'> & {
34
34
  };
35
35
  /** emptyMediaVariants 工具定义。 */
36
36
  declare const emptyMediaVariants: (props?: ({
37
- variant?: "icon" | "default" | null | undefined;
37
+ variant?: "default" | "icon" | null | undefined;
38
38
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
39
39
  /** EmptyMedia 组件。 */
40
40
  declare function EmptyMedia({
@@ -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 Image from "next/image";
4
+ import NextImage from "next/image";
5
5
 
6
6
  //#region components/ui/image.d.ts
7
7
  /** BaseImageProps 属性定义。 */
8
- type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof Image>, 'className' | 'src' | 'alt' | 'width' | 'height' | 'loading' | 'priority' | 'fill' | 'style'>;
8
+ type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof NextImage>, '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$1(props: ImageProps): react_jsx_runtime0.JSX.Element;
30
+ declare function Image(props: ImageProps): react_jsx_runtime0.JSX.Element;
31
31
  //#endregion
32
- export { BaseImageProps, CommonImageProps, Image$1 as Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
32
+ export { BaseImageProps, CommonImageProps, Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
@@ -82,7 +82,7 @@ declare function Item({
82
82
  }: ItemProps): React.ReactElement;
83
83
  /** itemMediaVariants 工具定义。 */
84
84
  declare const itemMediaVariants: (props?: ({
85
- variant?: "icon" | "default" | "image" | null | undefined;
85
+ variant?: "default" | "icon" | "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";
10
9
  input: "input";
11
10
  textarea: "textarea";
12
11
  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";
72
71
  input: "input";
73
72
  textarea: "textarea";
74
73
  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.4-beta.0",
4
+ "version": "0.2.4-beta.1",
5
5
  "private": false,
6
6
  "sideEffects": [
7
7
  "**/*.css"