@anker-in/headless-ui 1.1.9 → 1.1.10
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.
- package/dist/cjs/biz-components/MediaPlayerBase/index.js +1 -1
- package/dist/cjs/biz-components/MediaPlayerBase/index.js.map +3 -3
- package/dist/cjs/biz-components/MediaPlayerSticky/index.js +1 -1
- package/dist/cjs/biz-components/MediaPlayerSticky/index.js.map +2 -2
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.d.ts +4 -0
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +4 -4
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
- package/dist/cjs/components/ExposureDetector.js +1 -1
- package/dist/cjs/components/ExposureDetector.js.map +2 -2
- package/dist/cjs/components/avatar.js +1 -1
- package/dist/cjs/components/avatar.js.map +2 -2
- package/dist/cjs/components/link.d.ts +2 -2
- package/dist/cjs/components/link.js +1 -1
- package/dist/cjs/components/link.js.map +2 -2
- package/dist/cjs/helpers/ScrollLoadVideo.js +1 -1
- package/dist/cjs/helpers/ScrollLoadVideo.js.map +2 -2
- package/dist/cjs/stories/link.stories.d.ts +1 -1
- package/dist/cjs/stories/link.stories.js +1 -1
- package/dist/cjs/stories/link.stories.js.map +1 -1
- package/dist/esm/biz-components/MediaPlayerBase/index.js +1 -1
- package/dist/esm/biz-components/MediaPlayerBase/index.js.map +3 -3
- package/dist/esm/biz-components/MediaPlayerSticky/index.js +1 -1
- package/dist/esm/biz-components/MediaPlayerSticky/index.js.map +2 -2
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.d.ts +4 -0
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +5 -5
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
- package/dist/esm/components/ExposureDetector.js +1 -1
- package/dist/esm/components/ExposureDetector.js.map +2 -2
- package/dist/esm/components/avatar.js +1 -1
- package/dist/esm/components/avatar.js.map +2 -2
- package/dist/esm/components/link.d.ts +2 -2
- package/dist/esm/components/link.js +1 -1
- package/dist/esm/components/link.js.map +2 -2
- package/dist/esm/helpers/ScrollLoadVideo.js +1 -1
- package/dist/esm/helpers/ScrollLoadVideo.js.map +2 -2
- package/dist/esm/stories/link.stories.d.ts +1 -1
- package/dist/esm/stories/link.stories.js +1 -1
- package/dist/esm/stories/link.stories.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/ExposureDetector.tsx"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useRef, type ReactNode } from 'react'\nimport { useExposureDetection, type UseExposureDetectionOptions } from '../hooks/useExposureDetection.js'\n\nexport interface ExposureDetectorProps extends Omit<UseExposureDetectionOptions, 'onExposure'> {\n /**\n * \u5B50\u5143\u7D20\n */\n children: ReactNode\n /**\n * \u66DD\u5149\u56DE\u8C03\u51FD\u6570\n */\n onExposure?: () => void\n /**\n * \u5305\u88C5\u5143\u7D20\u7684\u6807\u7B7E\uFF0C\u9ED8\u8BA4 'div'\n */\n as?: keyof JSX.IntrinsicElements\n /**\n * \u5305\u88C5\u5143\u7D20\u7684 className\n */\n className?: string\n /**\n * \u5305\u88C5\u5143\u7D20\u7684 style\n */\n style?: React.CSSProperties\n}\n\n/**\n * \u66DD\u5149\u68C0\u6D4B\u7EC4\u4EF6\n * \u4F7F\u7528 IntersectionObserver \u68C0\u6D4B\u5B50\u5143\u7D20\u662F\u5426\u81F3\u5C11 50% \u53EF\u89C1\u4E14\u505C\u7559\u65F6\u95F4\u8D85\u8FC7\u6307\u5B9A\u65F6\u95F4\n * \u786E\u4FDD\u5728\u6574\u4E2A\u9875\u9762\u751F\u547D\u5468\u671F\u4E2D\u53EA\u66DD\u5149\u4E00\u6B21\n *\n * @example\n * ```tsx\n * <ExposureDetector\n * exposureKey=\"my-component-1\"\n * threshold={0.5}\n * duration={2000}\n * onExposure={() => {\n * console.log('\u5143\u7D20\u5DF2\u66DD\u5149')\n * }}\n * >\n * <div>\u5185\u5BB9</div>\n * </ExposureDetector>\n * ```\n */\nexport const ExposureDetector: React.FC<ExposureDetectorProps> = ({\n children,\n onExposure,\n exposureKey,\n threshold = 0.5,\n duration = 2000,\n once = true,\n rootMargin = '0px',\n as: Component = 'div',\n className,\n style,\n ...rest\n}) => {\n const elementRef = useRef<HTMLElement>(null)\n\n useExposureDetection(elementRef, {\n exposureKey,\n threshold,\n duration,\n once,\n onExposure,\n rootMargin,\n })\n\n return React.createElement(\n Component,\n {\n ref: elementRef,\n className,\n style,\n ...rest,\n },\n children\n )\n}\n\nexport default ExposureDetector\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAA8C,oBAC9CC,EAAuE,4CA4ChE,MAAMJ,EAAoD,CAAC,CAChE,SAAAK,EACA,WAAAC,EACA,YAAAC,EACA,UAAAC,EAAY,GACZ,SAAAC,EAAW,IACX,KAAAC,EAAO,GACP,WAAAC,EAAa,MACb,GAAIC,EAAY,MAChB,UAAAC,EACA,MAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,KAAa,UAAoB,IAAI,EAE3C,iCAAqBA,EAAY,CAC/B,YAAAT,EACA,UAAAC,EACA,SAAAC,EACA,KAAAC,EACA,WAAAJ,EACA,WAAAK,CACF,CAAC,EAEM,EAAAM,QAAM,cACXL,EACA,CACE,IAAKI,EACL,UAAAH,EACA,MAAAC,EACA,GAAGC,CACL,EACAV,CACF,CACF,EAEA,IAAOJ,EAAQD",
|
|
6
6
|
"names": ["ExposureDetector_exports", "__export", "ExposureDetector", "ExposureDetector_default", "__toCommonJS", "import_react", "import_useExposureDetection", "children", "onExposure", "exposureKey", "threshold", "duration", "once", "rootMargin", "Component", "className", "style", "rest", "elementRef", "React"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var C=Object.create;var c=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var S=(e,t)=>{for(var a in t)c(e,a,{get:t[a],enumerable:!0})},d=(e,t,a,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of F(t))!h.call(e,i)&&i!==a&&c(e,i,{get:()=>t[i],enumerable:!(l=E(t,i))||l.enumerable});return e};var P=(e,t,a)=>(a=e!=null?C(I(e)):{},d(t||!e||!e.__esModule?c(a,"default",{value:e,enumerable:!0}):a,e)),M=e=>d(c({},"__esModule",{value:!0}),e);var W={};S(W,{Avatar:()=>p,AvatarFallback:()=>v,AvatarImage:()=>u});module.exports=M(W);var s=require("react/jsx-runtime"),r=require("react"),b=P(require("fitty")),n=P(require("@radix-ui/react-avatar")),A=require("class-variance-authority"),o=require("../helpers/index.js");const V=(0,A.cva)("tracking transition-colors",{variants:{size:{small:"size-8 text-sm",medium:"size-10 text-xl",large:"size-12 text-2xl"}}}),p=(0,r.forwardRef)(({className:e,textClassName:t,isAdaptation:a=!1,minSize:l=4,maxSize:i=16,children:y,style:R,size:
|
|
1
|
+
"use strict";"use client";var C=Object.create;var c=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var S=(e,t)=>{for(var a in t)c(e,a,{get:t[a],enumerable:!0})},d=(e,t,a,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of F(t))!h.call(e,i)&&i!==a&&c(e,i,{get:()=>t[i],enumerable:!(l=E(t,i))||l.enumerable});return e};var P=(e,t,a)=>(a=e!=null?C(I(e)):{},d(t||!e||!e.__esModule?c(a,"default",{value:e,enumerable:!0}):a,e)),M=e=>d(c({},"__esModule",{value:!0}),e);var W={};S(W,{Avatar:()=>p,AvatarFallback:()=>v,AvatarImage:()=>u});module.exports=M(W);var s=require("react/jsx-runtime"),r=require("react"),b=P(require("fitty")),n=P(require("@radix-ui/react-avatar")),A=require("class-variance-authority"),o=require("../helpers/index.js");const V=(0,A.cva)("tracking transition-colors",{variants:{size:{small:"size-8 text-sm",medium:"size-10 text-xl",large:"size-12 text-2xl"}}}),p=(0,r.forwardRef)(({className:e,textClassName:t,isAdaptation:a=!1,minSize:l=4,maxSize:i=16,children:y,style:R,size:g="small",onClick:x,...N},k)=>{const f=(0,r.useRef)(null),z=m=>{x?.(m)};return(0,r.useEffect)(()=>{let m;return a&&f.current&&(m=(0,b.default)?.(f.current,{minSize:l,maxSize:i})),()=>m?.unsubscribe?.()},[]),(0,s.jsx)(n.Root,{ref:k,onClick:z,className:(0,o.cn)(V({size:g}),"bg-container-secondary-0 text-info-primary relative flex shrink-0 items-center justify-center overflow-hidden rounded-full",e),...R?{style:R}:null,...N,children:a?(0,s.jsx)("span",{className:"bg-muted flex size-full items-center justify-center rounded-full",children:(0,s.jsx)("span",{ref:f,className:(0,o.cn)("px-2",t),children:y})}):y})});p.displayName="Avatar";const u=(0,r.forwardRef)(({className:e,...t},a)=>(0,s.jsx)(n.Image,{ref:a,className:(0,o.cn)("aspect-square size-full",e),loading:"lazy",...t}));u.displayName=n.Image.displayName;const v=(0,r.forwardRef)(({className:e,...t},a)=>(0,s.jsx)(n.Fallback,{ref:a,className:(0,o.cn)("bg-muted flex size-full items-center justify-center rounded-full",e),...t}));v.displayName=n.Fallback.displayName;
|
|
2
2
|
//# sourceMappingURL=avatar.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/avatar.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport React, { useEffect, useRef, forwardRef } from 'react'\nimport fitty from 'fitty'\nimport type { FittyInstance } from 'fitty'\nimport * as AvatarPrimitive from '@radix-ui/react-avatar'\nimport { type VariantProps, cva } from 'class-variance-authority'\nimport { cn } from '../helpers/index.js'\n\n// \u5B9A\u4E49 avatar \u7684\u6837\u5F0F\u53D8\u4F53\nconst avatarVariants = cva('tracking transition-colors', {\n variants: {\n size: {\n small: 'size-8 text-sm', // \u5C0F\n medium: 'size-10 text-xl', // \u4E2D\n large: 'size-12 text-2xl', // \u5927\n },\n },\n})\n\ntype AvatarProps = {\n /** \u5B9A\u4E49\u5B50\u7EC4\u4EF6\u4F5C\u4E3A\u7236\u7EC4\u4EF6\u7684\u7C7B\u578B,\u8BE6\u7EC6\u4F7F\u7528\u65B9\u5F0F\u8BF7\u53C2\u8003radix-ui */\n asChild?: boolean\n /** \u7C7B\u540D*/\n className?: string\n /** \u6837\u5F0F*/\n style?: React.CSSProperties\n /** \u70B9\u51FB\u4E8B\u4EF6*/\n onClick?: Function\n /** \u6587\u672C\u81EA\u9002\u5E94*/\n isAdaptation?: boolean\n /** \u6587\u672C\u81EA\u9002\u5E94\u6700\u5C0F\u5B57\u4F53, \u5F00\u542F\u65F6\u751F\u6548*/\n minSize?: number\n /** \u6587\u672C\u81EA\u9002\u5E94\u6700\u5927\u5B57\u4F53, \u5F00\u542F\u65F6\u751F\u6548*/\n maxSize?: number\n /** \u6587\u672C\u81EA\u9002\u5E94\u7684\u7C7B, \u5F00\u542F\u65F6\u751F\u6548*/\n textClassName?: string\n} & VariantProps<typeof avatarVariants> &\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>\n\nconst Avatar = forwardRef<React.ElementRef<typeof AvatarPrimitive.Root>, AvatarProps>(\n (\n {\n className,\n textClassName,\n isAdaptation = false,\n minSize = 4,\n maxSize = 16,\n children,\n style,\n size = 'small',\n onClick,\n ...props\n },\n ref\n ) => {\n const textRef = useRef<HTMLDivElement>(null)\n // \u70B9\u51FB\u4E8B\u4EF6\n const handleClick = (e: React.MouseEvent<HTMLSpanElement, MouseEvent>) => {\n onClick?.(e)\n }\n\n useEffect(() => {\n let fittyInstance: FittyInstance\n if (isAdaptation && textRef.current) {\n fittyInstance = fitty?.(textRef.current, {\n minSize,\n maxSize,\n })\n }\n return () => fittyInstance?.unsubscribe?.()\n }, [])\n\n return (\n <AvatarPrimitive.Root\n ref={ref}\n onClick={handleClick}\n className={cn(\n avatarVariants({ size }),\n 'bg-container-secondary-0 text-info-primary relative flex shrink-0 items-center justify-center overflow-hidden rounded-full',\n className\n )}\n {...(style ? { style: style } : null)}\n {...props}\n >\n {isAdaptation ? (\n <span className=\"bg-muted flex size-full items-center justify-center rounded-full\">\n <span ref={textRef} className={cn('px-2', textClassName)}>\n {children}\n </span>\n </span>\n ) : (\n children\n )}\n </AvatarPrimitive.Root>\n )\n }\n)\n\nAvatar.displayName = 'Avatar'\n\nconst AvatarImage = forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Image>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Image ref={ref} className={cn('aspect-square size-full', className)} {...props} />\n))\n\nAvatarImage.displayName = AvatarPrimitive.Image.displayName\n\nconst AvatarFallback = forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Fallback>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(({ className, ...props }, ref) => {\n return (\n <AvatarPrimitive.Fallback\n ref={ref}\n className={cn('bg-muted flex size-full items-center justify-center rounded-full', className)}\n {...props}\n />\n )\n})\n\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName\n\nexport { Avatar, AvatarImage, AvatarFallback }\n"],
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,mBAAAC,EAAA,gBAAAC,IAAA,eAAAC,EAAAL,GAuFY,IAAAM,EAAA,6BArFZC,EAAqD,iBACrDC,EAAkB,oBAElBC,EAAiC,qCACjCC,EAAuC,oCACvCC,EAAmB,+BAGnB,MAAMC,KAAiB,OAAI,6BAA8B,CACvD,SAAU,CACR,KAAM,CACJ,MAAO,iBACP,OAAQ,kBACR,MAAO,kBACT,CACF,CACF,CAAC,EAsBKV,KAAS,cACb,CACE,CACE,UAAAW,EACA,cAAAC,EACA,aAAAC,EAAe,GACf,QAAAC,EAAU,EACV,QAAAC,EAAU,GACV,SAAAC,EACA,MAAAC,EACA,KAAAC,EAAO,QACP,QAAAC,EACA,GAAGC,CACL,EACAC,IACG,CACH,MAAMC,KAAU,UAAuB,IAAI,EAErCC,EAAeC,GAAqD,CACxEL,IAAUK,CAAC,CACb,EAEA,sBAAU,IAAM,CACd,IAAIC,EACJ,OAAIZ,GAAgBS,EAAQ,UAC1BG,KAAgB,EAAAC,WAAQJ,EAAQ,QAAS,CACvC,QAAAR,EACA,QAAAC,CACF,CAAC,GAEI,IAAMU,GAAe,cAAc,CAC5C,EAAG,CAAC,CAAC,KAGH,OAAClB,EAAgB,KAAhB,CACC,IAAKc,EACL,QAASE,EACT,aAAW,MACTb,EAAe,CAAE,KAAAQ,CAAK,CAAC,EACvB,6HACAP,CACF,EACC,GAAIM,EAAQ,CAAE,MAAOA,CAAM,EAAI,KAC/B,GAAGG,EAEH,SAAAP,KACC,OAAC,QAAK,UAAU,mEACd,mBAAC,QAAK,IAAKS,EAAS,aAAW,MAAG,OAAQV,CAAa,EACpD,SAAAI,EACH,EACF,EAEAA,EAEJ,CAEJ,CACF,EAEAhB,EAAO,YAAc,SAErB,MAAME,KAAc,cAGlB,CAAC,CAAE,UAAAS,EAAW,GAAGS,CAAM,EAAGC,OAC1B,OAACd,EAAgB,MAAhB,CAAsB,IAAKc,EAAK,aAAW,MAAG,0BAA2BV,CAAS,
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport React, { useEffect, useRef, forwardRef } from 'react'\nimport fitty from 'fitty'\nimport type { FittyInstance } from 'fitty'\nimport * as AvatarPrimitive from '@radix-ui/react-avatar'\nimport { type VariantProps, cva } from 'class-variance-authority'\nimport { cn } from '../helpers/index.js'\n\n// \u5B9A\u4E49 avatar \u7684\u6837\u5F0F\u53D8\u4F53\nconst avatarVariants = cva('tracking transition-colors', {\n variants: {\n size: {\n small: 'size-8 text-sm', // \u5C0F\n medium: 'size-10 text-xl', // \u4E2D\n large: 'size-12 text-2xl', // \u5927\n },\n },\n})\n\ntype AvatarProps = {\n /** \u5B9A\u4E49\u5B50\u7EC4\u4EF6\u4F5C\u4E3A\u7236\u7EC4\u4EF6\u7684\u7C7B\u578B,\u8BE6\u7EC6\u4F7F\u7528\u65B9\u5F0F\u8BF7\u53C2\u8003radix-ui */\n asChild?: boolean\n /** \u7C7B\u540D*/\n className?: string\n /** \u6837\u5F0F*/\n style?: React.CSSProperties\n /** \u70B9\u51FB\u4E8B\u4EF6*/\n onClick?: Function\n /** \u6587\u672C\u81EA\u9002\u5E94*/\n isAdaptation?: boolean\n /** \u6587\u672C\u81EA\u9002\u5E94\u6700\u5C0F\u5B57\u4F53, \u5F00\u542F\u65F6\u751F\u6548*/\n minSize?: number\n /** \u6587\u672C\u81EA\u9002\u5E94\u6700\u5927\u5B57\u4F53, \u5F00\u542F\u65F6\u751F\u6548*/\n maxSize?: number\n /** \u6587\u672C\u81EA\u9002\u5E94\u7684\u7C7B, \u5F00\u542F\u65F6\u751F\u6548*/\n textClassName?: string\n} & VariantProps<typeof avatarVariants> &\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>\n\nconst Avatar = forwardRef<React.ElementRef<typeof AvatarPrimitive.Root>, AvatarProps>(\n (\n {\n className,\n textClassName,\n isAdaptation = false,\n minSize = 4,\n maxSize = 16,\n children,\n style,\n size = 'small',\n onClick,\n ...props\n },\n ref\n ) => {\n const textRef = useRef<HTMLDivElement>(null)\n // \u70B9\u51FB\u4E8B\u4EF6\n const handleClick = (e: React.MouseEvent<HTMLSpanElement, MouseEvent>) => {\n onClick?.(e)\n }\n\n useEffect(() => {\n let fittyInstance: FittyInstance\n if (isAdaptation && textRef.current) {\n fittyInstance = fitty?.(textRef.current, {\n minSize,\n maxSize,\n })\n }\n return () => fittyInstance?.unsubscribe?.()\n }, [])\n\n return (\n <AvatarPrimitive.Root\n ref={ref}\n onClick={handleClick}\n className={cn(\n avatarVariants({ size }),\n 'bg-container-secondary-0 text-info-primary relative flex shrink-0 items-center justify-center overflow-hidden rounded-full',\n className\n )}\n {...(style ? { style: style } : null)}\n {...props}\n >\n {isAdaptation ? (\n <span className=\"bg-muted flex size-full items-center justify-center rounded-full\">\n <span ref={textRef} className={cn('px-2', textClassName)}>\n {children}\n </span>\n </span>\n ) : (\n children\n )}\n </AvatarPrimitive.Root>\n )\n }\n)\n\nAvatar.displayName = 'Avatar'\n\nconst AvatarImage = forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Image>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Image ref={ref} className={cn('aspect-square size-full', className)} loading=\"lazy\" {...props} />\n))\n\nAvatarImage.displayName = AvatarPrimitive.Image.displayName\n\nconst AvatarFallback = forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Fallback>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(({ className, ...props }, ref) => {\n return (\n <AvatarPrimitive.Fallback\n ref={ref}\n className={cn('bg-muted flex size-full items-center justify-center rounded-full', className)}\n {...props}\n />\n )\n})\n\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName\n\nexport { Avatar, AvatarImage, AvatarFallback }\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,mBAAAC,EAAA,gBAAAC,IAAA,eAAAC,EAAAL,GAuFY,IAAAM,EAAA,6BArFZC,EAAqD,iBACrDC,EAAkB,oBAElBC,EAAiC,qCACjCC,EAAuC,oCACvCC,EAAmB,+BAGnB,MAAMC,KAAiB,OAAI,6BAA8B,CACvD,SAAU,CACR,KAAM,CACJ,MAAO,iBACP,OAAQ,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Ae,YAAcM,EAAgB,SAAS",
|
|
6
6
|
"names": ["avatar_exports", "__export", "Avatar", "AvatarFallback", "AvatarImage", "__toCommonJS", "import_jsx_runtime", "import_react", "import_fitty", "AvatarPrimitive", "import_class_variance_authority", "import_helpers", "avatarVariants", "className", "textClassName", "isAdaptation", "minSize", "maxSize", "children", "style", "size", "onClick", "props", "ref", "textRef", "handleClick", "e", "fittyInstance", "fitty"]
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@ import { type VariantProps } from 'class-variance-authority';
|
|
|
4
4
|
import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';
|
|
5
5
|
declare const linkVariants: (props?: ({
|
|
6
6
|
size?: "base" | "lg" | null | undefined;
|
|
7
|
-
variant?: "primary" | "
|
|
7
|
+
variant?: "primary" | "secondary" | null | undefined;
|
|
8
8
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
9
|
type LinkProps = {
|
|
10
10
|
/** 定义子组件作为父组件的类型,详细使用方式请参考radix-ui */
|
|
@@ -39,7 +39,7 @@ declare const Link: React.ForwardRefExoticComponent<{
|
|
|
39
39
|
onClick?: Function;
|
|
40
40
|
} & VariantProps<(props?: ({
|
|
41
41
|
size?: "base" | "lg" | null | undefined;
|
|
42
|
-
variant?: "primary" | "
|
|
42
|
+
variant?: "primary" | "secondary" | null | undefined;
|
|
43
43
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & ComponentPropsWithout<"a", RemovedProps> & React.RefAttributes<HTMLAnchorElement>>;
|
|
44
44
|
export default Link;
|
|
45
45
|
export type { LinkProps };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var P=Object.create;var p=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var E=(e,t)=>{for(var o in t)p(e,o,{get:t[o],enumerable:!0})},f=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of L(t))!g.call(e,r)&&r!==o&&p(e,r,{get:()=>t[r],enumerable:!(i=R(t,r))||i.enumerable});return e};var b=(e,t,o)=>(o=e!=null?P(N(e)):{},f(t||!e||!e.__esModule?p(o,"default",{value:e,enumerable:!0}):o,e)),V=e=>f(p({},"__esModule",{value:!0}),e);var w={};E(w,{default:()=>q});module.exports=V(w);var n=require("react/jsx-runtime"),k=b(require("react")),u=require("@radix-ui/react-slot"),d=require("../helpers/index.js"),h=require("class-variance-authority");const S=(0,h.cva)("tracking hover:text-brand-0 font-bold underline transition-colors",{variants:{size:{base:"text-text-2",lg:"text-text-3"},variant:{
|
|
1
|
+
"use strict";"use client";var P=Object.create;var p=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var E=(e,t)=>{for(var o in t)p(e,o,{get:t[o],enumerable:!0})},f=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of L(t))!g.call(e,r)&&r!==o&&p(e,r,{get:()=>t[r],enumerable:!(i=R(t,r))||i.enumerable});return e};var b=(e,t,o)=>(o=e!=null?P(N(e)):{},f(t||!e||!e.__esModule?p(o,"default",{value:e,enumerable:!0}):o,e)),V=e=>f(p({},"__esModule",{value:!0}),e);var w={};E(w,{default:()=>q});module.exports=V(w);var n=require("react/jsx-runtime"),k=b(require("react")),u=require("@radix-ui/react-slot"),d=require("../helpers/index.js"),h=require("class-variance-authority");const S=(0,h.cva)("tracking hover:text-brand-0 font-bold underline transition-colors",{variants:{size:{base:"text-text-2",lg:"text-text-3"},variant:{secondary:"text-info-secondary hover:text-info-primary",primary:"text-info-primary hover:text-brand-0"}}}),y=k.default.forwardRef(({children:e,size:t="base",variant:o="primary",className:i,asChild:r=!1,href:l,style:m,disabled:a=!1,suffixIcon:s,onClick:x,...v},C)=>(0,n.jsx)(r?u.Slot:"a",{ref:C,onClick:c=>{if(!a&&x?.(c),a||!l){c.preventDefault();return}},href:a?void 0:l,className:(0,d.cn)(S({size:t,variant:o}),i,{"flex items-center":s,"cursor-pointer":!a,"text-info-quaternary cursor-not-allowed hover:text-info-quaternary":a}),...m?{style:m}:null,...v,children:(0,n.jsxs)(n.Fragment,{children:[e,s&&(0,n.jsx)("span",{className:"svg",children:s})]})}));y.displayName="Link";var q=y;
|
|
2
2
|
//# sourceMappingURL=link.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/link.tsx"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React from 'react'\nimport type { ReactNode } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { cn } from '../helpers/index.js'\nimport { type VariantProps, cva } from 'class-variance-authority'\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js'\n\n// \u5B9A\u4E49 link \u7684\u6837\u5F0F\u53D8\u4F53\nconst linkVariants = cva('tracking hover:text-brand-0 font-bold underline transition-colors', {\n variants: {\n size: {\n base: 'text-text-2', // \u4E2D\n lg: 'text-text-3', // \u5927\n },\n variant: {\n secondary: 'text-info-secondary hover:text-info-primary',\n primary: 'text-info-primary hover:text-brand-0',\n },\n },\n})\n// \u5B9A\u4E49\u7EC4\u4EF6\u7C7B\u578B\uFF0C\u7EE7\u627F a \u6807\u7B7E\u6807\u51C6\u5C5E\u6027\ntype LinkElement = React.ElementRef<'a'>\ntype LinkProps = {\n /** \u5B9A\u4E49\u5B50\u7EC4\u4EF6\u4F5C\u4E3A\u7236\u7EC4\u4EF6\u7684\u7C7B\u578B,\u8BE6\u7EC6\u4F7F\u7528\u65B9\u5F0F\u8BF7\u53C2\u8003radix-ui */\n asChild?: boolean\n /** \u7C7B\u540D*/\n className?: string\n /** \u7981\u7528\u94FE\u63A5 */\n disabled?: boolean\n /** \u540E\u7F6E\u56FE\u6807*/\n suffixIcon?: ReactNode\n /** \u8DF3\u8F6C\u94FE\u63A5*/\n href?: string\n /** \u6837\u5F0F*/\n style?: React.CSSProperties\n /** \u70B9\u51FB\u4E8B\u4EF6\uFF0C\u7981\u7528\u72B6\u6001\u65E0\u6CD5\u89E6\u53D1*/\n onClick?: Function\n} & VariantProps<typeof linkVariants> &\n ComponentPropsWithout<'a', RemovedProps>\n\nconst Link = React.forwardRef<LinkElement, LinkProps>(\n (\n {\n children,\n size = 'base',\n variant = 'primary',\n className,\n asChild = false,\n href,\n style,\n disabled = false,\n suffixIcon,\n onClick,\n ...props // \u8FD9\u91CC\u4F1A\u5305\u542B href\u3001target\u3001rel \u7B49\u6807\u51C6 anchor \u5C5E\u6027\n }: LinkProps,\n forwardedRef\n ) => {\n const Comp = asChild ? Slot : 'a'\n\n const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {\n !disabled && onClick?.(event)\n if (disabled || !href) {\n event.preventDefault()\n return\n }\n }\n\n return (\n <Comp\n ref={forwardedRef}\n onClick={handleClick}\n href={disabled ? undefined : href}\n className={cn(linkVariants({ size, variant }), className, {\n 'flex items-center': suffixIcon,\n 'cursor-pointer': !disabled,\n 'text-info-quaternary cursor-not-allowed hover:text-info-quaternary': disabled,\n })}\n {...(style ? { style: style } : null)}\n {...props}\n >\n <>\n {children}\n {suffixIcon && <span className=\"svg\">{suffixIcon}</span>}\n </>\n </Comp>\n )\n }\n)\nLink.displayName = 'Link'\n\nexport default Link\nexport type { LinkProps }\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAiFQ,IAAAI,EAAA,6BAhFRC,EAAkB,oBAElBC,EAAqB,gCACrBC,EAAmB,+BACnBC,EAAuC,oCAIvC,MAAMC,KAAe,OAAI,qEAAsE,CAC7F,SAAU,CACR,KAAM,CACJ,KAAM,cACN,GAAI,aACN,EACA,QAAS,CACP,UAAW,8CACX,QAAS,sCACX,CACF,CACF,CAAC,EAqBKC,EAAO,EAAAC,QAAM,WACjB,CACE,CACE,SAAAC,EACA,KAAAC,EAAO,OACP,QAAAC,EAAU,UACV,UAAAC,EACA,QAAAC,EAAU,GACV,KAAAC,EACA,MAAAC,EACA,SAAAC,EAAW,GACX,WAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EACAC,OAaE,OAXWP,EAAU,OAAO,IAW3B,CACC,IAAKO,EACL,QAXiBC,GAA+C,CAElE,GADA,CAACL,GAAYE,IAAUG,CAAK,EACxBL,GAAY,CAACF,EAAM,CACrBO,EAAM,eAAe,EACrB,MACF,CACF,EAMI,KAAML,EAAW,OAAYF,EAC7B,aAAW,MAAGR,EAAa,CAAE,KAAAI,EAAM,QAAAC,CAAQ,CAAC,EAAGC,EAAW,CACxD,oBAAqBK,EACrB,iBAAkB,CAACD,EACnB,qEAAsEA,CACxE,CAAC,EACA,GAAID,EAAQ,CAAE,MAAOA,CAAM,EAAI,KAC/B,GAAGI,EAEJ,gCACG,UAAAV,EACAQ,MAAc,OAAC,QAAK,UAAU,MAAO,SAAAA,EAAW,GACnD,EACF,CAGN,EACAV,EAAK,YAAc,OAEnB,IAAOR,EAAQQ",
|
|
6
6
|
"names": ["link_exports", "__export", "link_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_react_slot", "import_helpers", "import_class_variance_authority", "linkVariants", "Link", "React", "children", "size", "variant", "className", "asChild", "href", "style", "disabled", "suffixIcon", "onClick", "props", "forwardedRef", "event"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var L=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var j=(t,r)=>{for(var d in r)L(t,d,{get:r[d],enumerable:!0})},C=(t,r,d,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of M(r))!T.call(t,i)&&i!==d&&L(t,i,{get:()=>r[i],enumerable:!(u=H(r,i))||u.enumerable});return t};var D=t=>C(L({},"__esModule",{value:!0}),t);var R={};j(R,{default:()=>P});module.exports=D(R);var a=require("react/jsx-runtime"),o=require("react"),s=require("../helpers/utils.js"),E=require("lodash");const
|
|
1
|
+
"use strict";var L=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var j=(t,r)=>{for(var d in r)L(t,d,{get:r[d],enumerable:!0})},C=(t,r,d,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of M(r))!T.call(t,i)&&i!==d&&L(t,i,{get:()=>r[i],enumerable:!(u=H(r,i))||u.enumerable});return t};var D=t=>C(L({},"__esModule",{value:!0}),t);var R={};j(R,{default:()=>P});module.exports=D(R);var a=require("react/jsx-runtime"),o=require("react"),s=require("../helpers/utils.js"),E=require("lodash");const y=new Set,F=({src:t,poster:r,alt:d="Scroll Loaded Video",className:u="",videoWrapperClassName:i="",videoClassName:b="",autoplay:h=!1,muted:N=!0,loop:z=!0,controls:S=!1,playsInline:k=!0,videoRef:f=null,...I})=>{const[m,w]=(0,o.useState)(!1),[n,v]=(0,o.useState)(!1),g=(0,o.useRef)(null),p=(0,o.useRef)(null),l=(0,o.useRef)("");(0,o.useEffect)(()=>{y.has(t)&&(w(!0),v(!0),l.current=t)},[t]),(0,o.useEffect)(()=>{if(n&&m){const e=f?.current||p.current;e&&(e.muted=!0,e.play().catch(c=>{console.warn("\u89C6\u9891\u81EA\u52A8\u64AD\u653E\u5931\u8D25:",c)}))}},[n,m,f]);const V=(0,o.useCallback)(()=>{const e=t;if(!e||l.current===e&&n)return;if(y.has(e)){v(!0),l.current=e;return}l.current=e;const c=document.createElement("video");c.preload="metadata",c.onloadedmetadata=()=>{v(!0),y.add(e)},c.src=e},[n,t]);(0,o.useEffect)(()=>{if(!g.current||n)return;const e=(0,E.debounce)(()=>{if(window.scrollY>10)return w(!0),V(),window.removeEventListener("scroll",e)},100);return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[V,n]);const U=(0,o.useCallback)(()=>{v(!0),l.current&&y.add(l.current);const e=f?.current||p.current;e&&(e.muted=!0,e.play())},[]);return(0,a.jsxs)("div",{ref:g,className:(0,s.cn)("relative size-full",u),children:[r&&(0,a.jsx)("div",{className:(0,s.cn)("absolute inset-0 size-full overflow-hidden transition-opacity duration-500 ease-in-out",i,{"opacity-100":!n,"overflow-visible opacity-0":n}),children:(0,a.jsx)("img",{src:r,alt:d,style:{width:"100%",height:"100%",objectFit:"cover"},className:(0,s.cn)(b),loading:"lazy"})}),(0,a.jsx)("div",{className:(0,s.cn)("size-full transition-opacity duration-500 ease-in-out",{"opacity-100":n,"opacity-0":!n}),style:{visibility:m?"visible":"hidden"},children:m&&(0,a.jsx)("div",{className:(0,s.cn)("relative size-full",i),children:(0,a.jsx)("video",{ref:f||p,src:l.current||t,poster:r,className:(0,s.cn)("size-full object-cover",b),onLoadedMetadata:U,autoPlay:h,muted:N,loop:z,controls:S,playsInline:k,...I},l.current)})})]})};var P=F;
|
|
2
2
|
//# sourceMappingURL=ScrollLoadVideo.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/ScrollLoadVideo.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useEffect, useState, useRef, useCallback } from 'react'\nimport { cn } from '../helpers/utils.js'\nimport { debounce } from 'lodash'\n\n// \u521B\u5EFA\u4E00\u4E2A\u5168\u5C40\u7F13\u5B58\u6765\u5B58\u50A8\u5DF2\u52A0\u8F7D\u7684\u89C6\u9891URL\nconst globalLoadedVideoUrls = new Set<string>()\n\nconst ScrollLoadVideo = ({\n src,\n poster,\n alt = 'Scroll Loaded Video',\n className = '',\n videoWrapperClassName = '',\n videoClassName = '',\n autoplay = false,\n muted = true,\n loop = true,\n controls = false,\n playsInline = true,\n videoRef = null,\n ...attr\n}: {\n src: string\n poster?: string\n alt?: string\n className?: string\n videoWrapperClassName?: string\n videoClassName?: string\n autoplay?: boolean\n muted?: boolean\n loop?: boolean\n controls?: boolean\n playsInline?: boolean\n [key: string]: any\n}) => {\n const [isVideoStartLoad, setIsVideoStartLoad] = useState(false)\n const [isVideoLoaded, setIsVideoLoaded] = useState(false)\n const ref = useRef<HTMLDivElement>(null)\n // \u5185\u90E8\u89C6\u9891\u5F15\u7528\uFF0C\u5982\u679C\u5916\u90E8\u6CA1\u6709\u4F20\u5165 videoRef\n const internalVideoRef = useRef<HTMLVideoElement>(null)\n // \u4FDD\u5B58\u5F53\u524D\u52A0\u8F7D\u7684\u89C6\u9891URL\n const currentVideoUrl = useRef<string>('')\n\n // \u5728\u7EC4\u4EF6\u6302\u8F7D\u65F6\u68C0\u67E5\u89C6\u9891\u662F\u5426\u5DF2\u7ECF\u88AB\u52A0\u8F7D\u8FC7\n useEffect(() => {\n // \u5982\u679C\u89C6\u9891\u5DF2\u7ECF\u88AB\u5168\u5C40\u7F13\u5B58\u8FC7\uFF0C\u76F4\u63A5\u8BBE\u7F6E\u4E3A\u5DF2\u52A0\u8F7D\u72B6\u6001\n if (globalLoadedVideoUrls.has(src)) {\n setIsVideoStartLoad(true)\n setIsVideoLoaded(true)\n currentVideoUrl.current = src\n }\n }, [src])\n\n // \u5F53\u89C6\u9891\u5DF2\u52A0\u8F7D\u4E14\u5DF2\u5F00\u59CB\u52A0\u8F7D\u65F6\uFF0C\u5C1D\u8BD5\u64AD\u653E\u89C6\u9891\n useEffect(() => {\n if (isVideoLoaded && isVideoStartLoad) {\n const videoElement = videoRef?.current || internalVideoRef.current\n if (videoElement) {\n // \u786E\u4FDD\u9759\u97F3\u4EE5\u5141\u8BB8\u81EA\u52A8\u64AD\u653E\n videoElement.muted = true\n // \u5C1D\u8BD5\u64AD\u653E\u89C6\u9891\n videoElement.play().catch((error: unknown) => {\n console.warn('\u89C6\u9891\u81EA\u52A8\u64AD\u653E\u5931\u8D25:', error)\n })\n }\n }\n }, [isVideoLoaded, isVideoStartLoad, videoRef])\n\n // \u9884\u52A0\u8F7D\u89C6\u9891\n const preloadVideo = useCallback(() => {\n const videoUrl = src\n\n if (!videoUrl) return\n\n // \u5982\u679C\u5F53\u524DURL\u5DF2\u7ECF\u662F\u89C6\u9891\u7248\u672C\uFF0C\u65E0\u9700\u91CD\u590D\u52A0\u8F7D\n if (currentVideoUrl.current === videoUrl && isVideoLoaded) {\n return\n }\n\n // \u68C0\u67E5\u662F\u5426\u5DF2\u7ECF\u52A0\u8F7D\u8FC7\u8FD9\u4E2AURL\u7684\u89C6\u9891\u7248\u672C\n if (globalLoadedVideoUrls.has(videoUrl)) {\n setIsVideoLoaded(true)\n currentVideoUrl.current = videoUrl\n return\n }\n\n // \u66F4\u65B0\u5F53\u524D\u89C6\u9891URL\n currentVideoUrl.current = videoUrl\n\n // \u9884\u52A0\u8F7D\u89C6\u9891\n const videoElement = document.createElement('video')\n videoElement.preload = 'metadata'\n videoElement.onloadedmetadata = () => {\n setIsVideoLoaded(true)\n globalLoadedVideoUrls.add(videoUrl)\n }\n videoElement.src = videoUrl\n }, [isVideoLoaded, src])\n\n useEffect(() => {\n if (!ref.current || isVideoLoaded) return\n const scrollHandler = debounce(() => {\n if (window.scrollY > 10) {\n setIsVideoStartLoad(true)\n preloadVideo()\n return window.removeEventListener('scroll', scrollHandler)\n }\n }, 100)\n window.addEventListener('scroll', scrollHandler)\n return () => {\n window.removeEventListener('scroll', scrollHandler)\n }\n }, [preloadVideo, isVideoLoaded])\n\n const handleVideoLoad = useCallback(() => {\n setIsVideoLoaded(true)\n // \u8BB0\u5F55\u5F53\u524DURL\u5DF2\u52A0\u8F7D\u89C6\u9891\u7248\u672C\n if (currentVideoUrl.current) {\n globalLoadedVideoUrls.add(currentVideoUrl.current)\n }\n const videoElement = videoRef?.current || internalVideoRef.current\n if (videoElement) {\n videoElement.muted = true\n videoElement.play()\n }\n }, [])\n\n return (\n <div ref={ref} className={cn('relative size-full', className)}>\n {poster && (\n <div\n className={cn(\n 'absolute inset-0 size-full overflow-hidden transition-opacity duration-500 ease-in-out',\n videoWrapperClassName,\n {\n 'opacity-100': !isVideoLoaded,\n 'overflow-visible opacity-0': isVideoLoaded,\n }\n )}\n >\n <img\n src={poster}\n alt={alt}\n style={{ width: '100%', height: '100%', objectFit: 'cover' }}\n className={cn(videoClassName)}\n />\n </div>\n )}\n <div\n className={cn('size-full transition-opacity duration-500 ease-in-out', {\n 'opacity-100': isVideoLoaded,\n 'opacity-0': !isVideoLoaded,\n })}\n style={{ visibility: isVideoStartLoad ? 'visible' : 'hidden' }}\n >\n {isVideoStartLoad && (\n <div className={cn('relative size-full', videoWrapperClassName)}>\n <video\n ref={videoRef || internalVideoRef}\n key={currentVideoUrl.current} // \u6DFB\u52A0key\u786E\u4FDDURL\u53D8\u5316\u65F6\u91CD\u65B0\u6E32\u67D3\n src={currentVideoUrl.current || src}\n poster={poster}\n className={cn('size-full object-cover', videoClassName)}\n onLoadedMetadata={handleVideoLoad}\n autoPlay={autoplay}\n muted={muted}\n loop={loop}\n controls={controls}\n playsInline={playsInline}\n {...attr}\n />\n </div>\n )}\n </div>\n </div>\n )\n}\n\nexport default ScrollLoadVideo\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAgII,IAAAI,EAAA,6BAhIJC,EAAgE,iBAChEC,EAAmB,+BACnBC,EAAyB,kBAGzB,MAAMC,EAAwB,IAAI,IAE5BC,EAAkB,CAAC,CACvB,IAAAC,EACA,OAAAC,EACA,IAAAC,EAAM,sBACN,UAAAC,EAAY,GACZ,sBAAAC,EAAwB,GACxB,eAAAC,EAAiB,GACjB,SAAAC,EAAW,GACX,MAAAC,EAAQ,GACR,KAAAC,EAAO,GACP,SAAAC,EAAW,GACX,YAAAC,EAAc,GACd,SAAAC,EAAW,KACX,GAAGC,CACL,IAaM,CACJ,KAAM,CAACC,EAAkBC,CAAmB,KAAI,YAAS,EAAK,EACxD,CAACC,EAAeC,CAAgB,KAAI,YAAS,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CAAa,CAAC,EAEhC,MAAMU,KAAkB,eAAY,IAAM,CACxCT,EAAiB,EAAI,EAEjBG,EAAgB,SAClBrB,EAAsB,IAAIqB,EAAgB,OAAO,EAEnD,MAAMC,EAAeT,GAAU,SAAWO,EAAiB,QACvDE,IACFA,EAAa,MAAQ,GACrBA,EAAa,KAAK,EAEtB,EAAG,CAAC,CAAC,EAEL,SACE,QAAC,OAAI,IAAKH,EAAK,aAAW,MAAG,qBAAsBd,CAAS,EACzD,UAAAF,MACC,OAAC,OACC,aAAW,MACT,yFACAG,EACA,CACE,cAAe,CAACW,EAChB,6BAA8BA,CAChC,CACF,EAEA,mBAAC,OACC,IAAKd,EACL,IAAKC,EACL,MAAO,CAAE,MAAO,OAAQ,OAAQ,OAAQ,UAAW,OAAQ,EAC3D,aAAW,MAAGG,CAAc,
|
|
4
|
+
"sourcesContent": ["import React, { useEffect, useState, useRef, useCallback } from 'react'\nimport { cn } from '../helpers/utils.js'\nimport { debounce } from 'lodash'\n\n// \u521B\u5EFA\u4E00\u4E2A\u5168\u5C40\u7F13\u5B58\u6765\u5B58\u50A8\u5DF2\u52A0\u8F7D\u7684\u89C6\u9891URL\nconst globalLoadedVideoUrls = new Set<string>()\n\nconst ScrollLoadVideo = ({\n src,\n poster,\n alt = 'Scroll Loaded Video',\n className = '',\n videoWrapperClassName = '',\n videoClassName = '',\n autoplay = false,\n muted = true,\n loop = true,\n controls = false,\n playsInline = true,\n videoRef = null,\n ...attr\n}: {\n src: string\n poster?: string\n alt?: string\n className?: string\n videoWrapperClassName?: string\n videoClassName?: string\n autoplay?: boolean\n muted?: boolean\n loop?: boolean\n controls?: boolean\n playsInline?: boolean\n [key: string]: any\n}) => {\n const [isVideoStartLoad, setIsVideoStartLoad] = useState(false)\n const [isVideoLoaded, setIsVideoLoaded] = useState(false)\n const ref = useRef<HTMLDivElement>(null)\n // \u5185\u90E8\u89C6\u9891\u5F15\u7528\uFF0C\u5982\u679C\u5916\u90E8\u6CA1\u6709\u4F20\u5165 videoRef\n const internalVideoRef = useRef<HTMLVideoElement>(null)\n // \u4FDD\u5B58\u5F53\u524D\u52A0\u8F7D\u7684\u89C6\u9891URL\n const currentVideoUrl = useRef<string>('')\n\n // \u5728\u7EC4\u4EF6\u6302\u8F7D\u65F6\u68C0\u67E5\u89C6\u9891\u662F\u5426\u5DF2\u7ECF\u88AB\u52A0\u8F7D\u8FC7\n useEffect(() => {\n // \u5982\u679C\u89C6\u9891\u5DF2\u7ECF\u88AB\u5168\u5C40\u7F13\u5B58\u8FC7\uFF0C\u76F4\u63A5\u8BBE\u7F6E\u4E3A\u5DF2\u52A0\u8F7D\u72B6\u6001\n if (globalLoadedVideoUrls.has(src)) {\n setIsVideoStartLoad(true)\n setIsVideoLoaded(true)\n currentVideoUrl.current = src\n }\n }, [src])\n\n // \u5F53\u89C6\u9891\u5DF2\u52A0\u8F7D\u4E14\u5DF2\u5F00\u59CB\u52A0\u8F7D\u65F6\uFF0C\u5C1D\u8BD5\u64AD\u653E\u89C6\u9891\n useEffect(() => {\n if (isVideoLoaded && isVideoStartLoad) {\n const videoElement = videoRef?.current || internalVideoRef.current\n if (videoElement) {\n // \u786E\u4FDD\u9759\u97F3\u4EE5\u5141\u8BB8\u81EA\u52A8\u64AD\u653E\n videoElement.muted = true\n // \u5C1D\u8BD5\u64AD\u653E\u89C6\u9891\n videoElement.play().catch((error: unknown) => {\n console.warn('\u89C6\u9891\u81EA\u52A8\u64AD\u653E\u5931\u8D25:', error)\n })\n }\n }\n }, [isVideoLoaded, isVideoStartLoad, videoRef])\n\n // \u9884\u52A0\u8F7D\u89C6\u9891\n const preloadVideo = useCallback(() => {\n const videoUrl = src\n\n if (!videoUrl) return\n\n // \u5982\u679C\u5F53\u524DURL\u5DF2\u7ECF\u662F\u89C6\u9891\u7248\u672C\uFF0C\u65E0\u9700\u91CD\u590D\u52A0\u8F7D\n if (currentVideoUrl.current === videoUrl && isVideoLoaded) {\n return\n }\n\n // \u68C0\u67E5\u662F\u5426\u5DF2\u7ECF\u52A0\u8F7D\u8FC7\u8FD9\u4E2AURL\u7684\u89C6\u9891\u7248\u672C\n if (globalLoadedVideoUrls.has(videoUrl)) {\n setIsVideoLoaded(true)\n currentVideoUrl.current = videoUrl\n return\n }\n\n // \u66F4\u65B0\u5F53\u524D\u89C6\u9891URL\n currentVideoUrl.current = videoUrl\n\n // \u9884\u52A0\u8F7D\u89C6\u9891\n const videoElement = document.createElement('video')\n videoElement.preload = 'metadata'\n videoElement.onloadedmetadata = () => {\n setIsVideoLoaded(true)\n globalLoadedVideoUrls.add(videoUrl)\n }\n videoElement.src = videoUrl\n }, [isVideoLoaded, src])\n\n useEffect(() => {\n if (!ref.current || isVideoLoaded) return\n const scrollHandler = debounce(() => {\n if (window.scrollY > 10) {\n setIsVideoStartLoad(true)\n preloadVideo()\n return window.removeEventListener('scroll', scrollHandler)\n }\n }, 100)\n window.addEventListener('scroll', scrollHandler)\n return () => {\n window.removeEventListener('scroll', scrollHandler)\n }\n }, [preloadVideo, isVideoLoaded])\n\n const handleVideoLoad = useCallback(() => {\n setIsVideoLoaded(true)\n // \u8BB0\u5F55\u5F53\u524DURL\u5DF2\u52A0\u8F7D\u89C6\u9891\u7248\u672C\n if (currentVideoUrl.current) {\n globalLoadedVideoUrls.add(currentVideoUrl.current)\n }\n const videoElement = videoRef?.current || internalVideoRef.current\n if (videoElement) {\n videoElement.muted = true\n videoElement.play()\n }\n }, [])\n\n return (\n <div ref={ref} className={cn('relative size-full', className)}>\n {poster && (\n <div\n className={cn(\n 'absolute inset-0 size-full overflow-hidden transition-opacity duration-500 ease-in-out',\n videoWrapperClassName,\n {\n 'opacity-100': !isVideoLoaded,\n 'overflow-visible opacity-0': isVideoLoaded,\n }\n )}\n >\n <img\n src={poster}\n alt={alt}\n style={{ width: '100%', height: '100%', objectFit: 'cover' }}\n className={cn(videoClassName)}\n loading=\"lazy\"\n />\n </div>\n )}\n <div\n className={cn('size-full transition-opacity duration-500 ease-in-out', {\n 'opacity-100': isVideoLoaded,\n 'opacity-0': !isVideoLoaded,\n })}\n style={{ visibility: isVideoStartLoad ? 'visible' : 'hidden' }}\n >\n {isVideoStartLoad && (\n <div className={cn('relative size-full', videoWrapperClassName)}>\n <video\n ref={videoRef || internalVideoRef}\n key={currentVideoUrl.current} // \u6DFB\u52A0key\u786E\u4FDDURL\u53D8\u5316\u65F6\u91CD\u65B0\u6E32\u67D3\n src={currentVideoUrl.current || src}\n poster={poster}\n className={cn('size-full object-cover', videoClassName)}\n onLoadedMetadata={handleVideoLoad}\n autoPlay={autoplay}\n muted={muted}\n loop={loop}\n controls={controls}\n playsInline={playsInline}\n {...attr}\n />\n </div>\n )}\n </div>\n </div>\n )\n}\n\nexport default ScrollLoadVideo\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAgII,IAAAI,EAAA,6BAhIJC,EAAgE,iBAChEC,EAAmB,+BACnBC,EAAyB,kBAGzB,MAAMC,EAAwB,IAAI,IAE5BC,EAAkB,CAAC,CACvB,IAAAC,EACA,OAAAC,EACA,IAAAC,EAAM,sBACN,UAAAC,EAAY,GACZ,sBAAAC,EAAwB,GACxB,eAAAC,EAAiB,GACjB,SAAAC,EAAW,GACX,MAAAC,EAAQ,GACR,KAAAC,EAAO,GACP,SAAAC,EAAW,GACX,YAAAC,EAAc,GACd,SAAAC,EAAW,KACX,GAAGC,CACL,IAaM,CACJ,KAAM,CAACC,EAAkBC,CAAmB,KAAI,YAAS,EAAK,EACxD,CAACC,EAAeC,CAAgB,KAAI,YAAS,EAAK,EAClDC,KAAM,UAAuB,IAAI,EAEjCC,KAAmB,UAAyB,IAAI,EAEhDC,KAAkB,UAAe,EAAE,KAGzC,aAAU,IAAM,CAEVrB,EAAsB,IAAIE,CAAG,IAC/Bc,EAAoB,EAAI,EACxBE,EAAiB,EAAI,EACrBG,EAAgB,QAAUnB,EAE9B,EAAG,CAACA,CAAG,CAAC,KAGR,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E,QAAC,OAAI,IAAKH,EAAK,aAAW,MAAG,qBAAsBd,CAAS,EACzD,UAAAF,MACC,OAAC,OACC,aAAW,MACT,yFACAG,EACA,CACE,cAAe,CAACW,EAChB,6BAA8BA,CAChC,CACF,EAEA,mBAAC,OACC,IAAKd,EACL,IAAKC,EACL,MAAO,CAAE,MAAO,OAAQ,OAAQ,OAAQ,UAAW,OAAQ,EAC3D,aAAW,MAAGG,CAAc,EAC5B,QAAQ,OACV,EACF,KAEF,OAAC,OACC,aAAW,MAAG,wDAAyD,CACrE,cAAeU,EACf,YAAa,CAACA,CAChB,CAAC,EACD,MAAO,CAAE,WAAYF,EAAmB,UAAY,QAAS,EAE5D,SAAAA,MACC,OAAC,OAAI,aAAW,MAAG,qBAAsBT,CAAqB,EAC5D,mBAAC,SACC,IAAKO,GAAYO,EAEjB,IAAKC,EAAgB,SAAWnB,EAChC,OAAQC,EACR,aAAW,MAAG,yBAA0BI,CAAc,EACtD,iBAAkBoB,EAClB,SAAUnB,EACV,MAAOC,EACP,KAAMC,EACN,SAAUC,EACV,YAAaC,EACZ,GAAGE,GAVCO,EAAgB,OAWvB,EACF,EAEJ,GACF,CAEJ,EAEA,IAAO3B,EAAQO",
|
|
6
6
|
"names": ["ScrollLoadVideo_exports", "__export", "ScrollLoadVideo_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_utils", "import_lodash", "globalLoadedVideoUrls", "ScrollLoadVideo", "src", "poster", "alt", "className", "videoWrapperClassName", "videoClassName", "autoplay", "muted", "loop", "controls", "playsInline", "videoRef", "attr", "isVideoStartLoad", "setIsVideoStartLoad", "isVideoLoaded", "setIsVideoLoaded", "ref", "internalVideoRef", "currentVideoUrl", "videoElement", "error", "preloadVideo", "videoUrl", "scrollHandler", "handleVideoLoad"]
|
|
7
7
|
}
|
|
@@ -11,7 +11,7 @@ declare const meta: {
|
|
|
11
11
|
onClick?: Function;
|
|
12
12
|
} & import("class-variance-authority").VariantProps<(props?: ({
|
|
13
13
|
size?: "base" | "lg" | null | undefined;
|
|
14
|
-
variant?: "primary" | "
|
|
14
|
+
variant?: "primary" | "secondary" | null | undefined;
|
|
15
15
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & import("../helpers/component-props.js").ComponentPropsWithout<"a", import("../helpers/component-props.js").RemovedProps> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
16
16
|
parameters: {
|
|
17
17
|
layout: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var d=Object.create;var o=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var k=(i,a)=>{for(var s in a)o(i,s,{get:a[s],enumerable:!0})},r=(i,a,s,t)=>{if(a&&typeof a=="object"||typeof a=="function")for(let l of p(a))!m.call(i,l)&&l!==s&&o(i,l,{get:()=>a[l],enumerable:!(t=c(a,l))||t.enumerable});return i};var y=(i,a,s)=>(s=i!=null?d(f(i)):{},r(a||!i||!i.__esModule?o(s,"default",{value:i,enumerable:!0}):s,i)),L=i=>r(o({},"__esModule",{value:!0}),i);var z={};k(z,{Default:()=>b,Disabled:()=>
|
|
1
|
+
"use strict";var d=Object.create;var o=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var k=(i,a)=>{for(var s in a)o(i,s,{get:a[s],enumerable:!0})},r=(i,a,s,t)=>{if(a&&typeof a=="object"||typeof a=="function")for(let l of p(a))!m.call(i,l)&&l!==s&&o(i,l,{get:()=>a[l],enumerable:!(t=c(a,l))||t.enumerable});return i};var y=(i,a,s)=>(s=i!=null?d(f(i)):{},r(a||!i||!i.__esModule?o(s,"default",{value:i,enumerable:!0}):s,i)),L=i=>r(o({},"__esModule",{value:!0}),i);var z={};k(z,{Default:()=>b,Disabled:()=>u,LinkSize:()=>x,default:()=>g});module.exports=L(z);var e=require("react/jsx-runtime"),S=require("@storybook/icons"),n=y(require("../components/link.js"));const v={title:"Components/Link",component:n.default,parameters:{layout:"centered"},tags:["autodocs"],argTypes:{size:{description:"\u5C3A\u5BF8",control:{type:"select"},options:["base","lg"],table:{defaultValue:{summary:"base"}}},variant:{description:"\u94FE\u63A5\u60AC\u6D6E\u6587\u5B57\u6837\u5F0F",control:{type:"select"},options:["primary","secondary"],table:{defaultValue:{summary:"primary"}}},onClick:{control:!1},suffixIcon:{control:!1},style:{control:!1},className:{control:!1},children:{control:!1}},args:{onClick:void 0}};var g=v;const b={args:{children:"Link"}},x=()=>(0,e.jsxs)("div",{className:"inline-flex flex-col gap-4",children:[(0,e.jsx)("div",{className:"inline-flex gap-4",children:(0,e.jsx)(n.default,{size:"base",children:"Link"})}),(0,e.jsx)("div",{className:"inline-flex gap-4",children:(0,e.jsx)(n.default,{size:"lg",children:"Link"})}),(0,e.jsx)("div",{className:"inline-flex gap-4",children:(0,e.jsx)(n.default,{size:"base",variant:"secondary",children:"Link"})}),(0,e.jsx)("div",{className:"inline-flex gap-4",children:(0,e.jsx)(n.default,{size:"lg",variant:"secondary",children:"Link"})})]}),u=()=>(0,e.jsxs)("div",{className:"inline-flex flex-col gap-4",children:[(0,e.jsxs)("div",{className:"inline-flex gap-4",children:[(0,e.jsx)(n.default,{size:"base",disabled:!0,children:"Link"}),(0,e.jsx)(n.default,{size:"base",disabled:!0,children:"Link"})]}),(0,e.jsxs)("div",{className:"inline-flex gap-4",children:[(0,e.jsx)(n.default,{size:"lg",disabled:!0,children:"Link"}),(0,e.jsx)(n.default,{size:"lg",disabled:!0,children:"Link"})]})]});
|
|
2
2
|
//# sourceMappingURL=link.stories.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/stories/link.stories.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { Meta, StoryObj } from '@storybook/react'\nimport { ChevronRightIcon } from '@storybook/icons'\nimport Link from '../components/link.js'\n\nconst meta = {\n // \u540C\u65F6\u5B9A\u4E49\u4E86\u9875\u9762\u5DE6\u4FA7\u83DC\u5355\n title: 'Components/Link',\n component: Link,\n parameters: {\n layout: 'centered',\n },\n // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs\n tags: ['autodocs'],\n // More on argTypes: https://storybook.js.org/docs/api/argtypes\n argTypes: {\n size: {\n description: '\u5C3A\u5BF8',\n control: {\n type: 'select',\n },\n options: ['base', 'lg'],\n table: {\n defaultValue: { summary: 'base' },\n },\n },\n variant: {\n description: '\u94FE\u63A5\u60AC\u6D6E\u6587\u5B57\u6837\u5F0F',\n control: {\n type: 'select',\n },\n options: ['primary', '
|
|
4
|
+
"sourcesContent": ["import type { Meta, StoryObj } from '@storybook/react'\nimport { ChevronRightIcon } from '@storybook/icons'\nimport Link from '../components/link.js'\n\nconst meta = {\n // \u540C\u65F6\u5B9A\u4E49\u4E86\u9875\u9762\u5DE6\u4FA7\u83DC\u5355\n title: 'Components/Link',\n component: Link,\n parameters: {\n layout: 'centered',\n },\n // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs\n tags: ['autodocs'],\n // More on argTypes: https://storybook.js.org/docs/api/argtypes\n argTypes: {\n size: {\n description: '\u5C3A\u5BF8',\n control: {\n type: 'select',\n },\n options: ['base', 'lg'],\n table: {\n defaultValue: { summary: 'base' },\n },\n },\n variant: {\n description: '\u94FE\u63A5\u60AC\u6D6E\u6587\u5B57\u6837\u5F0F',\n control: {\n type: 'select',\n },\n options: ['primary', 'secondary'],\n table: {\n defaultValue: { summary: 'primary' },\n },\n },\n onClick: {\n control: false,\n },\n suffixIcon: {\n control: false,\n },\n style: {\n control: false,\n },\n className: {\n control: false,\n },\n children: {\n control: false,\n },\n },\n args: {\n onClick: undefined,\n },\n} satisfies Meta<typeof Link>\n\nexport default meta\n\ntype Story = StoryObj<typeof meta>\n\nexport const Default: Story = {\n args: {\n children: 'Link',\n },\n}\n\nexport const LinkSize = () => (\n <div className=\"inline-flex flex-col gap-4\">\n <div className=\"inline-flex gap-4\">\n <Link size=\"base\">Link</Link>\n </div>\n <div className=\"inline-flex gap-4\">\n <Link size=\"lg\">Link</Link>\n </div>\n <div className=\"inline-flex gap-4\">\n <Link size=\"base\" variant=\"secondary\">\n Link\n </Link>\n </div>\n <div className=\"inline-flex gap-4\">\n <Link size=\"lg\" variant=\"secondary\">\n Link\n </Link>\n </div>\n </div>\n)\n\nexport const Disabled = () => (\n <div className=\"inline-flex flex-col gap-4\">\n <div className=\"inline-flex gap-4\">\n <Link size=\"base\" disabled>\n Link\n </Link>\n <Link size=\"base\" disabled>\n Link\n </Link>\n </div>\n <div className=\"inline-flex gap-4\">\n <Link size=\"lg\" disabled>\n Link\n </Link>\n <Link size=\"lg\" disabled>\n Link\n </Link>\n </div>\n </div>\n)\n"],
|
|
5
5
|
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,aAAAC,EAAA,aAAAC,EAAA,YAAAC,IAAA,eAAAC,EAAAN,GAmEE,IAAAO,EAAA,6BAlEFC,EAAiC,4BACjCC,EAAiB,oCAEjB,MAAMC,EAAO,CAEX,MAAO,kBACP,UAAW,EAAAC,QACX,WAAY,CACV,OAAQ,UACV,EAEA,KAAM,CAAC,UAAU,EAEjB,SAAU,CACR,KAAM,CACJ,YAAa,eACb,QAAS,CACP,KAAM,QACR,EACA,QAAS,CAAC,OAAQ,IAAI,EACtB,MAAO,CACL,aAAc,CAAE,QAAS,MAAO,CAClC,CACF,EACA,QAAS,CACP,YAAa,mDACb,QAAS,CACP,KAAM,QACR,EACA,QAAS,CAAC,UAAW,WAAW,EAChC,MAAO,CACL,aAAc,CAAE,QAAS,SAAU,CACrC,CACF,EACA,QAAS,CACP,QAAS,EACX,EACA,WAAY,CACV,QAAS,EACX,EACA,MAAO,CACL,QAAS,EACX,EACA,UAAW,CACT,QAAS,EACX,EACA,SAAU,CACR,QAAS,EACX,CACF,EACA,KAAM,CACJ,QAAS,MACX,CACF,EAEA,IAAON,EAAQK,EAIR,MAAMR,EAAiB,CAC5B,KAAM,CACJ,SAAU,MACZ,CACF,EAEaE,EAAW,OACtB,QAAC,OAAI,UAAU,6BACb,oBAAC,OAAI,UAAU,oBACb,mBAAC,EAAAO,QAAA,CAAK,KAAK,OAAO,gBAAI,EACxB,KACA,OAAC,OAAI,UAAU,oBACb,mBAAC,EAAAA,QAAA,CAAK,KAAK,KAAK,gBAAI,EACtB,KACA,OAAC,OAAI,UAAU,oBACb,mBAAC,EAAAA,QAAA,CAAK,KAAK,OAAO,QAAQ,YAAY,gBAEtC,EACF,KACA,OAAC,OAAI,UAAU,oBACb,mBAAC,EAAAA,QAAA,CAAK,KAAK,KAAK,QAAQ,YAAY,gBAEpC,EACF,GACF,EAGWR,EAAW,OACtB,QAAC,OAAI,UAAU,6BACb,qBAAC,OAAI,UAAU,oBACb,oBAAC,EAAAQ,QAAA,CAAK,KAAK,OAAO,SAAQ,GAAC,gBAE3B,KACA,OAAC,EAAAA,QAAA,CAAK,KAAK,OAAO,SAAQ,GAAC,gBAE3B,GACF,KACA,QAAC,OAAI,UAAU,oBACb,oBAAC,EAAAA,QAAA,CAAK,KAAK,KAAK,SAAQ,GAAC,gBAEzB,KACA,OAAC,EAAAA,QAAA,CAAK,KAAK,KAAK,SAAQ,GAAC,gBAEzB,GACF,GACF",
|
|
6
6
|
"names": ["link_stories_exports", "__export", "Default", "Disabled", "LinkSize", "link_stories_default", "__toCommonJS", "import_jsx_runtime", "import_icons", "import_link", "meta", "Link"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as ge,jsx as e,jsxs as i}from"react/jsx-runtime";import{useState as N,useRef as r,useMemo as Ee,useEffect as x,forwardRef as Ne,useImperativeHandle as we,useCallback as He}from"react";import{cn as y}from"../../helpers/utils.js";import{withLayout as _e}from"../../shared/Styles.js";import ce from"../../components/button.js";import{VideoModal as ue}from"../VideoModal/index.js";import{convertLexicalToHTML as de}from"@payloadcms/richtext-lexical/html";import{useInView as Re}from"react-intersection-observer";import{useExposure as Me}from"../../hooks/useExposure.js";import C from"../../helpers/ScrollLoadVideo.js";import{gsap as D}from"gsap";import{SplitText as pe}from"gsap/dist/SplitText";import{ScrollTrigger as z}from"gsap/dist/ScrollTrigger";typeof window<"u"&&D.registerPlugin(z,pe);const Se="media_player_base",ke="video",m={TEXT_START_OFFSET:"10%",TEXT_ANIMATION_MULTIPLIER:1.5,TEXT_ANIMATION_OFFSET:80,VIDEO_HEIGHT_BASE:102,OVERLAP_FACTOR:.5,VIDEO_PROGRESS_THRESHOLD:.9,HEIGHT_CHANGE_THRESHOLD:5},V={DAMPING:.18,EPSILON:.5},me=({defaultConverters:w})=>({...w,text:H=>{const{node:c}=H;return c.$&&c.$.color?`<span class="lexical-${c.$.color}">${c.text}</span>`:c.text}}),fe=Ne(({className:w="",id:H,onBtnClick:c,data:{title:_,videoTitle:R,btnText:M,youtubeId:S,video:k,mobileVideo:ee,theme:B,img:L,shape:G,titleAnimation:f,...ve}},Te)=>{const{sticky:u}=ve,[O,te]=N(!1),[re,ne]=N(0),[be,le]=N(0),[$,xe]=N(0),[A,q]=N(!1),g=r(null),X=r(null),o=r(null),j=r(null),h=r(null),U=r(null),oe=r(null),se=r(null),F=r({btb:0,titleHeight:0}),W=r(!1),J=r(null),K=r(null),P=r(null),{ref:ae,inView:s}=Re();we(Te,()=>o.current);const v=typeof _=="string"?_:_&&de({data:_,converters:me}),I=typeof R=="string"?R:R&&de({data:R,converters:me});x(()=>{s?(g.current?.play(),te(!0)):(g.current?.pause(),te(!1))},[s]),x(()=>{if(!o.current||!u)return;const n=()=>{if(!o.current)return;const a=o.current.getBoundingClientRect(),T=window.innerHeight,E=T-a.bottom,p=E>T?T:E,b=o.current.clientHeight+T;F.current.btb=p,F.current.titleHeight=b,W.current||(W.current=!0,ne(p),le(b))};n();const d=new ResizeObserver(()=>{requestAnimationFrame(()=>{n()})});d.observe(o.current);let t=null;const l=()=>{t===null&&(t=requestAnimationFrame(()=>{n(),t=null}))};return window.addEventListener("scroll",l,{passive:!0}),()=>{d.disconnect(),window.removeEventListener("scroll",l),t!==null&&cancelAnimationFrame(t),W.current=!1}},[u]),x(()=>{if(!u)return;let n;const d=()=>{ne(t=>{const l=F.current.btb,a=l-t;return Math.abs(a)<=V.EPSILON?l:t+a*V.DAMPING}),le(t=>{const l=F.current.titleHeight,a=l-t;return Math.abs(a)<=V.EPSILON?l:t+a*V.DAMPING}),n=requestAnimationFrame(d)};return n=requestAnimationFrame(d),()=>{cancelAnimationFrame(n)}},[u]),x(()=>{if(!s||!f||f!=="fade-in"||!j.current)return;const n=j.current,d=n.clientHeight||80;U.current=new pe(n,{type:"words",wordsClass:"word"});const t=U.current.words,l=t.length,a=1/l,T=t.map((E,p)=>{const b=p/l*(1-m.OVERLAP_FACTOR),Y=a*(1+m.OVERLAP_FACTOR);return{start:b,width:Y}});return D.set(t,{opacity:0}),oe.current=z.create({trigger:o.current,start:`top center-=${m.TEXT_START_OFFSET}`,end:`top+=${d*m.TEXT_ANIMATION_MULTIPLIER+m.TEXT_ANIMATION_OFFSET}px center-=${m.TEXT_START_OFFSET}`,scrub:!0,onUpdate:E=>{const p=E.progress;t.forEach((b,Y)=>{const{start:he,width:Ie}=T[Y];let Z=(p-he)/Ie;Z=Math.max(0,Math.min(Z,1)),D.set(b,{opacity:Z})}),X.current&&D.set(X.current,{opacity:p})}}),()=>{U.current?.revert(),oe.current?.kill()}},[f,s]),x(()=>{if(!(!s||!o.current))return se.current=z.create({trigger:o.current,start:"bottom bottom",end:"bottom top",scrub:!0,onUpdate:n=>{xe(n.progress)}}),()=>{se.current?.kill()}},[s]),Me(h,{componentType:ke,componentName:Se,componentTitle:I});const ye=Ee(()=>s&&$>0&&$<m.VIDEO_PROGRESS_THRESHOLD?3:s?2:1,[$,s]);x(()=>{if(!(!u||!J.current||!K.current||!h.current))return P.current=z.create({trigger:J.current,start:"top top",endTrigger:h.current,end:"bottom top",pin:K.current,pinSpacing:!1,anticipatePin:1,invalidateOnRefresh:!0}),requestAnimationFrame(()=>{P.current?.refresh()}),()=>{P.current?.kill(),P.current=null}},[u]);const ie=He(()=>{q(!0),c?.()},[c]),Q="lg-desktop:aspect-w-[1920] lg-desktop:aspect-h-[930] desktop:aspect-w-[1024] desktop:aspect-h-[520] laptop:aspect-w-[1024] laptop:aspect-h-[520] tablet:aspect-w-[768] tablet:aspect-h-[660] aspect-w-[390] aspect-h-[660]";return u?i(ge,{children:[e("div",{ref:o,className:y("relative z-10",Q,{"aiui-dark":B==="dark","rounded-box":G==="rounded"},w),children:e("div",{ref:ae,children:!f&&i("div",{className:"media-content text-info-primary absolute left-1/2 top-1/2 z-20 w-full -translate-x-1/2 -translate-y-1/2 px-4 text-center",children:[v&&!O&&e("div",{className:"lg-desktop:text-[64px] text-center text-[40px] font-bold leading-none lg:text-5xl",dangerouslySetInnerHTML:{__html:v}}),I&&O&&e("div",{className:"lg-desktop:text-[64px] text-center text-[40px] font-bold leading-none lg:text-5xl",dangerouslySetInnerHTML:{__html:I}}),M&&e(ce,{variant:"link",className:y("member-equity-button-secondary "),onClick:ie,children:M})]})})}),i("div",{style:{marginBottom:`-${re}px`,marginTop:`-${be}px`,zIndex:ye},className:"relative",children:[e("div",{className:"sticky top-0",ref:J,children:i("div",{id:H,className:y("relative h-screen w-full overflow-hidden",{"aiui-dark":B==="dark","rounded-box":G==="rounded"}),children:[f==="fade-in"&&v&&e("div",{ref:j,className:"lg-desktop:text-[64px] absolute left-1/2 top-1/2 z-20 w-full -translate-x-1/2 -translate-y-1/2 text-center text-[40px] font-bold leading-none lg:text-5xl",dangerouslySetInnerHTML:{__html:v}}),i("div",{className:"media-cover absolute left-0 top-0 size-full",ref:K,children:[e(C,{videoRef:g,poster:L?.url||"",src:k?.url,className:"tablet:block hidden size-full",videoClassName:"object-cover",muted:!0,loop:!0,playsInline:!0,autoplay:!0,"webkit-playsinline":!0,"x5-playsinline":!0}),e(C,{videoRef:g,poster:L?.url||"",src:ee?.url||k?.url,className:"tablet:hidden block size-full",videoClassName:"object-cover",muted:!0,loop:!0,playsInline:!0,autoplay:!0,"webkit-playsinline":!0,"x5-playsinline":!0}),e("div",{ref:X,className:"absolute left-0 top-0 z-10 size-full opacity-0",style:{background:"rgba(0, 0, 0, 0.2)"}})]})]})}),e("div",{className:y("relative box-content block",Q),style:{height:`${re}px`},ref:h})]}),A&&S&&e(ue,{visible:A,youTubeId:S,onCloseModal:()=>q(!1)})]}):i(ge,{children:[i("div",{id:H,className:y("relative overflow-hidden",Q,{"aiui-dark":B==="dark","rounded-box":G==="rounded"},w),children:[i("div",{ref:ae,children:[!f&&i("div",{className:"media-content text-info-primary absolute left-1/2 top-1/2 z-20 w-full -translate-x-1/2 -translate-y-1/2 px-4 text-center",children:[v&&!O&&e("div",{className:"lg-desktop:text-[64px] text-center text-[40px] font-bold leading-none lg:text-5xl",dangerouslySetInnerHTML:{__html:v}}),I&&O&&e("div",{className:"lg-desktop:text-[64px] text-center text-[40px] font-bold leading-none lg:text-5xl",dangerouslySetInnerHTML:{__html:I}}),M&&e(ce,{variant:"link",className:y("member-equity-button-secondary"),onClick:ie,children:M})]}),e(C,{videoRef:g,poster:L?.url||"",src:k?.url,className:"tablet:block hidden size-full",videoClassName:"object-cover",muted:!0,loop:!0,playsInline:!0,autoplay:!0,"webkit-playsinline":!0,"x5-playsinline":!0}),e(C,{videoRef:g,poster:L?.url||"",src:ee?.url||k?.url,className:"tablet:hidden block size-full",videoClassName:"object-cover",muted:!0,loop:!0,playsInline:!0,autoplay:!0,"webkit-playsinline":!0,"x5-playsinline":!0})]}),e("div",{ref:h,className:"absolute bottom-0 left-0 h-px w-full"})]}),A&&S&&e(ue,{visible:A,youTubeId:S,onCloseModal:()=>q(!1)})]})});fe.displayName="MediaPlayerBase";var qe=_e(fe);export{qe as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/MediaPlayerBase/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport { useState, useRef, useMemo, useEffect, forwardRef, useImperativeHandle } from 'react'\nimport { debounce } from 'lodash'\nimport { cn } from '../../helpers/utils.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport Button from '../../components/button.js'\nimport { VideoModal } from '../VideoModal/index.js'\nimport { convertLexicalToHTML } from '@payloadcms/richtext-lexical/html'\nimport type { MediaPlayerBaseProps } from './types.js'\n// import { Right } from './right.js'\nimport { useInView } from 'react-intersection-observer'\nimport type { HTMLConvertersFunction } from '@payloadcms/richtext-lexical/html'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport ScrollLoadVideo from '../../helpers/ScrollLoadVideo.js'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/dist/SplitText'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\n\nconst componentName = 'media_player_base'\nconst componentType = 'video'\n\nconst htmlConverters: HTMLConvertersFunction = ({ defaultConverters }) => ({\n ...defaultConverters,\n text: args => {\n const { node } = args\n // \u68C0\u67E5\u662F\u5426\u6709\u81EA\u5B9A\u4E49 color\n if (node.$ && node.$.color) {\n return `<span class=\"lexical-${node.$.color}\">${node.text}</span>`\n }\n return node.text\n },\n})\n\nconst MediaPlayerBase = forwardRef<HTMLDivElement, MediaPlayerBaseProps>(\n (\n {\n className = '',\n id,\n onBtnClick,\n data: { title, videoTitle, btnText, youtubeId, video, mobileVideo, theme, img, shape, titleAnimation, ...rest },\n },\n ref\n ) => {\n const { sticky } = rest\n const [isPlaying, setIsPlaying] = useState(false)\n const [btb, setbtb] = useState(0)\n const [titleHeight, setTitleHeight] = useState(0)\n const [videoHeightProgress, setVideoHeightProgress] = useState(0)\n const [visible, setVisible] = useState<boolean>(false)\n\n const videoRef = useRef<HTMLVideoElement>(null)\n const bgRef = useRef<HTMLImageElement>(null)\n const titleRef = useRef<HTMLDivElement>(null)\n const titleFadeInRef = useRef<HTMLDivElement>(null)\n const trackRef = useRef<HTMLDivElement>(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n const heightTriggerRef = useRef<ScrollTrigger | null>(null)\n const { ref: inViewRef, inView } = useInView()\n\n useImperativeHandle(ref, () => titleRef.current as HTMLDivElement)\n\n const title_html =\n typeof title === 'string' ? title : title && convertLexicalToHTML({ data: title, converters: htmlConverters })\n const videoTitle_html =\n typeof videoTitle === 'string'\n ? videoTitle\n : videoTitle && convertLexicalToHTML({ data: videoTitle, converters: htmlConverters })\n\n useEffect(() => {\n if (inView) {\n videoRef.current?.play()\n setIsPlaying(true)\n } else {\n videoRef.current?.pause()\n setIsPlaying(false)\n }\n }, [inView])\n\n const debouncedHandleResize = debounce(() => {\n if (titleRef.current) {\n const rect = titleRef.current.getBoundingClientRect()\n const screenHeight = window.innerHeight\n const scrollTop = window.scrollY || window.pageYOffset\n const elementBottomToPageTop = rect.bottom + scrollTop\n const pageHeight = document.documentElement.scrollHeight\n const distanceToPageBottom = pageHeight - elementBottomToPageTop\n setbtb(distanceToPageBottom > screenHeight ? screenHeight : distanceToPageBottom)\n }\n if (titleRef.current) {\n const titleHeight = titleRef.current.clientHeight\n const screenHeight = window.innerHeight\n setTitleHeight(titleHeight + screenHeight)\n }\n }, 600)\n\n useEffect(() => {\n debouncedHandleResize()\n window.addEventListener('resize', debouncedHandleResize)\n return () => {\n window.removeEventListener('resize', debouncedHandleResize)\n }\n }, [])\n\n useEffect(() => {\n function gsapResize() {\n if (!titleFadeInRef.current || titleAnimation !== 'fade-in') return\n const height = titleFadeInRef.current?.clientHeight || 80\n splitTextInstance.current = new SplitText(titleFadeInRef.current, {\n type: 'words',\n wordsClass: 'word',\n })\n const words = splitTextInstance.current.words\n gsap.set(words, { opacity: 0 })\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: titleRef.current,\n start: 'top center-=10%',\n end: `top+=${height * 1.5 + 80}px center-=10%`,\n scrub: true,\n onUpdate: (self: any) => {\n const progress = self.progress\n const total = words.length\n const interval = 1 / total\n const overlap = 0.5\n words.forEach((word: any, i: number) => {\n const start = (i / total) * (1 - overlap)\n const width = interval * (1 + overlap)\n let opacity = (progress - start) / width\n opacity = Math.max(0, Math.min(opacity, 1))\n gsap.set(word, { opacity })\n })\n gsap.set(bgRef.current, { opacity: progress })\n },\n })\n }\n\n function gsapVideoHeightResize() {\n heightTriggerRef.current = ScrollTrigger.create({\n trigger: titleRef.current,\n start: 'bottom bottom',\n end: `bottom top`,\n // markers: true,\n scrub: true,\n onUpdate: (self: any) => {\n const progress = self.progress\n console.log('progress__', progress)\n setVideoHeightProgress(progress)\n },\n })\n }\n\n if (inView) {\n gsapResize()\n gsapVideoHeightResize()\n }\n\n return () => {\n splitTextInstance.current && splitTextInstance.current.revert()\n // ScrollTrigger.getAll().forEach((t: { kill: () => any }) => t.kill())\n scrollTriggerRef.current && scrollTriggerRef.current.kill()\n heightTriggerRef.current && heightTriggerRef.current.kill()\n }\n }, [titleAnimation, inView])\n\n useExposure(trackRef, {\n componentType,\n componentName,\n componentTitle: videoTitle_html,\n })\n\n const zIndexVideo = useMemo(() => {\n if (inView && videoHeightProgress > 0 && videoHeightProgress < 0.9) return 3\n if (inView) return 2\n return 1\n }, [videoHeightProgress, inView])\n\n const aspect =\n 'lg-desktop:aspect-w-[1920] lg-desktop:aspect-h-[930] desktop:aspect-w-[1024] desktop:aspect-h-[520] laptop:aspect-w-[1024] laptop:aspect-h-[520] tablet:aspect-w-[768] tablet:aspect-h-[660] aspect-w-[390] aspect-h-[660]'\n return (\n <>\n {sticky && (\n <div\n ref={titleRef}\n className={cn(\n 'relative z-10',\n aspect,\n {\n 'aiui-dark': theme === 'dark',\n 'rounded-box': shape === 'rounded',\n },\n className\n )}\n >\n <div ref={inViewRef}>\n {!titleAnimation && (\n <div className=\"media-content absolute left-1/2 top-1/2 z-20 w-full -translate-x-1/2 -translate-y-1/2 px-4 text-center\">\n {title_html && !isPlaying && (\n <div\n className=\"lg-desktop:text-[64px] text-btn-primary-foreground text-center text-[40px] font-bold leading-none lg:text-5xl\"\n dangerouslySetInnerHTML={{ __html: title_html }}\n />\n )}\n {videoTitle_html && isPlaying && (\n <div\n className=\"lg-desktop:text-[64px] text-btn-primary-foreground text-center text-[40px] font-bold leading-none lg:text-5xl\"\n dangerouslySetInnerHTML={{ __html: videoTitle_html }}\n />\n )}\n {btnText && (\n <Button\n variant=\"link\"\n className={cn('member-equity-button-secondary text-btn-primary-foreground')}\n onClick={() => {\n setVisible(true)\n // if (isPlaying) {\n // if (videoRef.current) {\n // videoRef.current.pause()\n // }\n // setIsPlaying(false)\n // } else {\n // if (videoRef.current) {\n // videoRef.current.play()\n // }\n // setIsPlaying(true)\n // }\n onBtnClick && onBtnClick?.()\n }}\n >\n {btnText}\n {/* <Right /> */}\n </Button>\n )}\n </div>\n )}\n </div>\n </div>\n )}\n <div\n style={\n sticky\n ? {\n marginBottom: `-${btb}px`,\n marginTop: `-${titleHeight}px`,\n zIndex: zIndexVideo,\n }\n : {}\n }\n className=\"relative\"\n >\n <div className=\"sticky top-0 \">\n <div\n id={id}\n className={cn('relative overflow-hidden', sticky ? 'h-screen w-full' : aspect, {\n 'aiui-dark': theme === 'dark',\n 'rounded-box': shape === 'rounded',\n })}\n >\n {titleAnimation === 'fade-in' && title_html && (\n <div\n ref={titleFadeInRef}\n className=\"lg-desktop:text-[64px] text-btn-primary-foreground absolute left-1/2 top-1/2 z-20 w-full -translate-x-1/2 -translate-y-1/2 text-center text-[40px] font-bold leading-none lg:text-5xl\"\n dangerouslySetInnerHTML={{ __html: title_html }}\n />\n )}\n <div\n className=\"media-cover left-0 top-0 h-screen w-screen\"\n style={{ height: `${102 - videoHeightProgress * 100}vh` }}\n >\n <ScrollLoadVideo\n videoRef={videoRef}\n poster={img?.url || ''}\n src={video?.url!}\n className=\"tablet:block hidden size-full\"\n videoClassName=\"object-cover\"\n muted\n loop\n playsInline\n autoplay\n webkit-playsinline\n x5-playsinline\n />\n <ScrollLoadVideo\n videoRef={videoRef}\n poster={img?.url || ''}\n src={mobileVideo?.url || video?.url!}\n className=\"tablet:hidden block size-full\"\n videoClassName=\"object-cover\"\n muted\n loop\n playsInline\n autoplay\n webkit-playsinline\n x5-playsinline\n />\n <div\n ref={bgRef}\n className=\"absolute left-0 top-0 z-10 size-full opacity-0\"\n style={{\n background: 'rgba(0, 0, 0, 0.2)',\n }}\n />\n </div>\n </div>\n </div>\n <div\n className={cn(sticky && 'relative box-content block', aspect)}\n style={sticky ? { height: `${btb}px` } : {}}\n ref={trackRef}\n />\n </div>\n {visible && youtubeId && (\n <VideoModal visible={visible} youTubeId={youtubeId} onCloseModal={() => setVisible(false)} />\n )}\n </>\n )\n }\n)\n\nexport default withLayout(MediaPlayerBase)\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["Fragment", "jsx", "jsxs", "useState", "useRef", "useMemo", "useEffect", "forwardRef", "useImperativeHandle", "
|
|
4
|
+
"sourcesContent": ["'use client'\nimport { useState, useRef, useMemo, useEffect, forwardRef, useImperativeHandle, useCallback } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport Button from '../../components/button.js'\nimport { VideoModal } from '../VideoModal/index.js'\nimport { convertLexicalToHTML } from '@payloadcms/richtext-lexical/html'\nimport type { MediaPlayerBaseProps } from './types.js'\nimport { useInView } from 'react-intersection-observer'\nimport type { HTMLConvertersFunction } from '@payloadcms/richtext-lexical/html'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport ScrollLoadVideo from '../../helpers/ScrollLoadVideo.js'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/dist/SplitText'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\n\nif (typeof window !== 'undefined') {\n gsap.registerPlugin(ScrollTrigger, SplitText)\n}\n\nconst componentName = 'media_player_base'\nconst componentType = 'video'\n\n// \u52A8\u753B\u914D\u7F6E\u5E38\u91CF\nconst ANIMATION_CONFIG = {\n TEXT_START_OFFSET: '10%',\n TEXT_ANIMATION_MULTIPLIER: 1.5,\n TEXT_ANIMATION_OFFSET: 80,\n VIDEO_HEIGHT_BASE: 102,\n OVERLAP_FACTOR: 0.5,\n VIDEO_PROGRESS_THRESHOLD: 0.9,\n HEIGHT_CHANGE_THRESHOLD: 5, // \u9AD8\u5EA6\u53D8\u5316\u9608\u503C(px)\n} as const\n\nconst SMOOTHING_CONFIG = {\n DAMPING: 0.18,\n EPSILON: 0.5,\n} as const\n\nconst htmlConverters: HTMLConvertersFunction = ({ defaultConverters }) => ({\n ...defaultConverters,\n text: args => {\n const { node } = args\n // \u68C0\u67E5\u662F\u5426\u6709\u81EA\u5B9A\u4E49 color\n if (node.$ && node.$.color) {\n return `<span class=\"lexical-${node.$.color}\">${node.text}</span>`\n }\n return node.text\n },\n})\n\ninterface ScrollTriggerInstance {\n progress: number\n kill: () => void\n refresh: () => void\n}\n\nconst MediaPlayerBase = forwardRef<HTMLDivElement, MediaPlayerBaseProps>(\n (\n {\n className = '',\n id,\n onBtnClick,\n data: { title, videoTitle, btnText, youtubeId, video, mobileVideo, theme, img, shape, titleAnimation, ...rest },\n },\n ref\n ) => {\n const { sticky } = rest\n const [isPlaying, setIsPlaying] = useState(false)\n const [btb, setbtb] = useState(0)\n const [titleHeight, setTitleHeight] = useState(0)\n const [videoHeightProgress, setVideoHeightProgress] = useState(0)\n const [visible, setVisible] = useState<boolean>(false)\n\n const videoRef = useRef<HTMLVideoElement>(null)\n const bgRef = useRef<HTMLDivElement>(null)\n const titleRef = useRef<HTMLDivElement>(null)\n const titleFadeInRef = useRef<HTMLDivElement>(null)\n const trackRef = useRef<HTMLDivElement>(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n const scrollTriggerRef = useRef<ScrollTriggerInstance | null>(null)\n const heightTriggerRef = useRef<ScrollTriggerInstance | null>(null)\n const layoutTargetsRef = useRef({ btb: 0, titleHeight: 0 })\n const layoutInitializedRef = useRef(false)\n const stickyWrapperRef = useRef<HTMLDivElement>(null)\n const videoContainerRef = useRef<HTMLDivElement>(null)\n const videoPinTriggerRef = useRef<ScrollTriggerInstance | null>(null)\n const { ref: inViewRef, inView } = useInView()\n\n useImperativeHandle(ref, () => titleRef.current as HTMLDivElement)\n\n const title_html =\n typeof title === 'string' ? title : title && convertLexicalToHTML({ data: title, converters: htmlConverters })\n const videoTitle_html =\n typeof videoTitle === 'string'\n ? videoTitle\n : videoTitle && convertLexicalToHTML({ data: videoTitle, converters: htmlConverters })\n\n // \u89C6\u9891\u64AD\u653E\u63A7\u5236\n useEffect(() => {\n if (inView) {\n videoRef.current?.play()\n setIsPlaying(true)\n } else {\n videoRef.current?.pause()\n setIsPlaying(false)\n }\n }, [inView])\n\n // \u4F18\u5316: \u4F7F\u7528 ResizeObserver \u66FF\u4EE3 debounce + resize \u4E8B\u4EF6\n useEffect(() => {\n if (!titleRef.current || !sticky) return\n\n // \u8BA1\u7B97\u5E03\u5C40\u5C3A\u5BF8\u7684\u6838\u5FC3\u51FD\u6570\n const calculateLayout = () => {\n if (!titleRef.current) return\n\n const rect = titleRef.current.getBoundingClientRect()\n const screenHeight = window.innerHeight\n // const scrollTop = window.scrollY || window.pageYOffset\n // const elementBottomToPageTop = rect.bottom + scrollTop\n // const pageHeight = document.documentElement.scrollHeight\n // const distanceToPageBottom = pageHeight - elementBottomToPageTop\n\n const inViewRefToBottom = screenHeight - rect.bottom\n const newBtb = inViewRefToBottom > screenHeight ? screenHeight : inViewRefToBottom\n const newTitleHeight = titleRef.current.clientHeight + screenHeight\n\n layoutTargetsRef.current.btb = newBtb\n layoutTargetsRef.current.titleHeight = newTitleHeight\n\n if (!layoutInitializedRef.current) {\n layoutInitializedRef.current = true\n setbtb(newBtb)\n setTitleHeight(newTitleHeight)\n }\n }\n\n // \u521D\u59CB\u8BA1\u7B97\n calculateLayout()\n\n // ResizeObserver \u76D1\u542C\u5C3A\u5BF8\u53D8\u5316\n const resizeObserver = new ResizeObserver(() => {\n // \u4F7F\u7528 requestAnimationFrame \u6279\u91CF\u66F4\u65B0\n requestAnimationFrame(() => {\n calculateLayout()\n })\n })\n\n resizeObserver.observe(titleRef.current)\n\n // \u76D1\u542C\u7A97\u53E3\u6EDA\u52A8(\u7528\u4E8E\u8BA1\u7B97 btb)\n let scrollFrame: number | null = null\n const handleScroll = () => {\n if (scrollFrame !== null) return\n scrollFrame = requestAnimationFrame(() => {\n calculateLayout()\n scrollFrame = null\n })\n }\n\n window.addEventListener('scroll', handleScroll, { passive: true })\n\n return () => {\n resizeObserver.disconnect()\n window.removeEventListener('scroll', handleScroll)\n if (scrollFrame !== null) {\n cancelAnimationFrame(scrollFrame)\n }\n layoutInitializedRef.current = false\n }\n }, [sticky])\n\n useEffect(() => {\n if (!sticky) return\n\n let rafId: number\n const smoothAnimate = () => {\n setbtb(prev => {\n const target = layoutTargetsRef.current.btb\n const delta = target - prev\n if (Math.abs(delta) <= SMOOTHING_CONFIG.EPSILON) return target\n return prev + delta * SMOOTHING_CONFIG.DAMPING\n })\n\n setTitleHeight(prev => {\n const target = layoutTargetsRef.current.titleHeight\n const delta = target - prev\n if (Math.abs(delta) <= SMOOTHING_CONFIG.EPSILON) return target\n return prev + delta * SMOOTHING_CONFIG.DAMPING\n })\n\n rafId = requestAnimationFrame(smoothAnimate)\n }\n\n rafId = requestAnimationFrame(smoothAnimate)\n\n return () => {\n cancelAnimationFrame(rafId)\n }\n }, [sticky])\n\n // \u4F18\u5316: GSAP \u52A8\u753B\u8BBE\u7F6E\n useEffect(() => {\n if (!inView || !titleAnimation || titleAnimation !== 'fade-in' || !titleFadeInRef.current) return\n\n const titleElement = titleFadeInRef.current\n const height = titleElement.clientHeight || 80\n\n // \u5206\u8BCD\n splitTextInstance.current = new SplitText(titleElement, {\n type: 'words',\n wordsClass: 'word',\n })\n\n const words = splitTextInstance.current.words\n const total = words.length\n const interval = 1 / total\n\n // \u9884\u8BA1\u7B97\u6BCF\u4E2A\u5355\u8BCD\u7684\u52A8\u753B\u53C2\u6570 - \u907F\u514D\u6BCF\u5E27\u91CD\u590D\u8BA1\u7B97\n const wordAnimations = words.map((_, i) => {\n const start = (i / total) * (1 - ANIMATION_CONFIG.OVERLAP_FACTOR)\n const width = interval * (1 + ANIMATION_CONFIG.OVERLAP_FACTOR)\n return { start, width }\n })\n\n // \u521D\u59CB\u5316\u900F\u660E\u5EA6\n gsap.set(words, { opacity: 0 })\n\n // \u521B\u5EFA\u6587\u5B57\u6DE1\u5165 ScrollTrigger\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: titleRef.current,\n start: `top center-=${ANIMATION_CONFIG.TEXT_START_OFFSET}`,\n end: `top+=${height * ANIMATION_CONFIG.TEXT_ANIMATION_MULTIPLIER + ANIMATION_CONFIG.TEXT_ANIMATION_OFFSET}px center-=${ANIMATION_CONFIG.TEXT_START_OFFSET}`,\n scrub: true,\n onUpdate: self => {\n const progress = self.progress\n\n // \u6279\u91CF\u66F4\u65B0\u6587\u5B57\u900F\u660E\u5EA6\n words.forEach((word, i) => {\n const { start, width } = wordAnimations[i]\n let opacity = (progress - start) / width\n opacity = Math.max(0, Math.min(opacity, 1))\n gsap.set(word, { opacity })\n })\n\n // \u66F4\u65B0\u80CC\u666F\u900F\u660E\u5EA6\n if (bgRef.current) {\n gsap.set(bgRef.current, { opacity: progress })\n }\n },\n }) as ScrollTriggerInstance\n\n return () => {\n splitTextInstance.current?.revert()\n scrollTriggerRef.current?.kill()\n }\n }, [titleAnimation, inView])\n\n // \u89C6\u9891\u9AD8\u5EA6\u52A8\u753B ScrollTrigger\n useEffect(() => {\n if (!inView || !titleRef.current) return\n\n heightTriggerRef.current = ScrollTrigger.create({\n trigger: titleRef.current,\n start: 'bottom bottom',\n end: 'bottom top',\n scrub: true,\n onUpdate: self => {\n setVideoHeightProgress(self.progress)\n },\n }) as ScrollTriggerInstance\n\n return () => {\n heightTriggerRef.current?.kill()\n }\n }, [inView])\n\n // \u66DD\u5149\u57CB\u70B9\n useExposure(trackRef, {\n componentType,\n componentName,\n componentTitle: videoTitle_html,\n })\n\n // \u8BA1\u7B97\u89C6\u9891\u5BB9\u5668\u7684 z-index\n const zIndexVideo = useMemo(() => {\n if (inView && videoHeightProgress > 0 && videoHeightProgress < ANIMATION_CONFIG.VIDEO_PROGRESS_THRESHOLD) return 3\n if (inView) return 2\n return 1\n }, [videoHeightProgress, inView])\n\n useEffect(() => {\n if (!sticky || !stickyWrapperRef.current || !videoContainerRef.current || !trackRef.current) return\n\n videoPinTriggerRef.current = ScrollTrigger.create({\n trigger: stickyWrapperRef.current,\n start: 'top top',\n endTrigger: trackRef.current,\n end: 'bottom top',\n pin: videoContainerRef.current,\n pinSpacing: false,\n anticipatePin: 1,\n invalidateOnRefresh: true,\n }) as ScrollTriggerInstance\n\n requestAnimationFrame(() => {\n videoPinTriggerRef.current?.refresh()\n })\n\n return () => {\n videoPinTriggerRef.current?.kill()\n videoPinTriggerRef.current = null\n }\n }, [sticky])\n\n // \u5904\u7406\u6309\u94AE\u70B9\u51FB\n const handleBtnClick = useCallback(() => {\n setVisible(true)\n onBtnClick?.()\n }, [onBtnClick])\n\n const aspect =\n 'lg-desktop:aspect-w-[1920] lg-desktop:aspect-h-[930] desktop:aspect-w-[1024] desktop:aspect-h-[520] laptop:aspect-w-[1024] laptop:aspect-h-[520] tablet:aspect-w-[768] tablet:aspect-h-[660] aspect-w-[390] aspect-h-[660]'\n\n // \u975E sticky \u6A21\u5F0F - \u7B80\u5355\u5E03\u5C40\n if (!sticky) {\n return (\n <>\n <div\n id={id}\n className={cn(\n 'relative overflow-hidden',\n aspect,\n {\n 'aiui-dark': theme === 'dark',\n 'rounded-box': shape === 'rounded',\n },\n className\n )}\n >\n <div ref={inViewRef}>\n {/* \u5185\u5BB9\u5C42 */}\n {!titleAnimation && (\n <div className=\"media-content text-info-primary absolute left-1/2 top-1/2 z-20 w-full -translate-x-1/2 -translate-y-1/2 px-4 text-center\">\n {title_html && !isPlaying && (\n <div\n className=\"lg-desktop:text-[64px] text-center text-[40px] font-bold leading-none lg:text-5xl\"\n dangerouslySetInnerHTML={{ __html: title_html }}\n />\n )}\n {videoTitle_html && isPlaying && (\n <div\n className=\"lg-desktop:text-[64px] text-center text-[40px] font-bold leading-none lg:text-5xl\"\n dangerouslySetInnerHTML={{ __html: videoTitle_html }}\n />\n )}\n {btnText && (\n <Button variant=\"link\" className={cn('member-equity-button-secondary')} onClick={handleBtnClick}>\n {btnText}\n </Button>\n )}\n </div>\n )}\n\n {/* \u89C6\u9891\u5C42 */}\n <ScrollLoadVideo\n videoRef={videoRef}\n poster={img?.url || ''}\n src={video?.url!}\n className=\"tablet:block hidden size-full\"\n videoClassName=\"object-cover\"\n muted\n loop\n playsInline\n autoplay\n webkit-playsinline\n x5-playsinline\n />\n <ScrollLoadVideo\n videoRef={videoRef}\n poster={img?.url || ''}\n src={mobileVideo?.url || video?.url!}\n className=\"tablet:hidden block size-full\"\n videoClassName=\"object-cover\"\n muted\n loop\n playsInline\n autoplay\n webkit-playsinline\n x5-playsinline\n />\n </div>\n\n {/* \u57CB\u70B9\u5143\u7D20 */}\n <div ref={trackRef} className=\"absolute bottom-0 left-0 h-px w-full\" />\n </div>\n\n {visible && youtubeId && (\n <VideoModal visible={visible} youTubeId={youtubeId} onCloseModal={() => setVisible(false)} />\n )}\n </>\n )\n }\n\n // Sticky \u6A21\u5F0F - \u590D\u6742\u5E03\u5C40\n return (\n <>\n <div\n ref={titleRef}\n className={cn(\n 'relative z-10',\n aspect,\n {\n 'aiui-dark': theme === 'dark',\n 'rounded-box': shape === 'rounded',\n },\n className\n )}\n >\n <div ref={inViewRef}>\n {!titleAnimation && (\n <div className=\"media-content text-info-primary absolute left-1/2 top-1/2 z-20 w-full -translate-x-1/2 -translate-y-1/2 px-4 text-center\">\n {title_html && !isPlaying && (\n <div\n className=\"lg-desktop:text-[64px] text-center text-[40px] font-bold leading-none lg:text-5xl\"\n dangerouslySetInnerHTML={{ __html: title_html }}\n />\n )}\n {videoTitle_html && isPlaying && (\n <div\n className=\"lg-desktop:text-[64px] text-center text-[40px] font-bold leading-none lg:text-5xl\"\n dangerouslySetInnerHTML={{ __html: videoTitle_html }}\n />\n )}\n {btnText && (\n <Button variant=\"link\" className={cn('member-equity-button-secondary ')} onClick={handleBtnClick}>\n {btnText}\n </Button>\n )}\n </div>\n )}\n </div>\n </div>\n <div\n style={{\n marginBottom: `-${btb}px`,\n marginTop: `-${titleHeight}px`,\n zIndex: zIndexVideo,\n }}\n className=\"relative\"\n >\n <div className=\"sticky top-0\" ref={stickyWrapperRef}>\n <div\n id={id}\n className={cn('relative h-screen w-full overflow-hidden', {\n 'aiui-dark': theme === 'dark',\n 'rounded-box': shape === 'rounded',\n })}\n >\n {titleAnimation === 'fade-in' && title_html && (\n <div\n ref={titleFadeInRef}\n className=\"lg-desktop:text-[64px] absolute left-1/2 top-1/2 z-20 w-full -translate-x-1/2 -translate-y-1/2 text-center text-[40px] font-bold leading-none lg:text-5xl\"\n dangerouslySetInnerHTML={{ __html: title_html }}\n />\n )}\n <div className=\"media-cover absolute left-0 top-0 size-full\" ref={videoContainerRef}>\n <ScrollLoadVideo\n videoRef={videoRef}\n poster={img?.url || ''}\n src={video?.url!}\n className=\"tablet:block hidden size-full\"\n videoClassName=\"object-cover\"\n muted\n loop\n playsInline\n autoplay\n webkit-playsinline\n x5-playsinline\n />\n <ScrollLoadVideo\n videoRef={videoRef}\n poster={img?.url || ''}\n src={mobileVideo?.url || video?.url!}\n className=\"tablet:hidden block size-full\"\n videoClassName=\"object-cover\"\n muted\n loop\n playsInline\n autoplay\n webkit-playsinline\n x5-playsinline\n />\n <div\n ref={bgRef}\n className=\"absolute left-0 top-0 z-10 size-full opacity-0\"\n style={{\n background: 'rgba(0, 0, 0, 0.2)',\n }}\n />\n </div>\n </div>\n </div>\n <div className={cn('relative box-content block', aspect)} style={{ height: `${btb}px` }} ref={trackRef} />\n </div>\n {visible && youtubeId && (\n <VideoModal visible={visible} youTubeId={youtubeId} onCloseModal={() => setVisible(false)} />\n )}\n </>\n )\n }\n)\n\nMediaPlayerBase.displayName = 'MediaPlayerBase'\n\nexport default withLayout(MediaPlayerBase)\n"],
|
|
5
|
+
"mappings": "aAwUQ,mBAAAA,GAkBY,OAAAC,EAFJ,QAAAC,MAhBR,oBAvUR,OAAS,YAAAC,EAAU,UAAAC,EAAQ,WAAAC,GAAS,aAAAC,EAAW,cAAAC,GAAY,uBAAAC,GAAqB,eAAAC,OAAmB,QACnG,OAAS,MAAAC,MAAU,yBACnB,OAAS,cAAAC,OAAkB,yBAC3B,OAAOC,OAAY,6BACnB,OAAS,cAAAC,OAAkB,yBAC3B,OAAS,wBAAAC,OAA4B,oCAErC,OAAS,aAAAC,OAAiB,8BAE1B,OAAS,eAAAC,OAAmB,6BAC5B,OAAOC,MAAqB,mCAC5B,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,OAAiB,sBAC1B,OAAS,iBAAAC,MAAqB,0BAE1B,OAAO,OAAW,KACpBF,EAAK,eAAeE,EAAeD,EAAS,EAG9C,MAAME,GAAgB,oBAChBC,GAAgB,QAGhBC,EAAmB,CACvB,kBAAmB,MACnB,0BAA2B,IAC3B,sBAAuB,GACvB,kBAAmB,IACnB,eAAgB,GAChB,yBAA0B,GAC1B,wBAAyB,CAC3B,EAEMC,EAAmB,CACvB,QAAS,IACT,QAAS,EACX,EAEMC,GAAyC,CAAC,CAAE,kBAAAC,CAAkB,KAAO,CACzE,GAAGA,EACH,KAAMC,GAAQ,CACZ,KAAM,CAAE,KAAAC,CAAK,EAAID,EAEjB,OAAIC,EAAK,GAAKA,EAAK,EAAE,MACZ,wBAAwBA,EAAK,EAAE,KAAK,KAAKA,EAAK,IAAI,UAEpDA,EAAK,IACd,CACF,GAQMC,GAAkBtB,GACtB,CACE,CACE,UAAAuB,EAAY,GACZ,GAAAC,EACA,WAAAC,EACA,KAAM,CAAE,MAA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,GACpB,IAAKH,GAAO,IACZ,UAAU,gCACV,eAAe,eACf,MAAK,GACL,KAAI,GACJ,YAAW,GACX,SAAQ,GACR,qBAAkB,GAClB,iBAAc,GAChB,EACApC,EAACgB,EAAA,CACC,SAAUuC,EACV,OAAQhB,GAAK,KAAO,GACpB,IAAKF,IAAa,KAAOD,GAAO,IAChC,UAAU,gCACV,eAAe,eACf,MAAK,GACL,KAAI,GACJ,YAAW,GACX,SAAQ,GACR,qBAAkB,GAClB,iBAAc,GAChB,GACF,EAGApC,EAAC,OAAI,IAAK2D,EAAU,UAAU,uCAAuC,GACvE,EAECN,GAAWlB,GACVnC,EAACY,GAAA,CAAW,QAASyC,EAAS,UAAWlB,EAAW,aAAc,IAAMmB,EAAW,EAAK,EAAG,GAE/F,CA8GN,CACF,EAEA1B,GAAgB,YAAc,kBAE9B,IAAO2E,GAAQ7F,GAAWkB,EAAe",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "useState", "useRef", "useMemo", "useEffect", "forwardRef", "useImperativeHandle", "useCallback", "cn", "withLayout", "Button", "VideoModal", "convertLexicalToHTML", "useInView", "useExposure", "ScrollLoadVideo", "gsap", "SplitText", "ScrollTrigger", "componentName", "componentType", "ANIMATION_CONFIG", "SMOOTHING_CONFIG", "htmlConverters", "defaultConverters", "args", "node", "MediaPlayerBase", "className", "id", "onBtnClick", "title", "videoTitle", "btnText", "youtubeId", "video", "mobileVideo", "theme", "img", "shape", "titleAnimation", "rest", "ref", "sticky", "isPlaying", "setIsPlaying", "btb", "setbtb", "titleHeight", "setTitleHeight", "videoHeightProgress", "setVideoHeightProgress", "visible", "setVisible", "videoRef", "bgRef", "titleRef", "titleFadeInRef", "trackRef", "splitTextInstance", "scrollTriggerRef", "heightTriggerRef", "layoutTargetsRef", "layoutInitializedRef", "stickyWrapperRef", "videoContainerRef", "videoPinTriggerRef", "inViewRef", "inView", "title_html", "videoTitle_html", "calculateLayout", "rect", "screenHeight", "inViewRefToBottom", "newBtb", "newTitleHeight", "resizeObserver", "scrollFrame", "handleScroll", "rafId", "smoothAnimate", "prev", "target", "delta", "titleElement", "height", "words", "total", "interval", "wordAnimations", "_", "i", "start", "width", "self", "progress", "word", "opacity", "zIndexVideo", "handleBtnClick", "aspect", "MediaPlayerBase_default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{Fragment as k,jsx as e,jsxs as p}from"react/jsx-runtime";import K,{useState as d,useRef as f,useEffect as y,forwardRef as U}from"react";import{debounce as X}from"es-toolkit";import{useInView as Z}from"react-intersection-observer";import{cn as v}from"../../helpers/utils.js";import{withLayout as D}from"../../shared/Styles.js";import ee from"../Slogan/index.js";import{YouTubePlayer as te}from"../VideoModal/YouTubePlayer.js";import{Grid as re,GridItem as x}from"../../components/gird.js";import{Container as ae}from"../../components/container.js";import se from"../BrandEquity/index.js";import oe from"../MemberEquity/index.js";import ne from"../Spacer/index.js";import ie from"gsap";import{convertLexicalToHTML as S}from"@payloadcms/richtext-lexical/html";import{useMediaQuery as T}from"react-responsive";import le from"../../helpers/ScrollLoadVideo.js";const L=({defaultConverters:s})=>({...s,text:o=>{const{node:t}=o;return t.$&&t.$.color?`<span class="lexical-${t.$.color}">${t.text}</span>`:t.text}}),N=({children:s,spaceY:o,className:t})=>{const a=T({query:"(max-width: 768px)"});return e(ae,{spaceY:o,className:v("!bg-transparent",t),children:p(re,{children:[!a&&e(x,{span:1}),e(x,{span:a?12:10,children:s}),!a&&e(x,{span:1})]})})},ce=K.forwardRef(({children:s,id:o,components:t},a)=>{const n=f(null);return p("div",{ref:n,className:"relative z-10",children:[e(k,{children:s}),e(k,{children:t?.map(r=>{switch(r.blockType){case"ipc-brand-equity":return e("div",{className:"relative z-20 bg-transparent",children:e(N,{spaceY:"none",children:e(se,{data:r,style:r?.style})})});case"ipc-member-equity":return e("div",{className:"relative z-20 w-full bg-transparent",children:e(N,{spaceY:"none",children:e(oe,{data:r,className:"w-full",style:r?.style})})});case"ipc-spacer":return e(ne,{data:r,style:r?.style,className:"!bg-transparent"});default:return null}})})]})}),de=U(({className:s="",wrapperClassName:o="",id:t,data:{title:a,videoTitle:n,mobVideo:r,mobImg:m,img:u,isYouTube:P,youtubePcId:M,youtubeMobileId:$,video:b,theme:R,shape:B,components:Y}},pe)=>{const H=f(null),w=f(null),{ref:q,inView:l}=Z(),[me,F]=d(0),[z,I]=d(!1),[j,G]=d(!1),V=f(null),Q=typeof a=="string"?a:a&&S({data:a,converters:L});typeof n=="string"||n&&S({data:n,converters:L});const[O,W]=d(0),[i,_]=d(!1),C=T({query:"(max-width: 768px)"});y(()=>{_(C)},[C]);const g=X(()=>{if(w.current){const h=w.current.getBoundingClientRect(),c=i?window.screen.height:window.innerHeight,A=window.scrollY||window.pageYOffset,J=h.bottom+A,E=document.documentElement.scrollHeight-J;W(E>c?c:E),F(c)}},2e3);return y(()=>{l&&!z&&(H.current?.play(),I(!0))},[l,z]),y(()=>(g(),window.addEventListener("resize",g),()=>{window.removeEventListener("resize",g)}),[]),y(()=>{function h(){const c=i?window.screen.height:window.innerHeight;ie.timeline({scrollTrigger:{trigger:`#${t}`,start:"top top",end:`top+=${c*1.8}px bottom`,scrub:.5}}).from(`#${t} .media-content`,{top:"50%",transform:"translate(-50%, -50%)"}).to(`.${t} .sticky-cover`,{backdropFilter:"blur(8px)",duration:.4}).to(`#${t} .media-content`,{top:"100%",transform:"translate(-50%, -100%)",duration:1},"<")}l&&h()},[l]),p(k,{children:[e("div",{id:t,className:v("relative z-20 h-screen w-full",s,{"aiui-dark":R==="dark","rounded-box":B==="rounded"}),ref:V,children:e("div",{ref:q,className:"media-content translate-z-0 absolute left-1/2 top-1/2 z-10 w-full -translate-x-1/2 -translate-y-1/2 antialiased",style:{willChange:"transform",contain:"paint"},children:e(N,{spaceY:"tablet:my-[32px] my-[24px] space-y-4",children:e(ee,{className:"sticky-title antialiased",data:{title:Q||"",theme:R}})})})}),p("div",{ref:w,style:{marginBottom:`-${O}px`,zIndex:l?2:1},className:v(t,"relative mt-[-200vh]",o),children:[e("div",{className:"sticky top-0 ",children:p("div",{className:v("media-cover","relative h-screen w-full"),children:[P?e(te,{youTubeId:i&&$||M}):b?.url&&e(le,{videoRef:H,poster:i&&m?.url?m?.url:u?.url,src:i&&r?.url?r?.url:b?.url,className:"lg-desktop:aspect-w-[1920] lg-desktop:aspect-h-[930] lg:aspect-w-[1440] lg:aspect-h-[700] desktop:aspect-w-[1024] desktop:aspect-h-[520] tablet:aspect-w-[768] tablet:aspect-h-[660] aspect-w-[390] aspect-h-[660]",videoClassName:" object-cover object-[82%]",muted:!0,loop:!1,playsInline:!0,onEnded:()=>{G(!0)}}),u?.url&&(!b?.url||j)&&e("img",{src:i&&m?.url?m?.url:u?.url,alt:u?.alt,className:"z-1 absolute left-0 top-0 size-full object-cover object-[82%]"}),e("div",{className:"sticky-cover absolute left-0 top-0 z-10 size-full",style:{backdropFilter:"blur(0px)",WebkitBackdropFilter:"blur(0px)",willChange:"backdrop-filter"}})]})}),e("div",{className:"relative h-screen w-full"}),e(ce,{components:Y}),e("div",{className:"relative h-screen w-full"})]})]})});var Se=D(de);export{Se as default};
|
|
1
|
+
"use client";import{Fragment as k,jsx as e,jsxs as p}from"react/jsx-runtime";import K,{useState as d,useRef as f,useEffect as y,forwardRef as U}from"react";import{debounce as X}from"es-toolkit";import{useInView as Z}from"react-intersection-observer";import{cn as v}from"../../helpers/utils.js";import{withLayout as D}from"../../shared/Styles.js";import ee from"../Slogan/index.js";import{YouTubePlayer as te}from"../VideoModal/YouTubePlayer.js";import{Grid as re,GridItem as x}from"../../components/gird.js";import{Container as ae}from"../../components/container.js";import se from"../BrandEquity/index.js";import oe from"../MemberEquity/index.js";import ne from"../Spacer/index.js";import ie from"gsap";import{convertLexicalToHTML as S}from"@payloadcms/richtext-lexical/html";import{useMediaQuery as T}from"react-responsive";import le from"../../helpers/ScrollLoadVideo.js";const L=({defaultConverters:s})=>({...s,text:o=>{const{node:t}=o;return t.$&&t.$.color?`<span class="lexical-${t.$.color}">${t.text}</span>`:t.text}}),N=({children:s,spaceY:o,className:t})=>{const a=T({query:"(max-width: 768px)"});return e(ae,{spaceY:o,className:v("!bg-transparent",t),children:p(re,{children:[!a&&e(x,{span:1}),e(x,{span:a?12:10,children:s}),!a&&e(x,{span:1})]})})},ce=K.forwardRef(({children:s,id:o,components:t},a)=>{const n=f(null);return p("div",{ref:n,className:"relative z-10",children:[e(k,{children:s}),e(k,{children:t?.map(r=>{switch(r.blockType){case"ipc-brand-equity":return e("div",{className:"relative z-20 bg-transparent",children:e(N,{spaceY:"none",children:e(se,{data:r,style:r?.style})})});case"ipc-member-equity":return e("div",{className:"relative z-20 w-full bg-transparent",children:e(N,{spaceY:"none",children:e(oe,{data:r,className:"w-full",style:r?.style})})});case"ipc-spacer":return e(ne,{data:r,style:r?.style,className:"!bg-transparent"});default:return null}})})]})}),de=U(({className:s="",wrapperClassName:o="",id:t,data:{title:a,videoTitle:n,mobVideo:r,mobImg:m,img:u,isYouTube:P,youtubePcId:M,youtubeMobileId:$,video:b,theme:R,shape:B,components:Y}},pe)=>{const H=f(null),w=f(null),{ref:q,inView:l}=Z(),[me,F]=d(0),[z,I]=d(!1),[j,G]=d(!1),V=f(null),Q=typeof a=="string"?a:a&&S({data:a,converters:L});typeof n=="string"||n&&S({data:n,converters:L});const[O,W]=d(0),[i,_]=d(!1),C=T({query:"(max-width: 768px)"});y(()=>{_(C)},[C]);const g=X(()=>{if(w.current){const h=w.current.getBoundingClientRect(),c=i?window.screen.height:window.innerHeight,A=window.scrollY||window.pageYOffset,J=h.bottom+A,E=document.documentElement.scrollHeight-J;W(E>c?c:E),F(c)}},2e3);return y(()=>{l&&!z&&(H.current?.play(),I(!0))},[l,z]),y(()=>(g(),window.addEventListener("resize",g),()=>{window.removeEventListener("resize",g)}),[]),y(()=>{function h(){const c=i?window.screen.height:window.innerHeight;ie.timeline({scrollTrigger:{trigger:`#${t}`,start:"top top",end:`top+=${c*1.8}px bottom`,scrub:.5}}).from(`#${t} .media-content`,{top:"50%",transform:"translate(-50%, -50%)"}).to(`.${t} .sticky-cover`,{backdropFilter:"blur(8px)",duration:.4}).to(`#${t} .media-content`,{top:"100%",transform:"translate(-50%, -100%)",duration:1},"<")}l&&h()},[l]),p(k,{children:[e("div",{id:t,className:v("relative z-20 h-screen w-full",s,{"aiui-dark":R==="dark","rounded-box":B==="rounded"}),ref:V,children:e("div",{ref:q,className:"media-content translate-z-0 absolute left-1/2 top-1/2 z-10 w-full -translate-x-1/2 -translate-y-1/2 antialiased",style:{willChange:"transform",contain:"paint"},children:e(N,{spaceY:"tablet:my-[32px] my-[24px] space-y-4",children:e(ee,{className:"sticky-title antialiased",data:{title:Q||"",theme:R}})})})}),p("div",{ref:w,style:{marginBottom:`-${O}px`,zIndex:l?2:1},className:v(t,"relative mt-[-200vh]",o),children:[e("div",{className:"sticky top-0 ",children:p("div",{className:v("media-cover","relative h-screen w-full"),children:[P?e(te,{youTubeId:i&&$||M}):b?.url&&e(le,{videoRef:H,poster:i&&m?.url?m?.url:u?.url,src:i&&r?.url?r?.url:b?.url,className:"lg-desktop:aspect-w-[1920] lg-desktop:aspect-h-[930] lg:aspect-w-[1440] lg:aspect-h-[700] desktop:aspect-w-[1024] desktop:aspect-h-[520] tablet:aspect-w-[768] tablet:aspect-h-[660] aspect-w-[390] aspect-h-[660]",videoClassName:" object-cover object-[82%]",muted:!0,loop:!1,playsInline:!0,onEnded:()=>{G(!0)}}),u?.url&&(!b?.url||j)&&e("img",{src:i&&m?.url?m?.url:u?.url,alt:u?.alt,className:"z-1 absolute left-0 top-0 size-full object-cover object-[82%]",loading:"lazy"}),e("div",{className:"sticky-cover absolute left-0 top-0 z-10 size-full",style:{backdropFilter:"blur(0px)",WebkitBackdropFilter:"blur(0px)",willChange:"backdrop-filter"}})]})}),e("div",{className:"relative h-screen w-full"}),e(ce,{components:Y}),e("div",{className:"relative h-screen w-full"})]})]})});var Se=D(de);export{Se as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|