@anker-in/headless-ui 1.1.81 → 1.1.82
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/AccordionCards/index.d.ts +1 -36
- package/dist/cjs/biz-components/ActivitySchedule/index.d.ts +1 -3
- package/dist/cjs/biz-components/AiuiProvider/index.d.ts +1 -13
- package/dist/cjs/biz-components/AiuiProvider/index.js +1 -1
- package/dist/cjs/biz-components/AiuiProvider/index.js.map +3 -3
- package/dist/cjs/biz-components/AnchorNavigation/index.d.ts +1 -1
- package/dist/cjs/biz-components/AplusDesc/index.d.ts +1 -17
- package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.d.ts +1 -2
- package/dist/cjs/biz-components/BrandEquity/BrandEquity.d.ts +1 -2
- package/dist/cjs/biz-components/Category/index.d.ts +1 -1
- package/dist/cjs/biz-components/CreativeModule/index.d.ts +1 -7
- package/dist/cjs/biz-components/DownLoad/index.d.ts +1 -6
- package/dist/cjs/biz-components/Evaluate/index.d.ts +1 -1
- package/dist/cjs/biz-components/Faq/Faq.d.ts +2 -3
- package/dist/cjs/biz-components/FeatureCards/FeatureCards.d.ts +1 -3
- package/dist/cjs/biz-components/FeatureShowcase/FeatureShowcase.d.ts +1 -3
- package/dist/cjs/biz-components/Features/index.d.ts +1 -8
- package/dist/cjs/biz-components/FootCharger/index.d.ts +1 -7
- package/dist/cjs/biz-components/FooterNavigation/index.d.ts +1 -2
- package/dist/cjs/biz-components/GiftBox/index.d.ts +1 -3
- package/dist/cjs/biz-components/GiftShelf/index.d.ts +1 -3
- package/dist/cjs/biz-components/GiftTierShelf/index.d.ts +1 -3
- package/dist/cjs/biz-components/Graphic/index.d.ts +1 -1
- package/dist/cjs/biz-components/GraphicAttractionBlock/index.d.ts +1 -1
- package/dist/cjs/biz-components/GraphicMore/index.d.ts +1 -7
- package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.d.ts +2 -10
- package/dist/cjs/biz-components/HeaderNavigation/index.d.ts +1 -3
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.d.ts +1 -5
- package/dist/cjs/biz-components/ImageTextFeature/ImageTextFeature.d.ts +1 -3
- package/dist/cjs/biz-components/ImageWithText/ImageWithText.d.ts +1 -3
- package/dist/cjs/biz-components/Ksp/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/PaidShipping/index.d.ts +1 -11
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.d.ts +1 -26
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductPaidShipping/index.d.ts +1 -11
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.d.ts +1 -2
- package/dist/cjs/biz-components/Marquee/Marquee.d.ts +2 -3
- package/dist/cjs/biz-components/MarqueeReview/index.d.ts +1 -1
- package/dist/cjs/biz-components/MediaEndorsement/index.d.ts +1 -2
- package/dist/cjs/biz-components/MediaPlayerBase/index.d.ts +1 -2
- package/dist/cjs/biz-components/MediaPlayerBase/index.js +1 -1
- package/dist/cjs/biz-components/MediaPlayerBase/index.js.map +2 -2
- package/dist/cjs/biz-components/MediaPlayerMulti/index.d.ts +1 -2
- package/dist/cjs/biz-components/MediaPlayerSticky/index.d.ts +1 -5
- package/dist/cjs/biz-components/MediaSceneSwitcher/MediaSceneSwitcher.d.ts +1 -2
- package/dist/cjs/biz-components/MediaSceneSwitcherV2/index.d.ts +1 -1
- package/dist/cjs/biz-components/MemberEquity/index.d.ts +1 -3
- package/dist/cjs/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.d.ts +2 -17
- package/dist/cjs/biz-components/NavigationSearch/index.d.ts +1 -2
- package/dist/cjs/biz-components/ProductCompare/index.d.ts +1 -1
- package/dist/cjs/biz-components/ProductHero/ProductHero.d.ts +1 -3
- package/dist/cjs/biz-components/ProductNav/ProductNav.d.ts +1 -2
- package/dist/cjs/biz-components/PromotionalBar/index.d.ts +1 -1
- package/dist/cjs/biz-components/SecondaryBanner/index.d.ts +1 -1
- package/dist/cjs/biz-components/SelectStore/index.d.ts +1 -7
- package/dist/cjs/biz-components/ShelfDisplay/index.d.ts +1 -3
- package/dist/cjs/biz-components/Slogan/index.d.ts +1 -3
- package/dist/cjs/biz-components/Spacer/index.d.ts +1 -3
- package/dist/cjs/biz-components/Specs/index.d.ts +1 -1
- package/dist/cjs/biz-components/SpecsComparison/SpecsComparison.d.ts +1 -3
- package/dist/cjs/biz-components/TabWithImage/TabWithImage.d.ts +1 -3
- package/dist/cjs/biz-components/Tabs/Tabs.d.ts +1 -3
- package/dist/cjs/biz-components/TabsGroup/index.d.ts +1 -3
- package/dist/cjs/biz-components/TabsWithMedia/TabsWithMedia.d.ts +1 -3
- package/dist/cjs/biz-components/ThreeDCarousel/ThreeDCarousel.d.ts +1 -3
- package/dist/cjs/biz-components/Title/index.d.ts +1 -1
- package/dist/cjs/biz-components/VideoFeature/VideoFeature.d.ts +1 -3
- package/dist/cjs/biz-components/WheelLottery/index.d.ts +1 -1
- package/dist/cjs/biz-components/WhyChoose/WhyChoose.d.ts +2 -3
- package/dist/cjs/helpers/ScrollLoadVideo.js +1 -1
- package/dist/cjs/helpers/ScrollLoadVideo.js.map +2 -2
- package/dist/cjs/shared/Styles.d.ts +1 -2
- package/dist/cjs/shared/Styles.js +1 -1
- package/dist/cjs/shared/Styles.js.map +2 -2
- package/dist/esm/biz-components/AccordionCards/index.d.ts +1 -36
- package/dist/esm/biz-components/ActivitySchedule/index.d.ts +1 -3
- package/dist/esm/biz-components/AiuiProvider/index.d.ts +1 -13
- package/dist/esm/biz-components/AiuiProvider/index.js +1 -1
- package/dist/esm/biz-components/AiuiProvider/index.js.map +3 -3
- package/dist/esm/biz-components/AnchorNavigation/index.d.ts +1 -1
- package/dist/esm/biz-components/AplusDesc/index.d.ts +1 -17
- package/dist/esm/biz-components/BrandCardLink/BrandCardLink.d.ts +1 -2
- package/dist/esm/biz-components/BrandEquity/BrandEquity.d.ts +1 -2
- package/dist/esm/biz-components/Category/index.d.ts +1 -1
- package/dist/esm/biz-components/CreativeModule/index.d.ts +1 -7
- package/dist/esm/biz-components/DownLoad/index.d.ts +1 -6
- package/dist/esm/biz-components/Evaluate/index.d.ts +1 -1
- package/dist/esm/biz-components/Faq/Faq.d.ts +2 -3
- package/dist/esm/biz-components/FeatureCards/FeatureCards.d.ts +1 -3
- package/dist/esm/biz-components/FeatureShowcase/FeatureShowcase.d.ts +1 -3
- package/dist/esm/biz-components/Features/index.d.ts +1 -8
- package/dist/esm/biz-components/FootCharger/index.d.ts +1 -7
- package/dist/esm/biz-components/FooterNavigation/index.d.ts +1 -2
- package/dist/esm/biz-components/GiftBox/index.d.ts +1 -3
- package/dist/esm/biz-components/GiftShelf/index.d.ts +1 -3
- package/dist/esm/biz-components/GiftTierShelf/index.d.ts +1 -3
- package/dist/esm/biz-components/Graphic/index.d.ts +1 -1
- package/dist/esm/biz-components/GraphicAttractionBlock/index.d.ts +1 -1
- package/dist/esm/biz-components/GraphicMore/index.d.ts +1 -7
- package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.d.ts +2 -10
- package/dist/esm/biz-components/HeaderNavigation/index.d.ts +1 -3
- package/dist/esm/biz-components/HeroBanner/HeroBanner.d.ts +1 -5
- package/dist/esm/biz-components/ImageTextFeature/ImageTextFeature.d.ts +1 -3
- package/dist/esm/biz-components/ImageWithText/ImageWithText.d.ts +1 -3
- package/dist/esm/biz-components/Ksp/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/PaidShipping/index.d.ts +1 -11
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.d.ts +1 -26
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductOptions/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductPaidShipping/index.d.ts +1 -11
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/PurchaseBar/index.d.ts +1 -2
- package/dist/esm/biz-components/Marquee/Marquee.d.ts +2 -3
- package/dist/esm/biz-components/MarqueeReview/index.d.ts +1 -1
- package/dist/esm/biz-components/MediaEndorsement/index.d.ts +1 -2
- package/dist/esm/biz-components/MediaPlayerBase/index.d.ts +1 -2
- package/dist/esm/biz-components/MediaPlayerBase/index.js +1 -1
- package/dist/esm/biz-components/MediaPlayerBase/index.js.map +2 -2
- package/dist/esm/biz-components/MediaPlayerMulti/index.d.ts +1 -2
- package/dist/esm/biz-components/MediaPlayerSticky/index.d.ts +1 -5
- package/dist/esm/biz-components/MediaSceneSwitcher/MediaSceneSwitcher.d.ts +1 -2
- package/dist/esm/biz-components/MediaSceneSwitcherV2/index.d.ts +1 -1
- package/dist/esm/biz-components/MemberEquity/index.d.ts +1 -3
- package/dist/esm/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.d.ts +2 -17
- package/dist/esm/biz-components/NavigationSearch/index.d.ts +1 -2
- package/dist/esm/biz-components/ProductCompare/index.d.ts +1 -1
- package/dist/esm/biz-components/ProductHero/ProductHero.d.ts +1 -3
- package/dist/esm/biz-components/ProductNav/ProductNav.d.ts +1 -2
- package/dist/esm/biz-components/PromotionalBar/index.d.ts +1 -1
- package/dist/esm/biz-components/SecondaryBanner/index.d.ts +1 -1
- package/dist/esm/biz-components/SelectStore/index.d.ts +1 -7
- package/dist/esm/biz-components/ShelfDisplay/index.d.ts +1 -3
- package/dist/esm/biz-components/Slogan/index.d.ts +1 -3
- package/dist/esm/biz-components/Spacer/index.d.ts +1 -3
- package/dist/esm/biz-components/Specs/index.d.ts +1 -1
- package/dist/esm/biz-components/SpecsComparison/SpecsComparison.d.ts +1 -3
- package/dist/esm/biz-components/TabWithImage/TabWithImage.d.ts +1 -3
- package/dist/esm/biz-components/Tabs/Tabs.d.ts +1 -3
- package/dist/esm/biz-components/TabsGroup/index.d.ts +1 -3
- package/dist/esm/biz-components/TabsWithMedia/TabsWithMedia.d.ts +1 -3
- package/dist/esm/biz-components/ThreeDCarousel/ThreeDCarousel.d.ts +1 -3
- package/dist/esm/biz-components/Title/index.d.ts +1 -1
- package/dist/esm/biz-components/VideoFeature/VideoFeature.d.ts +1 -3
- package/dist/esm/biz-components/WheelLottery/index.d.ts +1 -1
- package/dist/esm/biz-components/WhyChoose/WhyChoose.d.ts +2 -3
- package/dist/esm/helpers/ScrollLoadVideo.js +1 -1
- package/dist/esm/helpers/ScrollLoadVideo.js.map +2 -2
- package/dist/esm/shared/Styles.d.ts +1 -2
- package/dist/esm/shared/Styles.js +1 -1
- package/dist/esm/shared/Styles.js.map +2 -2
- package/package.json +1 -1
- package/dist/cjs/biz-components/AiuiProvider/useAutoTracking.d.ts +0 -17
- package/dist/cjs/biz-components/AiuiProvider/useAutoTracking.js +0 -2
- package/dist/cjs/biz-components/AiuiProvider/useAutoTracking.js.map +0 -7
- package/dist/esm/biz-components/AiuiProvider/useAutoTracking.d.ts +0 -17
- package/dist/esm/biz-components/AiuiProvider/useAutoTracking.js +0 -2
- package/dist/esm/biz-components/AiuiProvider/useAutoTracking.js.map +0 -7
|
@@ -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\n// \u6CE8\u518C gsap \u63D2\u4EF6\ngsap.registerPlugin(ScrollTrigger, SplitText)\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: {\n title,\n videoTitle,\n btnText,\n youtubeId,\n video,\n mobileVideo,\n theme,\n img,\n shape,\n titleAnimation = 'fade-in',\n ...dataRest\n },\n ...rest\n },\n ref\n ) => {\n const { sticky } = dataRest\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 btnFadeInRef = useRef<HTMLButtonElement>(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 if (btnFadeInRef.current) gsap.set(btnFadeInRef.current, { 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 if (btnFadeInRef.current) {\n gsap.set(btnFadeInRef.current, { opacity: progress >= 0.6 ? 1 : 0 })\n }\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 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: title_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 {...rest}\n ref={titleRef}\n className={cn(\n 'pointer-events-none 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-info-primary 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-info-primary 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-info-primary')}\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 {...(!sticky ? rest : {})}\n style={\n sticky\n ? {\n marginBottom: `-${btb}px`,\n marginTop: `-${titleHeight}px`,\n zIndex: zIndexVideo,\n }\n : { zIndex: 5 }\n }\n className={cn('relative', className)}\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' && (\n <div\n className={cn(\n 'absolute z-30 flex w-full flex-col items-center justify-center gap-4 px-4 text-center',\n sticky ? 'left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2' : 'left-0 top-0'\n )}\n >\n {title_html && (\n <div\n ref={titleFadeInRef}\n className=\"media-player-base-title lg-desktop:text-[64px] text-info-primary text-[40px] font-bold leading-none lg:text-5xl\"\n dangerouslySetInnerHTML={{ __html: title_html }}\n />\n )}\n {btnText && (\n <Button\n ref={btnFadeInRef}\n variant=\"link\"\n className={cn('media-player-base-button member-equity-button-secondary text-info-primary')}\n onClick={() => {\n setVisible(true)\n onBtnClick && onBtnClick?.()\n }}\n >\n {btnText}\n </Button>\n )}\n </div>\n )}\n <div\n className=\"media-cover left-0 top-0 h-screen w-screen overflow-hidden\"\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 !h-auto\"\n videoClassName=\"object-cover\"\n muted\n loop\n playsInline\n autoplay\n webkit-playsinline=\"true\"\n x5-playsinline=\"true\"\n />\n <ScrollLoadVideo\n videoRef={videoRef}\n poster={img?.url || ''}\n src={mobileVideo?.url || video?.url!}\n className=\"tablet:hidden block min-h-screen w-full\"\n videoClassName=\"object-cover w-full h-auto\"\n muted\n loop\n playsInline\n autoplay\n webkit-playsinline=\"true\"\n x5-playsinline=\"true\"\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 {sticky && (\n <div\n className={cn(sticky && 'pointer-events-none relative box-content block', aspect)}\n style={sticky ? { height: `${btb}px` } : {}}\n ref={trackRef}\n />\n )}\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": "aAuMM,mBAAAA,GAmBc,OAAAC,EAFJ,QAAAC,MAjBV,oBAtMN,OAAS,YAAAC,EAAU,UAAAC,EAAQ,WAAAC,GAAS,aAAAC,EAAW,cAAAC,GAAY,uBAAAC,OAA2B,QACtF,OAAS,YAAAC,OAAgB,SACzB,OAAS,MAAAC,MAAU,yBACnB,OAAS,cAAAC,OAAkB,yBAC3B,OAAOC,MAAY,6BACnB,OAAS,cAAAC,OAAkB,yBAC3B,OAAS,wBAAAC,MAA4B,oCAGrC,OAAS,aAAAC,OAAiB,8BAE1B,OAAS,eAAAC,OAAmB,6BAC5B,OAAOC,MAAqB,mCAC5B,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,OAAiB,sBAC1B,OAAS,iBAAAC,MAAqB,0BAE9B,MAAMC,GAAgB,oBAChBC,GAAgB,QAGtBJ,EAAK,eAAeE,EAAeD,EAAS,EAE5C,MAAMI,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,GAEMC,GAAkBpB,GACtB,CACE,CACE,UAAAqB,EAAY,GACZ,GAAAC,EACA,WAAAC,EACA,KAAM,CACJ,MAAAC,EACA,WAAAC,EACA,QAAAC,EACA,UAAAC,EACA,MAAAC,EACA,YAAAC,GACA,MAAAC,EACA,IAAAC,EACA,MAAAC,EACA,eAAAC,EAAiB,UACjB,GAAGC,EACL,EACA,GAAGC,CAC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AAQ,OACR,UAAWF,EAAG,kDAAkD,EAChE,QAAS,IAAM,CACb4C,EAAW,EAAI,EAYfxB,GAAcA,IAAa,CAC7B,EAEC,SAAAG,EAEH,GAEJ,EAEJ,EACF,EAEF/B,EAAC,OACE,GAAK0C,EAAgB,CAAC,EAARF,EACf,MACEE,EACI,CACE,aAAc,IAAIG,CAAG,KACrB,UAAW,IAAIE,EAAW,KAC1B,OAAQuC,EACV,EACA,CAAE,OAAQ,CAAE,EAElB,UAAW9E,EAAG,WAAYkB,CAAS,EAEnC,UAAA3B,EAAC,OAAI,UAAU,gBACb,SAAAC,EAAC,OACC,GAAI2B,EACJ,UAAWnB,EAAG,2BAA4BkC,EAAS,kBAAoB6C,EAAQ,CAC7E,YAAapD,IAAU,OACvB,cAAeE,IAAU,SAC3B,CAAC,EAEA,UAAAC,IAAmB,WAClBtC,EAAC,OACC,UAAWQ,EACT,wFACAkC,EAAS,qDAAuD,cAClE,EAEC,UAAAsB,GACCjE,EAAC,OACC,IAAKyD,EACL,UAAU,kHACV,wBAAyB,CAAE,OAAQQ,CAAW,EAChD,EAEDjC,GACChC,EAACW,EAAA,CACC,IAAKiD,EACL,QAAQ,OACR,UAAWnD,EAAG,2EAA2E,EACzF,QAAS,IAAM,CACb4C,EAAW,EAAI,EACfxB,GAAcA,IAAa,CAC7B,EAEC,SAAAG,EACH,GAEJ,EAEF/B,EAAC,OACC,UAAU,6DACV,MAAO,CAAE,OAAQ,GAAG,IAAMiD,EAAsB,GAAG,IAAK,EAExD,UAAAlD,EAACgB,EAAA,CACC,SAAUsC,EACV,OAAQjB,GAAK,KAAO,GACpB,IAAKH,GAAO,IACZ,UAAU,wCACV,eAAe,eACf,MAAK,GACL,KAAI,GACJ,YAAW,GACX,SAAQ,GACR,
|
|
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\n// \u6CE8\u518C gsap \u63D2\u4EF6\ngsap.registerPlugin(ScrollTrigger, SplitText)\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: {\n title,\n videoTitle,\n btnText,\n youtubeId,\n video,\n mobileVideo,\n theme,\n img,\n shape,\n titleAnimation = 'fade-in',\n ...dataRest\n },\n ...rest\n },\n ref\n ) => {\n const { sticky } = dataRest\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 btnFadeInRef = useRef<HTMLButtonElement>(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 if (btnFadeInRef.current) gsap.set(btnFadeInRef.current, { 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 if (btnFadeInRef.current) {\n gsap.set(btnFadeInRef.current, { opacity: progress >= 0.6 ? 1 : 0 })\n }\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 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: title_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 {...rest}\n ref={titleRef}\n className={cn(\n 'pointer-events-none 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-info-primary 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-info-primary 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-info-primary')}\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 {...(!sticky ? rest : {})}\n style={\n sticky\n ? {\n marginBottom: `-${btb}px`,\n marginTop: `-${titleHeight}px`,\n zIndex: zIndexVideo,\n }\n : { zIndex: 5 }\n }\n className={cn('relative', className)}\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' && (\n <div\n className={cn(\n 'absolute z-30 flex w-full flex-col items-center justify-center gap-4 px-4 text-center',\n sticky ? 'left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2' : 'left-0 top-0'\n )}\n >\n {title_html && (\n <div\n ref={titleFadeInRef}\n className=\"media-player-base-title lg-desktop:text-[64px] text-info-primary text-[40px] font-bold leading-none lg:text-5xl\"\n dangerouslySetInnerHTML={{ __html: title_html }}\n />\n )}\n {btnText && (\n <Button\n ref={btnFadeInRef}\n variant=\"link\"\n className={cn('media-player-base-button member-equity-button-secondary text-info-primary')}\n onClick={() => {\n setVisible(true)\n onBtnClick && onBtnClick?.()\n }}\n >\n {btnText}\n </Button>\n )}\n </div>\n )}\n <div\n className=\"media-cover left-0 top-0 h-screen w-screen overflow-hidden\"\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 !h-auto\"\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 min-h-screen w-full\"\n videoClassName=\"object-cover w-full h-auto\"\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 {sticky && (\n <div\n className={cn(sticky && 'pointer-events-none relative box-content block', aspect)}\n style={sticky ? { height: `${btb}px` } : {}}\n ref={trackRef}\n />\n )}\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": "aAuMM,mBAAAA,GAmBc,OAAAC,EAFJ,QAAAC,MAjBV,oBAtMN,OAAS,YAAAC,EAAU,UAAAC,EAAQ,WAAAC,GAAS,aAAAC,EAAW,cAAAC,GAAY,uBAAAC,OAA2B,QACtF,OAAS,YAAAC,OAAgB,SACzB,OAAS,MAAAC,MAAU,yBACnB,OAAS,cAAAC,OAAkB,yBAC3B,OAAOC,MAAY,6BACnB,OAAS,cAAA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E9B,IAAO+D,GAAQ/E,GAAWgB,EAAe",
|
|
6
6
|
"names": ["Fragment", "jsx", "jsxs", "useState", "useRef", "useMemo", "useEffect", "forwardRef", "useImperativeHandle", "debounce", "cn", "withLayout", "Button", "VideoModal", "convertLexicalToHTML", "useInView", "useExposure", "ScrollLoadVideo", "gsap", "SplitText", "ScrollTrigger", "componentName", "componentType", "htmlConverters", "defaultConverters", "args", "node", "MediaPlayerBase", "className", "id", "onBtnClick", "title", "videoTitle", "btnText", "youtubeId", "video", "mobileVideo", "theme", "img", "shape", "titleAnimation", "dataRest", "rest", "ref", "sticky", "isPlaying", "setIsPlaying", "btb", "setbtb", "titleHeight", "setTitleHeight", "videoHeightProgress", "setVideoHeightProgress", "visible", "setVisible", "videoRef", "bgRef", "titleRef", "titleFadeInRef", "trackRef", "splitTextInstance", "btnFadeInRef", "scrollTriggerRef", "heightTriggerRef", "inViewRef", "inView", "title_html", "videoTitle_html", "debouncedHandleResize", "rect", "screenHeight", "scrollTop", "elementBottomToPageTop", "distanceToPageBottom", "gsapResize", "height", "words", "self", "progress", "total", "interval", "overlap", "word", "i", "start", "width", "opacity", "gsapVideoHeightResize", "zIndexVideo", "aspect", "MediaPlayerBase_default"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: import("react").ForwardRefExoticComponent<MediaPlayerMultiProps & import("react").RefAttributes<HTMLDivElement> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps>>;
|
|
1
|
+
declare const _default: any;
|
|
3
2
|
export default _default;
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { MediaPlayerBaseProps } from './types.js';
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<MediaPlayerBaseProps & React.RefAttributes<{
|
|
4
|
-
mediaPlayerStickyRef: HTMLDivElement;
|
|
5
|
-
}> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps>>;
|
|
1
|
+
declare const _default: any;
|
|
6
2
|
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { MediaSceneSwitcherProps } from './types.js';
|
|
2
1
|
import 'swiper/css';
|
|
3
|
-
declare const _default:
|
|
2
|
+
declare const _default: any;
|
|
4
3
|
export default _default;
|
|
@@ -54,5 +54,5 @@ export interface MediaSceneSwitcherV2Props extends React.HTMLAttributes<HTMLDivE
|
|
|
54
54
|
/** 场景切换回调 */
|
|
55
55
|
onSceneChange?: (index: number, scene: MediaSceneSwitcherV2Item) => void;
|
|
56
56
|
}
|
|
57
|
-
declare const _default:
|
|
57
|
+
declare const _default: any;
|
|
58
58
|
export default _default;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { MemberEquityProps } from './types.js';
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<MemberEquityProps & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps> & React.RefAttributes<any>>;
|
|
1
|
+
declare const _default: any;
|
|
4
2
|
export default _default;
|
|
@@ -1,19 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
4
|
-
onSecondaryButtonClick?: () => void;
|
|
5
|
-
onPrimaryButtonClick?: () => void;
|
|
6
|
-
data: {
|
|
7
|
-
shape?: import("../../types/props").Shape;
|
|
8
|
-
sectionTitle?: string;
|
|
9
|
-
groupByTab?: boolean;
|
|
10
|
-
items: ({
|
|
11
|
-
width?: "full" | "half" | "one-third";
|
|
12
|
-
} & Item)[];
|
|
13
|
-
carousel?: {
|
|
14
|
-
items: Item[];
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
} & React.RefAttributes<HTMLDivElement> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps>>;
|
|
1
|
+
import type { MultiLayoutGraphicBlockProps } from './types';
|
|
2
|
+
declare const _default: any;
|
|
18
3
|
export default _default;
|
|
19
4
|
export type { MultiLayoutGraphicBlockProps };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { NavigationSearchProps } from './types.js';
|
|
2
1
|
export declare const canSearch: (target: any) => boolean;
|
|
3
|
-
declare const _default:
|
|
2
|
+
declare const _default: any;
|
|
4
3
|
export default _default;
|
|
@@ -44,5 +44,5 @@ export interface ProductCompareProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
44
44
|
theme?: Theme;
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
declare const _default:
|
|
47
|
+
declare const _default: any;
|
|
48
48
|
export default _default;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ProductHeroProps } from './types.js';
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<ProductHeroProps & React.RefAttributes<HTMLDivElement> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps>>;
|
|
1
|
+
declare const _default: any;
|
|
4
2
|
export default _default;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
declare const _default: import("react").ForwardRefExoticComponent<ProductNavProps & import("react").RefAttributes<HTMLDivElement> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps>>;
|
|
1
|
+
declare const _default: any;
|
|
3
2
|
export default _default;
|
|
@@ -42,5 +42,5 @@ export interface PromotionalBarProps extends React.HTMLAttributes<HTMLDivElement
|
|
|
42
42
|
data: PromotionalBarData;
|
|
43
43
|
classNames?: Partial<Record<keyof PromotionalBarSemanticName, string>>;
|
|
44
44
|
}
|
|
45
|
-
declare const _default:
|
|
45
|
+
declare const _default: any;
|
|
46
46
|
export default _default;
|
|
@@ -87,5 +87,5 @@ export interface SecondaryBannerProps extends React.HTMLAttributes<HTMLElement>
|
|
|
87
87
|
*/
|
|
88
88
|
jumpOptions?: JumpOptions;
|
|
89
89
|
}
|
|
90
|
-
declare const _default:
|
|
90
|
+
declare const _default: any;
|
|
91
91
|
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import type { Img } from '../../types/props.js';
|
|
3
2
|
export type SelectStoreDataType = {
|
|
4
3
|
title: string;
|
|
@@ -8,10 +7,5 @@ export type SelectStoreDataType = {
|
|
|
8
7
|
padImg: Img;
|
|
9
8
|
miniImg: Img;
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
data: {
|
|
13
|
-
list: SelectStoreDataType[];
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
declare const _default: React.ForwardRefExoticComponent<SelectStoreType & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps> & React.RefAttributes<any>>;
|
|
10
|
+
declare const _default: any;
|
|
17
11
|
export default _default;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ShelfDisplayProps } from './shelfDisplay.js';
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<ShelfDisplayProps & React.RefAttributes<HTMLDivElement> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps>>;
|
|
1
|
+
declare const _default: any;
|
|
4
2
|
export default _default;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { SloganProps } from './types.js';
|
|
3
1
|
export declare const componentType = "copy";
|
|
4
2
|
export declare const componentName = "brand_slogan";
|
|
5
|
-
declare const _default:
|
|
3
|
+
declare const _default: any;
|
|
6
4
|
export default _default;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { SpacerProps } from './types.js';
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<SpacerProps & React.RefAttributes<HTMLDivElement> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps>>;
|
|
1
|
+
declare const _default: any;
|
|
4
2
|
export default _default;
|
|
@@ -5,5 +5,5 @@ export interface SpecsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, '
|
|
|
5
5
|
onChange?: (product: any, index: number) => void;
|
|
6
6
|
onSecondaryChange?: (data: any) => void;
|
|
7
7
|
}
|
|
8
|
-
declare const _default:
|
|
8
|
+
declare const _default: any;
|
|
9
9
|
export default _default;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { SpecsComparisonProps } from './types.js';
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<SpecsComparisonProps & React.RefAttributes<HTMLDivElement> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps>>;
|
|
1
|
+
declare const _default: any;
|
|
4
2
|
export default _default;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { TabWithImageProps } from './types.js';
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<TabWithImageProps & React.RefAttributes<HTMLDivElement> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps>>;
|
|
1
|
+
declare const _default: any;
|
|
4
2
|
export default _default;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import React from 'react';
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps>>;
|
|
1
|
+
declare const _default: any;
|
|
4
2
|
export default _default;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import React from 'react';
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<TabsGroupProps & React.RefAttributes<HTMLDivElement> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps>>;
|
|
1
|
+
declare const _default: any;
|
|
4
2
|
export default _default;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { TabsWithMediaProps } from './types.js';
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<TabsWithMediaProps & React.RefAttributes<HTMLDivElement> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps>>;
|
|
1
|
+
declare const _default: any;
|
|
4
2
|
export default _default;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ThreeDCarouselProps } from './types.js';
|
|
3
1
|
import 'swiper/css';
|
|
4
2
|
import 'swiper/css/navigation';
|
|
5
3
|
import 'swiper/css/pagination';
|
|
6
4
|
import 'swiper/css/effect-coverflow';
|
|
7
|
-
declare const _default:
|
|
5
|
+
declare const _default: any;
|
|
8
6
|
export default _default;
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import type { TitlePropsBase } from './types.js';
|
|
3
3
|
export interface TitleProps extends TitlePropsBase, Omit<React.HTMLAttributes<HTMLDivElement>, 'className' | 'title'> {
|
|
4
4
|
}
|
|
5
|
-
declare const _default:
|
|
5
|
+
declare const _default: any;
|
|
6
6
|
export default _default;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { VideoFeatureProps } from './types.js';
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<VideoFeatureProps & React.RefAttributes<HTMLDivElement> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps>>;
|
|
1
|
+
declare const _default: any;
|
|
4
2
|
export default _default;
|
|
@@ -32,7 +32,7 @@ import type { WheelLotteryProps, WheelLotteryHandle } from './types.js';
|
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
34
|
export declare const WheelLottery: import("react").ForwardRefExoticComponent<WheelLotteryProps & import("react").RefAttributes<WheelLotteryHandle>>;
|
|
35
|
-
declare const _default:
|
|
35
|
+
declare const _default: any;
|
|
36
36
|
export default _default;
|
|
37
37
|
export { WinnerModal } from './WinnerModal.js';
|
|
38
38
|
export { RulesModal } from './RulesModal.js';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { WhyChooseProps, WhyChooseItem as ItemType } from './types.js';
|
|
1
|
+
import type { WhyChooseItem as ItemType } from './types.js';
|
|
3
2
|
declare const WhyChooseItem: {
|
|
4
3
|
({ data }: {
|
|
5
4
|
data: ItemType;
|
|
6
5
|
}): import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
displayName: string;
|
|
8
7
|
};
|
|
9
|
-
declare const _default:
|
|
8
|
+
declare const _default: any;
|
|
10
9
|
export default _default;
|
|
11
10
|
export { WhyChooseItem };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as m}from"react/jsx-runtime";import{useRef as i,useEffect as
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import{useRef as i,useEffect as u,useState as N}from"react";import{cn as f}from"../helpers/utils.js";const T=({src:v,poster:b,className:p="",videoClassName:h="",autoplay:g=!0,muted:y=!0,loop:t=!0,controls:L=!1,playsInline:E=!0,videoRef:R,intersectionObserverConfig:M={threshold:0,rootMargin:"200px"},...V})=>{const[o,P]=N(!1),w=i(null),l=i(null),a=i(!1),e=R||w,{threshold:c,rootMargin:d}=M;return u(()=>{const n=e.current;if(!n||t)return;const r=()=>{a.current=!0};return n.addEventListener("ended",r),()=>{n.removeEventListener("ended",r)}},[e,t,o]),u(()=>{const n=new IntersectionObserver(I=>{I.forEach(S=>{if(S.isIntersecting){if(o||P(!0),e.current){const s=e.current;if(!t&&a.current)return;s.muted=!0,s.currentTime=0,s.play().catch(k=>{console.warn("\u89C6\u9891\u81EA\u52A8\u64AD\u653E\u5931\u8D25:",k)})}}else e.current&&e.current.pause()})},{threshold:c,rootMargin:d}),r=l.current;return r&&n.observe(r),()=>{r&&n.unobserve(r)}},[e,t,d,o,c]),m("div",{ref:l,className:f("relative size-full",p),children:m("video",{ref:e,src:o?v:void 0,poster:o?b:void 0,className:f("size-full object-cover",h),loop:t,muted:y,controls:L,playsInline:E,preload:"metadata",disablePictureInPicture:!0,"webkit-playsinline":!0,autoPlay:g,...V})})};var z=T;export{z as default};
|
|
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, { useRef, useEffect, useState } from 'react'\nimport { cn } from '../helpers/utils.js'\n\ninterface ScrollLoadVideoProps {\n src: string\n poster?: string\n className?: string\n videoClassName?: string\n autoplay?: boolean\n muted?: boolean\n loop?: boolean\n controls?: boolean\n playsInline?: boolean\n videoRef?: React.RefObject<HTMLVideoElement>\n intersectionObserverConfig?: {\n threshold?: number | number[]\n rootMargin?: string\n }\n [key: string]: any\n}\n\nconst ScrollLoadVideo = ({\n src,\n poster,\n className = '',\n videoClassName = '',\n autoplay = true,\n muted = true,\n loop = true,\n controls = false,\n playsInline = true,\n videoRef,\n intersectionObserverConfig = {\n threshold: 0, // \u5F53\u5143\u7D20\u8FDB\u5165\u89C6\u7A97\u65F6\u89E6\u53D1\n rootMargin: '200px', // \u63D0\u524D 200px \u89E6\u53D1\n },\n ...attr\n}: ScrollLoadVideoProps) => {\n const [shouldLoad, setShouldLoad] = useState(false)\n const internalVideoRef = useRef<HTMLVideoElement>(null)\n const containerRef = useRef<HTMLDivElement>(null)\n // \u8DDF\u8E2A\u89C6\u9891\u662F\u5426\u5DF2\u7ECF\u64AD\u653E\u5B8C\u6210\uFF08\u7528\u4E8E loop=false \u65F6\u53EA\u64AD\u653E\u4E00\u6B21\uFF09\n const hasPlayedRef = useRef(false)\n\n const currentVideoRef = videoRef || internalVideoRef\n const { threshold, rootMargin } = intersectionObserverConfig\n\n // \u76D1\u542C\u89C6\u9891\u64AD\u653E\u7ED3\u675F\u4E8B\u4EF6\n useEffect(() => {\n const video = currentVideoRef.current\n if (!video || loop) return\n\n const handleEnded = () => {\n hasPlayedRef.current = true\n }\n\n video.addEventListener('ended', handleEnded)\n return () => {\n video.removeEventListener('ended', handleEnded)\n }\n }, [currentVideoRef, loop, shouldLoad])\n\n // IntersectionObserver \u771F\u6B63\u7684\u61D2\u52A0\u8F7D + \u89C6\u7A97\u64AD\u653E\u63A7\u5236\n useEffect(() => {\n const observer = new IntersectionObserver(\n entries => {\n entries.forEach(entry => {\n if (entry.isIntersecting) {\n // \u7B2C\u4E00\u6B21\u8FDB\u5165\u89C6\u7A97\u65F6\u624D\u5F00\u59CB\u52A0\u8F7D\u89C6\u9891\n if (!shouldLoad) {\n setShouldLoad(true)\n }\n\n // \u5982\u679C\u5141\u8BB8\u81EA\u52A8\u64AD\u653E\u4E14\u89C6\u9891\u5DF2\u52A0\u8F7D\n if (currentVideoRef.current) {\n const video = currentVideoRef.current\n\n // \u5982\u679C loop=false \u4E14\u89C6\u9891\u5DF2\u7ECF\u64AD\u653E\u8FC7\uFF0C\u4E0D\u518D\u91CD\u65B0\u64AD\u653E\n if (!loop && hasPlayedRef.current) {\n return\n }\n\n video.muted = true\n video.currentTime = 0 // \u6BCF\u6B21\u8FDB\u5165\u89C6\u7A97\u65F6\u4ECE\u5934\u64AD\u653E\n video.play().catch((error: unknown) => {\n console.warn('\u89C6\u9891\u81EA\u52A8\u64AD\u653E\u5931\u8D25:', error)\n })\n }\n } else if (currentVideoRef.current) {\n // \u79BB\u5F00\u89C6\u7A97\u65F6\u6682\u505C\u89C6\u9891\n currentVideoRef.current.pause()\n }\n })\n },\n {\n threshold: threshold,\n rootMargin: rootMargin,\n }\n )\n\n const currentElement = containerRef.current\n if (currentElement) {\n observer.observe(currentElement)\n }\n\n return () => {\n if (currentElement) {\n observer.unobserve(currentElement)\n }\n }\n }, [currentVideoRef, loop, rootMargin, shouldLoad, threshold])\n\n return (\n <div ref={containerRef} className={cn('relative size-full', className)}>\n {/* \u89C6\u9891 */}\n <video\n ref={currentVideoRef}\n src={shouldLoad ? src : undefined} // \u53EA\u6709\u5728\u9700\u8981\u65F6\u624D\u8BBE\u7F6E src\n poster={shouldLoad ? poster : undefined}\n className={cn('size-full object-cover', videoClassName)}\n loop={loop}\n muted={muted}\n controls={controls}\n playsInline={playsInline}\n preload=\"metadata\" // \u5B8C\u5168\u4E0D\u9884\u52A0\u8F7D\n disablePictureInPicture\n // eslint-disable-next-line react/no-unknown-property\n webkit-playsinline
|
|
5
|
-
"mappings": "AAmHM,cAAAA,MAAA,oBAnHN,OAAgB,UAAAC,EAAQ,aAAAC,EAAW,YAAAC,MAAgB,QACnD,OAAS,MAAAC,MAAU,sBAoBnB,MAAMC,EAAkB,CAAC,CACvB,IAAAC,EACA,OAAAC,EACA,UAAAC,EAAY,GACZ,eAAAC,EAAiB,GACjB,SAAAC,EAAW,GACX,MAAAC,EAAQ,GACR,KAAAC,EAAO,GACP,SAAAC,EAAW,GACX,YAAAC,EAAc,GACd,SAAAC,EACA,2BAAAC,EAA6B,CAC3B,UAAW,EACX,WAAY,OACd,EACA,GAAGC,CACL,IAA4B,CAC1B,KAAM,CAACC,EAAYC,CAAa,EAAIhB,EAAS,EAAK,EAC5CiB,EAAmBnB,EAAyB,IAAI,EAChDoB,EAAepB,EAAuB,IAAI,EAE1CqB,EAAerB,EAAO,EAAK,EAE3BsB,EAAkBR,GAAYK,EAC9B,CAAE,UAAAI,EAAW,WAAAC,CAAW,EAAIT,EAGlC,OAAAd,EAAU,IAAM,CACd,MAAMwB,EAAQH,EAAgB,QAC9B,GAAI,CAACG,GAASd,EAAM,OAEpB,MAAMe,EAAc,IAAM,CACxBL,EAAa,QAAU,EACzB,EAEA,OAAAI,EAAM,iBAAiB,QAASC,CAAW,EACpC,IAAM,CACXD,EAAM,oBAAoB,QAASC,CAAW,CAChD,CACF,EAAG,CAACJ,EAAiBX,EAAMM,CAAU,CAAC,EAGtChB,EAAU,IAAM,CACd,MAAM0B,EAAW,IAAI,qBACnBC,GAAW,CACTA,EAAQ,QAAQC,GAAS,CACvB,GAAIA,EAAM,gBAOR,GALKZ,GACHC,EAAc,EAAI,EAIhBI,EAAgB,QAAS,CAC3B,MAAMG,EAAQH,EAAgB,QAG9B,GAAI,CAACX,GAAQU,EAAa,QACxB,OAGFI,EAAM,MAAQ,GACdA,EAAM,YAAc,EACpBA,EAAM,KAAK,EAAE,MAAOK,GAAmB,CACrC,QAAQ,KAAK,oDAAaA,CAAK,CACjC,CAAC,CACH,OACSR,EAAgB,SAEzBA,EAAgB,QAAQ,MAAM,CAElC,CAAC,CACH,EACA,CACE,UAAWC,EACX,WAAYC,CACd,CACF,EAEMO,EAAiBX,EAAa,QACpC,OAAIW,GACFJ,EAAS,QAAQI,CAAc,EAG1B,IAAM,CACPA,GACFJ,EAAS,UAAUI,CAAc,CAErC,CACF,EAAG,CAACT,EAAiBX,EAAMa,EAAYP,EAAYM,CAAS,CAAC,EAG3DxB,EAAC,OAAI,IAAKqB,EAAc,UAAWjB,EAAG,qBAAsBI,CAAS,EAEnE,SAAAR,EAAC,SACC,IAAKuB,EACL,IAAKL,EAAaZ,EAAM,OACxB,OAAQY,EAAaX,EAAS,OAC9B,UAAWH,EAAG,yBAA0BK,CAAc,EACtD,KAAMG,EACN,MAAOD,EACP,SAAUE,EACV,YAAaC,EACb,QAAQ,WACR,wBAAuB,GAEvB,
|
|
4
|
+
"sourcesContent": ["import React, { useRef, useEffect, useState } from 'react'\nimport { cn } from '../helpers/utils.js'\n\ninterface ScrollLoadVideoProps {\n src: string\n poster?: string\n className?: string\n videoClassName?: string\n autoplay?: boolean\n muted?: boolean\n loop?: boolean\n controls?: boolean\n playsInline?: boolean\n videoRef?: React.RefObject<HTMLVideoElement>\n intersectionObserverConfig?: {\n threshold?: number | number[]\n rootMargin?: string\n }\n [key: string]: any\n}\n\nconst ScrollLoadVideo = ({\n src,\n poster,\n className = '',\n videoClassName = '',\n autoplay = true,\n muted = true,\n loop = true,\n controls = false,\n playsInline = true,\n videoRef,\n intersectionObserverConfig = {\n threshold: 0, // \u5F53\u5143\u7D20\u8FDB\u5165\u89C6\u7A97\u65F6\u89E6\u53D1\n rootMargin: '200px', // \u63D0\u524D 200px \u89E6\u53D1\n },\n ...attr\n}: ScrollLoadVideoProps) => {\n const [shouldLoad, setShouldLoad] = useState(false)\n const internalVideoRef = useRef<HTMLVideoElement>(null)\n const containerRef = useRef<HTMLDivElement>(null)\n // \u8DDF\u8E2A\u89C6\u9891\u662F\u5426\u5DF2\u7ECF\u64AD\u653E\u5B8C\u6210\uFF08\u7528\u4E8E loop=false \u65F6\u53EA\u64AD\u653E\u4E00\u6B21\uFF09\n const hasPlayedRef = useRef(false)\n\n const currentVideoRef = videoRef || internalVideoRef\n const { threshold, rootMargin } = intersectionObserverConfig\n\n // \u76D1\u542C\u89C6\u9891\u64AD\u653E\u7ED3\u675F\u4E8B\u4EF6\n useEffect(() => {\n const video = currentVideoRef.current\n if (!video || loop) return\n\n const handleEnded = () => {\n hasPlayedRef.current = true\n }\n\n video.addEventListener('ended', handleEnded)\n return () => {\n video.removeEventListener('ended', handleEnded)\n }\n }, [currentVideoRef, loop, shouldLoad])\n\n // IntersectionObserver \u771F\u6B63\u7684\u61D2\u52A0\u8F7D + \u89C6\u7A97\u64AD\u653E\u63A7\u5236\n useEffect(() => {\n const observer = new IntersectionObserver(\n entries => {\n entries.forEach(entry => {\n if (entry.isIntersecting) {\n // \u7B2C\u4E00\u6B21\u8FDB\u5165\u89C6\u7A97\u65F6\u624D\u5F00\u59CB\u52A0\u8F7D\u89C6\u9891\n if (!shouldLoad) {\n setShouldLoad(true)\n }\n\n // \u5982\u679C\u5141\u8BB8\u81EA\u52A8\u64AD\u653E\u4E14\u89C6\u9891\u5DF2\u52A0\u8F7D\n if (currentVideoRef.current) {\n const video = currentVideoRef.current\n\n // \u5982\u679C loop=false \u4E14\u89C6\u9891\u5DF2\u7ECF\u64AD\u653E\u8FC7\uFF0C\u4E0D\u518D\u91CD\u65B0\u64AD\u653E\n if (!loop && hasPlayedRef.current) {\n return\n }\n\n video.muted = true\n video.currentTime = 0 // \u6BCF\u6B21\u8FDB\u5165\u89C6\u7A97\u65F6\u4ECE\u5934\u64AD\u653E\n video.play().catch((error: unknown) => {\n console.warn('\u89C6\u9891\u81EA\u52A8\u64AD\u653E\u5931\u8D25:', error)\n })\n }\n } else if (currentVideoRef.current) {\n // \u79BB\u5F00\u89C6\u7A97\u65F6\u6682\u505C\u89C6\u9891\n currentVideoRef.current.pause()\n }\n })\n },\n {\n threshold: threshold,\n rootMargin: rootMargin,\n }\n )\n\n const currentElement = containerRef.current\n if (currentElement) {\n observer.observe(currentElement)\n }\n\n return () => {\n if (currentElement) {\n observer.unobserve(currentElement)\n }\n }\n }, [currentVideoRef, loop, rootMargin, shouldLoad, threshold])\n\n return (\n <div ref={containerRef} className={cn('relative size-full', className)}>\n {/* \u89C6\u9891 */}\n <video\n ref={currentVideoRef}\n src={shouldLoad ? src : undefined} // \u53EA\u6709\u5728\u9700\u8981\u65F6\u624D\u8BBE\u7F6E src\n poster={shouldLoad ? poster : undefined}\n className={cn('size-full object-cover', videoClassName)}\n loop={loop}\n muted={muted}\n controls={controls}\n playsInline={playsInline}\n preload=\"metadata\" // \u5B8C\u5168\u4E0D\u9884\u52A0\u8F7D\n disablePictureInPicture\n // eslint-disable-next-line react/no-unknown-property\n webkit-playsinline\n autoPlay={autoplay}\n {...attr}\n />\n </div>\n )\n}\n\nexport default ScrollLoadVideo\n"],
|
|
5
|
+
"mappings": "AAmHM,cAAAA,MAAA,oBAnHN,OAAgB,UAAAC,EAAQ,aAAAC,EAAW,YAAAC,MAAgB,QACnD,OAAS,MAAAC,MAAU,sBAoBnB,MAAMC,EAAkB,CAAC,CACvB,IAAAC,EACA,OAAAC,EACA,UAAAC,EAAY,GACZ,eAAAC,EAAiB,GACjB,SAAAC,EAAW,GACX,MAAAC,EAAQ,GACR,KAAAC,EAAO,GACP,SAAAC,EAAW,GACX,YAAAC,EAAc,GACd,SAAAC,EACA,2BAAAC,EAA6B,CAC3B,UAAW,EACX,WAAY,OACd,EACA,GAAGC,CACL,IAA4B,CAC1B,KAAM,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,OAAQY,EAAaX,EAAS,OAC9B,UAAWH,EAAG,yBAA0BK,CAAc,EACtD,KAAMG,EACN,MAAOD,EACP,SAAUE,EACV,YAAaC,EACb,QAAQ,WACR,wBAAuB,GAEvB,qBAAkB,GAClB,SAAUJ,EACT,GAAGO,EACN,EACF,CAEJ,EAEA,IAAOgB,EAAQ5B",
|
|
6
6
|
"names": ["jsx", "useRef", "useEffect", "useState", "cn", "ScrollLoadVideo", "src", "poster", "className", "videoClassName", "autoplay", "muted", "loop", "controls", "playsInline", "videoRef", "intersectionObserverConfig", "attr", "shouldLoad", "setShouldLoad", "internalVideoRef", "containerRef", "hasPlayedRef", "currentVideoRef", "threshold", "rootMargin", "video", "handleEnded", "observer", "entries", "entry", "error", "currentElement", "ScrollLoadVideo_default"]
|
|
7
7
|
}
|
|
@@ -34,5 +34,4 @@ export declare const useStyles: (styleProps: Partial<StylesProps>, data?: Record
|
|
|
34
34
|
* @param WrappedComponent - 需要包装的组件
|
|
35
35
|
* @param defaultLayoutProps - 默认样式属性
|
|
36
36
|
*/
|
|
37
|
-
export declare function withLayout<P
|
|
38
|
-
export declare function withLayout<P>(WrappedComponent: React.ComponentType<P>, defaultLayoutProps?: Partial<StylesProps & ContainerProps>): React.ForwardRefExoticComponent<React.PropsWithoutRef<P & Partial<StylesProps & ContainerProps>> & React.RefAttributes<any>>;
|
|
37
|
+
export declare function withLayout<P>(WrappedComponent: React.ComponentType<P>, defaultLayoutProps?: Partial<StylesProps & ContainerProps>): any;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Fragment as
|
|
1
|
+
import{Fragment as G,jsx as o,jsxs as E}from"react/jsx-runtime";import $,{useMemo as m}from"react";import{simpleHash as R}from"./simpleHash.js";import N from"./getKeyPropsString.js";import{Grid as h,GridItem as w}from"../components/grid.js";import{Container as k}from"../components/container.js";import T from"./ErrorBoundary.js";const _={12:"col-start-1 col-end-13",10:"col-start-2 col-end-12",8:"col-start-3 col-end-11",6:"col-start-4 col-end-10",4:"col-start-5 col-end-9"},L={12:"tablet:col-start-1 tablet:col-end-13",10:"tablet:col-start-2 tablet:col-end-12",8:"tablet:col-start-3 tablet:col-end-11",6:"tablet:col-start-4 tablet:col-end-10",4:"tablet:col-start-5 tablet:col-end-9"},d=t=>{const n=N(t);return`style_${R(n)}`},O=t=>{const{style:n,uid:r,disabled:s}=t;return{style:n,uid:r,disabled:s}},x=({style:t,uid:n=d({}),disabled:r=!1})=>!t||r?null:o("style",{suppressHydrationWarning:!0,"data-style-id":n,dangerouslySetInnerHTML:{__html:`.block-${n} { ${t} }`}}),j=(t,n)=>{const r=m(()=>t?.uid||d({...t,data:n}),[n,t]),s=m(()=>o(x,{...t,uid:r}),[t,r]);return{className:`block-${r} `,StyleComponent:s,uid:r}},B=t=>{const{desktopSpan:n,mobileSpan:r}=t?.container||{},s=r?_[r]:"",a=n?L[n]:"";return`${s} ${a}`.trim()},u=Symbol("withLayoutWrapped");function U(t,n){if(t[u])return t;const r=$.forwardRef((s,a)=>{const i=O(s),S=e=>e?typeof e=="string"?e:typeof e=="object"&&Object.entries(e).length<=0?"":Object.entries(e).map(([f,C])=>`${f.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${C}`).join("; ")+";":"",c=[n?.style,i?.style].map(S).filter(e=>!!e).map(e=>e.trim().endsWith(";")?e:`${e};`).join(" "),p={...n,...i,...c&&{style:c}},{className:y,StyleComponent:b}=j(p,s?.data),g=e=>o(k,{className:`${y} ${e?.className||""}`.trim(),children:o(h,{className:"container_grid",children:o(w,{className:B(e),children:o(t,{...e,ref:a})})})}),P=e=>o(t,{...e,className:`${y} ${e?.className||""||""}`.trim(),ref:a}),{style:I,...l}=s;return o(G,{children:E(T,{children:[b,Reflect.ownKeys(l?.container||{})?.length>0?g(l):P(l)]})})});return r.displayName=`WithLayout${t.displayName||t.name||"Component"}`,r[u]=!0,r}export{O as getStylesProps,j as useStyles,U as withLayout};
|
|
2
2
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/shared/Styles.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useMemo } from 'react'\nimport { simpleHash } from './simpleHash.js'\nimport getKeyPropsString from './getKeyPropsString.js'\nimport { Grid, GridItem } from '../components/grid.js'\nimport { Container } from '../components/container.js'\nimport ErrorBoundary from './ErrorBoundary.js'\n\nconst colContentClasses: Record<number, string> = {\n 12: 'col-start-1 col-end-13',\n 10: 'col-start-2 col-end-12',\n 8: 'col-start-3 col-end-11',\n 6: 'col-start-4 col-end-10',\n 4: 'col-start-5 col-end-9',\n} as const\n\n// \u9884\u5B9A\u4E49\u5E26 tablet \u524D\u7F00\u7684\u7C7B\u540D\uFF0C\u786E\u4FDD Tailwind \u53EF\u4EE5\u8BC6\u522B\nconst colContentClassesTablet: Record<number, string> = {\n 12: 'tablet:col-start-1 tablet:col-end-13',\n 10: 'tablet:col-start-2 tablet:col-end-12',\n 8: 'tablet:col-start-3 tablet:col-end-11',\n 6: 'tablet:col-start-4 tablet:col-end-10',\n 4: 'tablet:col-start-5 tablet:col-end-9',\n} as const\n\nexport interface ContainerProps {\n container?: {\n /** \u684C\u9762\u7AEF\u5217\u5185\u5BB9\u5BBD\u5EA6 */\n desktopSpan: number\n /** \u79FB\u52A8\u7AEF\u5217\u5185\u5BB9\u5BBD\u5EA6 */\n mobileSpan: number\n }\n}\n\nexport interface StylesProps {\n /** \u81EA\u5B9A\u4E49\u6837\u5F0F\u5B57\u7B26\u4E32\u6216\u5BF9\u8C61 */\n style?: string | React.CSSProperties\n /** \u552F\u4E00\u6807\u8BC6\u7B26 */\n uid?: string\n /** \u662F\u5426\u7981\u7528 */\n disabled?: boolean\n}\n\n/**\n * \u6839\u636E props \u751F\u6210\u786E\u5B9A\u6027 uid\n */\nconst generateUID = (props: Record<string, any>) => {\n const keyString = getKeyPropsString(props)\n return `style_${simpleHash(keyString)}`\n}\n\n/**\n * \u4ECE\u7EC4\u4EF6 props \u4E2D\u63D0\u53D6\u6837\u5F0F\u76F8\u5173\u5C5E\u6027\n */\nexport const getStylesProps = <T extends Record<string, unknown>>(props: T & StylesProps): StylesProps => {\n const { style, uid, disabled } = props\n return { style, uid, disabled }\n}\n\n/**\n * \u6837\u5F0F\u6CE8\u5165\u7EC4\u4EF6\n */\nconst Styles: React.FC<StylesProps> = ({ style, uid = generateUID({}), disabled = false }) => {\n if (!style || disabled) {\n return null\n }\n\n return (\n <style\n suppressHydrationWarning\n data-style-id={uid}\n dangerouslySetInnerHTML={{ __html: `.block-${uid} { ${style} }` }}\n />\n )\n}\n\n/**\n * \u6837\u5F0F Hook\uFF0C\u8FD4\u56DE\u6837\u5F0F\u7C7B\u540D\u548C\u6837\u5F0F\u7EC4\u4EF6\n * @param styleProps - \u6837\u5F0F\u5C5E\u6027\n */\nexport const useStyles = (styleProps: Partial<StylesProps>, data?: Record<string, any>) => {\n const uid = useMemo(() => styleProps?.uid || generateUID({ ...styleProps, data }), [data, styleProps])\n\n const StyleComponent = useMemo(() => <Styles {...styleProps} uid={uid} />, [styleProps, uid])\n\n return {\n className: `block-${uid} `,\n StyleComponent,\n uid,\n } as const\n}\n\nconst getContainerClassName = (props?: Partial<StylesProps & ContainerProps>) => {\n const { desktopSpan, mobileSpan } = props?.container || {}\n const mobileClasses = mobileSpan ? colContentClasses[mobileSpan] : ''\n const desktopClasses = desktopSpan ? colContentClassesTablet[desktopSpan] : ''\n return `${mobileClasses} ${desktopClasses}`.trim()\n}\n\n/**\n * \u6807\u8BB0\u7EC4\u4EF6\u662F\u5426\u5DF2\u88AB withLayout \u5305\u88C5\n */\nconst WRAPPED_COMPONENT_SYMBOL = Symbol('withLayoutWrapped')\n\n/**\n * \u9AD8\u9636\u7EC4\u4EF6\u901A\u8FC7 withLayout \u5305\u88C5\u7EC4\u4EF6\uFF0C\u81EA\u52A8\u5E94\u7528\u6837\u5F0F\u548C\u5BB9\u5668\u5E03\u5C40\n *\n * @param WrappedComponent - \u9700\u8981\u5305\u88C5\u7684\u7EC4\u4EF6\n * @param defaultLayoutProps - \u9ED8\u8BA4\u6837\u5F0F\u5C5E\u6027\n */\
|
|
5
|
-
"mappings": "AAmEI,
|
|
4
|
+
"sourcesContent": ["import React, { useMemo } from 'react'\nimport { simpleHash } from './simpleHash.js'\nimport getKeyPropsString from './getKeyPropsString.js'\nimport { Grid, GridItem } from '../components/grid.js'\nimport { Container } from '../components/container.js'\nimport ErrorBoundary from './ErrorBoundary.js'\n\nconst colContentClasses: Record<number, string> = {\n 12: 'col-start-1 col-end-13',\n 10: 'col-start-2 col-end-12',\n 8: 'col-start-3 col-end-11',\n 6: 'col-start-4 col-end-10',\n 4: 'col-start-5 col-end-9',\n} as const\n\n// \u9884\u5B9A\u4E49\u5E26 tablet \u524D\u7F00\u7684\u7C7B\u540D\uFF0C\u786E\u4FDD Tailwind \u53EF\u4EE5\u8BC6\u522B\nconst colContentClassesTablet: Record<number, string> = {\n 12: 'tablet:col-start-1 tablet:col-end-13',\n 10: 'tablet:col-start-2 tablet:col-end-12',\n 8: 'tablet:col-start-3 tablet:col-end-11',\n 6: 'tablet:col-start-4 tablet:col-end-10',\n 4: 'tablet:col-start-5 tablet:col-end-9',\n} as const\n\nexport interface ContainerProps {\n container?: {\n /** \u684C\u9762\u7AEF\u5217\u5185\u5BB9\u5BBD\u5EA6 */\n desktopSpan: number\n /** \u79FB\u52A8\u7AEF\u5217\u5185\u5BB9\u5BBD\u5EA6 */\n mobileSpan: number\n }\n}\n\nexport interface StylesProps {\n /** \u81EA\u5B9A\u4E49\u6837\u5F0F\u5B57\u7B26\u4E32\u6216\u5BF9\u8C61 */\n style?: string | React.CSSProperties\n /** \u552F\u4E00\u6807\u8BC6\u7B26 */\n uid?: string\n /** \u662F\u5426\u7981\u7528 */\n disabled?: boolean\n}\n\n/**\n * \u6839\u636E props \u751F\u6210\u786E\u5B9A\u6027 uid\n */\nconst generateUID = (props: Record<string, any>) => {\n const keyString = getKeyPropsString(props)\n return `style_${simpleHash(keyString)}`\n}\n\n/**\n * \u4ECE\u7EC4\u4EF6 props \u4E2D\u63D0\u53D6\u6837\u5F0F\u76F8\u5173\u5C5E\u6027\n */\nexport const getStylesProps = <T extends Record<string, unknown>>(props: T & StylesProps): StylesProps => {\n const { style, uid, disabled } = props\n return { style, uid, disabled }\n}\n\n/**\n * \u6837\u5F0F\u6CE8\u5165\u7EC4\u4EF6\n */\nconst Styles: React.FC<StylesProps> = ({ style, uid = generateUID({}), disabled = false }) => {\n if (!style || disabled) {\n return null\n }\n\n return (\n <style\n suppressHydrationWarning\n data-style-id={uid}\n dangerouslySetInnerHTML={{ __html: `.block-${uid} { ${style} }` }}\n />\n )\n}\n\n/**\n * \u6837\u5F0F Hook\uFF0C\u8FD4\u56DE\u6837\u5F0F\u7C7B\u540D\u548C\u6837\u5F0F\u7EC4\u4EF6\n * @param styleProps - \u6837\u5F0F\u5C5E\u6027\n */\nexport const useStyles = (styleProps: Partial<StylesProps>, data?: Record<string, any>) => {\n const uid = useMemo(() => styleProps?.uid || generateUID({ ...styleProps, data }), [data, styleProps])\n\n const StyleComponent = useMemo(() => <Styles {...styleProps} uid={uid} />, [styleProps, uid])\n\n return {\n className: `block-${uid} `,\n StyleComponent,\n uid,\n } as const\n}\n\nconst getContainerClassName = (props?: Partial<StylesProps & ContainerProps>) => {\n const { desktopSpan, mobileSpan } = props?.container || {}\n const mobileClasses = mobileSpan ? colContentClasses[mobileSpan] : ''\n const desktopClasses = desktopSpan ? colContentClassesTablet[desktopSpan] : ''\n return `${mobileClasses} ${desktopClasses}`.trim()\n}\n\n/**\n * \u6807\u8BB0\u7EC4\u4EF6\u662F\u5426\u5DF2\u88AB withLayout \u5305\u88C5\n */\nconst WRAPPED_COMPONENT_SYMBOL = Symbol('withLayoutWrapped')\n\n/**\n * \u9AD8\u9636\u7EC4\u4EF6\u901A\u8FC7 withLayout \u5305\u88C5\u7EC4\u4EF6\uFF0C\u81EA\u52A8\u5E94\u7528\u6837\u5F0F\u548C\u5BB9\u5668\u5E03\u5C40\n *\n * @param WrappedComponent - \u9700\u8981\u5305\u88C5\u7684\u7EC4\u4EF6\n * @param defaultLayoutProps - \u9ED8\u8BA4\u6837\u5F0F\u5C5E\u6027\n */\nexport function withLayout<P>(\n WrappedComponent: React.ComponentType<P>,\n defaultLayoutProps?: Partial<StylesProps & ContainerProps>\n) {\n // \u9632\u6B62\u91CD\u590D\u5305\u88C5\n if ((WrappedComponent as any)[WRAPPED_COMPONENT_SYMBOL]) {\n return WrappedComponent as any\n }\n // \u4F7F\u7528\u60A8\u7684\u7B80\u6D01\u65B9\u6CD5\uFF1A\u76F4\u63A5\u7528\u6CDB\u578B\u4FDD\u7559\u7C7B\u578B\n const withLayout = React.forwardRef<\n any,\n P & { style?: string | React.CSSProperties; container?: ContainerProps['container'] }\n >((props, ref) => {\n const propsStyleProps = getStylesProps(props)\n\n // \u5C06 style \u5BF9\u8C61\u8F6C\u6362\u4E3A\u5B57\u7B26\u4E32\n const styleToString = (style?: string | React.CSSProperties): string => {\n if (!style) return ''\n if (typeof style === 'string') return style\n if (typeof style === 'object' && Object.entries(style).length <= 0) return ''\n return (\n Object.entries(style)\n .map(([key, value]) => {\n const cssKey = key.replace(/([A-Z])/g, '-$1').toLowerCase()\n return `${cssKey}: ${value}`\n })\n .join('; ') + ';'\n )\n }\n\n // \u5408\u5E76 style \u5B57\u6BB5\uFF0C\u907F\u514D\u8986\u76D6\uFF0C\u786E\u4FDD\u6BCF\u4E2A\u6837\u5F0F\u90FD\u4EE5\u5206\u53F7\u7ED3\u5C3E\n const mergedStyle = [defaultLayoutProps?.style, propsStyleProps?.style]\n .map(styleToString)\n .filter((style): style is string => Boolean(style))\n .map(style => (style.trim().endsWith(';') ? style : `${style};`))\n .join(' ')\n\n const finalStyleProps = {\n ...defaultLayoutProps,\n ...propsStyleProps,\n ...(mergedStyle && { style: mergedStyle }),\n }\n\n const { className, StyleComponent } = useStyles(finalStyleProps, (props as any)?.data)\n\n const WithContainerWrapper = (props: any) => {\n return (\n <Container className={`${className} ${(props as any)?.className || ''}`.trim()}>\n <Grid className=\"container_grid\">\n <GridItem className={getContainerClassName(props)}>\n <WrappedComponent {...props} ref={ref} />\n </GridItem>\n </Grid>\n </Container>\n )\n }\n\n const WithoutContainerWrapper = (props: any) => {\n return <WrappedComponent {...props} className={`${className} ${props?.className || '' || ''}`.trim()} ref={ref} />\n }\n\n // @ts-ignore\n // eslint-disable-next-line no-unused-vars\n const { style: _style, ...withOutStyleProps } = props\n\n return (\n <>\n <ErrorBoundary>\n {StyleComponent}\n {Reflect.ownKeys((withOutStyleProps as any)?.container || {})?.length > 0\n ? WithContainerWrapper(withOutStyleProps)\n : WithoutContainerWrapper(withOutStyleProps)}\n </ErrorBoundary>\n </>\n )\n })\n\n withLayout.displayName = `WithLayout${WrappedComponent.displayName || WrappedComponent.name || 'Component'}`\n\n // \u6807\u8BB0\u7EC4\u4EF6\u5DF2\u88AB\u5305\u88C5\n ;(withLayout as any)[WRAPPED_COMPONENT_SYMBOL] = true\n return withLayout\n}\n"],
|
|
5
|
+
"mappings": "AAmEI,OA4GE,YAAAA,EA5GF,OAAAC,EA6GI,QAAAC,MA7GJ,oBAnEJ,OAAOC,GAAS,WAAAC,MAAe,QAC/B,OAAS,cAAAC,MAAkB,kBAC3B,OAAOC,MAAuB,yBAC9B,OAAS,QAAAC,EAAM,YAAAC,MAAgB,wBAC/B,OAAS,aAAAC,MAAiB,6BAC1B,OAAOC,MAAmB,qBAE1B,MAAMC,EAA4C,CAChD,GAAI,yBACJ,GAAI,yBACJ,EAAG,yBACH,EAAG,yBACH,EAAG,uBACL,EAGMC,EAAkD,CACtD,GAAI,uCACJ,GAAI,uCACJ,EAAG,uCACH,EAAG,uCACH,EAAG,qCACL,EAuBMC,EAAeC,GAA+B,CAClD,MAAMC,EAAYT,EAAkBQ,CAAK,EACzC,MAAO,SAAST,EAAWU,CAAS,CAAC,EACvC,EAKaC,EAAqDF,GAAwC,CACxG,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c,aAAaC,EAAiB,aAAeA,EAAiB,MAAQ,WAAW,GAGxGD,EAAmBD,CAAwB,EAAI,GAC1CC,CACT",
|
|
6
6
|
"names": ["Fragment", "jsx", "jsxs", "React", "useMemo", "simpleHash", "getKeyPropsString", "Grid", "GridItem", "Container", "ErrorBoundary", "colContentClasses", "colContentClassesTablet", "generateUID", "props", "keyString", "getStylesProps", "style", "uid", "disabled", "Styles", "useStyles", "styleProps", "data", "StyleComponent", "getContainerClassName", "desktopSpan", "mobileSpan", "mobileClasses", "desktopClasses", "WRAPPED_COMPONENT_SYMBOL", "withLayout", "WrappedComponent", "defaultLayoutProps", "ref", "propsStyleProps", "styleToString", "key", "value", "mergedStyle", "finalStyleProps", "className", "WithContainerWrapper", "WithoutContainerWrapper", "_style", "withOutStyleProps"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 自动点击埋点 Hook
|
|
3
|
-
*
|
|
4
|
-
* 通过事件委托监听所有带有 `data-headless-type-name` 属性的元素点击事件
|
|
5
|
-
*
|
|
6
|
-
* @param trackingData - 埋点数据对象,包含 pageGroup 等字段
|
|
7
|
-
* @param enabled - 是否启用自动埋点,默认为 true
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```tsx
|
|
11
|
-
* function App() {
|
|
12
|
-
* useAutoTracking({ pageGroup: 'Home Page' }, true)
|
|
13
|
-
* return <div>...</div>
|
|
14
|
-
* }
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export declare function useAutoTracking(trackingData: Record<string, any>, enabled?: boolean): void;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var u=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var k=(e,t)=>{for(var o in t)u(e,o,{get:t[o],enumerable:!0})},w=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of y(t))!h.call(e,n)&&n!==o&&u(e,n,{get:()=>t[n],enumerable:!(s=v(t,n))||s.enumerable});return e};var E=e=>w(u({},"__esModule",{value:!0}),e);var A={};k(A,{useAutoTracking:()=>b});module.exports=E(A);var r=require("react"),l=require("../../shared/track.js");function b(e,t=!0){const o=(0,r.useRef)(e);(0,r.useEffect)(()=>{o.current=e},[e]),(0,r.useEffect)(()=>{if(!t||typeof window>"u")return;const s="__headless_ui_tracking_bound__";if(window[s])return;const n=f=>{const i=f.target.closest("[data-headless-type-name]");if(!i)return;const a={};for(const g of Array.from(i.attributes)){const d=g?.name;d?.startsWith("data-headless-")&&(a[d]=i.getAttribute(d)||"")}const _=a["data-headless-sku"],m=a["data-headless-type-name"]?.split?.("#"),c=a["data-headless-title-desc-button"]?.split?.("#"),p=a["data-headless-nav-position"]?.split?.("#");(0,l.gaTrack)({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:o.current?.pageGroup||"Home Page",component_type:m?.[0]||"",component_name:m?.[1]||"",position:p?.[1]||"",navigation:p?.[0]||"",button_name:c?.[2]||"",SKU:_||"",component_title:c?.[0]||"",component_description:c?.[1]||""}})};return document.addEventListener("click",n),window[s]=!0,()=>{document.removeEventListener("click",n),delete window[s]}},[t])}
|
|
2
|
-
//# sourceMappingURL=useAutoTracking.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/biz-components/AiuiProvider/useAutoTracking.ts"],
|
|
4
|
-
"sourcesContent": ["import { useEffect, useRef } from 'react'\nimport { gaTrack } from '../../shared/track.js'\n\n/**\n * \u81EA\u52A8\u70B9\u51FB\u57CB\u70B9 Hook\n *\n * \u901A\u8FC7\u4E8B\u4EF6\u59D4\u6258\u76D1\u542C\u6240\u6709\u5E26\u6709 `data-headless-type-name` \u5C5E\u6027\u7684\u5143\u7D20\u70B9\u51FB\u4E8B\u4EF6\n *\n * @param trackingData - \u57CB\u70B9\u6570\u636E\u5BF9\u8C61\uFF0C\u5305\u542B pageGroup \u7B49\u5B57\u6BB5\n * @param enabled - \u662F\u5426\u542F\u7528\u81EA\u52A8\u57CB\u70B9\uFF0C\u9ED8\u8BA4\u4E3A true\n *\n * @example\n * ```tsx\n * function App() {\n * useAutoTracking({ pageGroup: 'Home Page' }, true)\n * return <div>...</div>\n * }\n * ```\n */\nexport function useAutoTracking(trackingData: Record<string, any>, enabled: boolean = true) {\n // \u4F7F\u7528 ref \u4FDD\u5B58\u6700\u65B0\u7684 trackingData\uFF0C\u907F\u514D\u95ED\u5305\u9648\u65E7\n const trackingDataRef = useRef(trackingData)\n\n useEffect(() => {\n trackingDataRef.current = trackingData\n }, [trackingData])\n\n useEffect(() => {\n // \u5982\u679C\u5173\u95ED\u4E86\u81EA\u52A8\u57CB\u70B9\uFF0C\u76F4\u63A5\u8FD4\u56DE\n if (!enabled) return\n\n // SSR \u73AF\u5883\u68C0\u6D4B\n if (typeof window === 'undefined') return\n\n // \u5168\u5C40\u6807\u8BB0\uFF1A\u9632\u6B62\u591A\u4E2A Provider \u5B9E\u4F8B\u91CD\u590D\u7ED1\u5B9A\n const TRACKING_KEY = '__headless_ui_tracking_bound__'\n if ((window as any)[TRACKING_KEY]) return\n\n /**\n * \u4E8B\u4EF6\u59D4\u6258\u5904\u7406\u51FD\u6570\n * \u70B9\u51FB\u4E8B\u4EF6\u5192\u6CE1\u5230 document\uFF0C\u68C0\u6D4B\u662F\u5426\u70B9\u51FB\u4E86\u8FFD\u8E2A\u5143\u7D20\n */\n const handleClick = (e: MouseEvent) => {\n const target = e.target as Element\n const el = target.closest('[data-headless-type-name]')\n if (!el) return\n\n // \u63D0\u53D6 data-headless-* \u5C5E\u6027\n const out: Record<string, string> = {}\n for (const attr of Array.from(el.attributes)) {\n const name = (attr as Attr)?.name\n if (name?.startsWith('data-headless-')) {\n out[name] = el.getAttribute(name) || ''\n }\n }\n\n // \u89E3\u6790\u8FFD\u8E2A\u6570\u636E\n const sku = out['data-headless-sku']\n const nameType = out['data-headless-type-name']?.split?.('#')\n const titleDesc = out['data-headless-title-desc-button']?.split?.('#')\n const navPosition = out['data-headless-nav-position']?.split?.('#')\n\n // \u53D1\u9001 GA \u57CB\u70B9\u4E8B\u4EF6\n gaTrack({\n event: 'ga4Event',\n event_name: 'component_click',\n event_parameters: {\n page_group: trackingDataRef.current?.pageGroup || 'Home Page',\n component_type: nameType?.[0] || '',\n component_name: nameType?.[1] || '',\n position: navPosition?.[1] || '',\n navigation: navPosition?.[0] || '',\n button_name: titleDesc?.[2] || '',\n SKU: sku || '',\n component_title: titleDesc?.[0] || '',\n component_description: titleDesc?.[1] || '',\n },\n })\n }\n\n // \u7ED1\u5B9A\u5168\u5C40\u70B9\u51FB\u4E8B\u4EF6\n document.addEventListener('click', handleClick)\n ;(window as any)[TRACKING_KEY] = true\n\n // \u6E05\u7406\u51FD\u6570\n return () => {\n document.removeEventListener('click', handleClick)\n delete (window as any)[TRACKING_KEY]\n }\n }, [enabled])\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAkC,iBAClCC,EAAwB,iCAkBjB,SAASH,EAAgBI,EAAmCC,EAAmB,GAAM,CAE1F,MAAMC,KAAkB,UAAOF,CAAY,KAE3C,aAAU,IAAM,CACdE,EAAgB,QAAUF,CAC5B,EAAG,CAACA,CAAY,CAAC,KAEjB,aAAU,IAAM,CAKd,GAHI,CAACC,GAGD,OAAO,OAAW,IAAa,OAGnC,MAAME,EAAe,iCACrB,GAAK,OAAeA,CAAY,EAAG,OAMnC,MAAMC,EAAeC,GAAkB,CAErC,MAAMC,EADSD,EAAE,OACC,QAAQ,2BAA2B,EACrD,GAAI,CAACC,EAAI,OAGT,MAAMC,EAA8B,CAAC,EACrC,UAAWC,KAAQ,MAAM,KAAKF,EAAG,UAAU,EAAG,CAC5C,MAAMG,EAAQD,GAAe,KACzBC,GAAM,WAAW,gBAAgB,IACnCF,EAAIE,CAAI,EAAIH,EAAG,aAAaG,CAAI,GAAK,GAEzC,CAGA,MAAMC,EAAMH,EAAI,mBAAmB,EAC7BI,EAAWJ,EAAI,yBAAyB,GAAG,QAAQ,GAAG,EACtDK,EAAYL,EAAI,iCAAiC,GAAG,QAAQ,GAAG,EAC/DM,EAAcN,EAAI,4BAA4B,GAAG,QAAQ,GAAG,KAGlE,WAAQ,CACN,MAAO,WACP,WAAY,kBACZ,iBAAkB,CAChB,WAAYL,EAAgB,SAAS,WAAa,YAClD,eAAgBS,IAAW,CAAC,GAAK,GACjC,eAAgBA,IAAW,CAAC,GAAK,GACjC,SAAUE,IAAc,CAAC,GAAK,GAC9B,WAAYA,IAAc,CAAC,GAAK,GAChC,YAAaD,IAAY,CAAC,GAAK,GAC/B,IAAKF,GAAO,GACZ,gBAAiBE,IAAY,CAAC,GAAK,GACnC,sBAAuBA,IAAY,CAAC,GAAK,EAC3C,CACF,CAAC,CACH,EAGA,gBAAS,iBAAiB,QAASR,CAAW,EAC5C,OAAeD,CAAY,EAAI,GAG1B,IAAM,CACX,SAAS,oBAAoB,QAASC,CAAW,EACjD,OAAQ,OAAeD,CAAY,CACrC,CACF,EAAG,CAACF,CAAO,CAAC,CACd",
|
|
6
|
-
"names": ["useAutoTracking_exports", "__export", "useAutoTracking", "__toCommonJS", "import_react", "import_track", "trackingData", "enabled", "trackingDataRef", "TRACKING_KEY", "handleClick", "e", "el", "out", "attr", "name", "sku", "nameType", "titleDesc", "navPosition"]
|
|
7
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 自动点击埋点 Hook
|
|
3
|
-
*
|
|
4
|
-
* 通过事件委托监听所有带有 `data-headless-type-name` 属性的元素点击事件
|
|
5
|
-
*
|
|
6
|
-
* @param trackingData - 埋点数据对象,包含 pageGroup 等字段
|
|
7
|
-
* @param enabled - 是否启用自动埋点,默认为 true
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```tsx
|
|
11
|
-
* function App() {
|
|
12
|
-
* useAutoTracking({ pageGroup: 'Home Page' }, true)
|
|
13
|
-
* return <div>...</div>
|
|
14
|
-
* }
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export declare function useAutoTracking(trackingData: Record<string, any>, enabled?: boolean): void;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{useEffect as m,useRef as _}from"react";import{gaTrack as g}from"../../shared/track.js";function k(e,r=!0){const i=_(e);m(()=>{i.current=e},[e]),m(()=>{if(!r||typeof window>"u")return;const n="__headless_ui_tracking_bound__";if(window[n])return;const c=p=>{const o=p.target.closest("[data-headless-type-name]");if(!o)return;const t={};for(const f of Array.from(o.attributes)){const a=f?.name;a?.startsWith("data-headless-")&&(t[a]=o.getAttribute(a)||"")}const l=t["data-headless-sku"],d=t["data-headless-type-name"]?.split?.("#"),s=t["data-headless-title-desc-button"]?.split?.("#"),u=t["data-headless-nav-position"]?.split?.("#");g({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:i.current?.pageGroup||"Home Page",component_type:d?.[0]||"",component_name:d?.[1]||"",position:u?.[1]||"",navigation:u?.[0]||"",button_name:s?.[2]||"",SKU:l||"",component_title:s?.[0]||"",component_description:s?.[1]||""}})};return document.addEventListener("click",c),window[n]=!0,()=>{document.removeEventListener("click",c),delete window[n]}},[r])}export{k as useAutoTracking};
|
|
2
|
-
//# sourceMappingURL=useAutoTracking.js.map
|