@fayz-ai/storefront 0.14.0 → 0.14.3

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.
@@ -833,13 +833,36 @@ function useInView(margin = "0px 0px -8% 0px") {
833
833
  return [ref, inView];
834
834
  }
835
835
  function Reveal({ delay = 0, children, className, style, ...rest }) {
836
- const [ref, inView] = useInView();
836
+ const ref = useRef(null);
837
+ const [phase, setPhase] = useState("seen");
838
+ useEffect(() => {
839
+ const el = ref.current;
840
+ if (!el || prefersReducedMotion() || typeof IntersectionObserver === "undefined") return;
841
+ if (el.getBoundingClientRect().top < window.innerHeight) return;
842
+ setPhase("waiting");
843
+ const observer = new IntersectionObserver(
844
+ (entries) => {
845
+ if (entries.some((e) => e.isIntersecting)) {
846
+ setPhase("playing");
847
+ observer.disconnect();
848
+ }
849
+ },
850
+ { rootMargin: "0px 0px -8% 0px" }
851
+ );
852
+ observer.observe(el);
853
+ return () => observer.disconnect();
854
+ }, []);
837
855
  return /* @__PURE__ */ jsx(
838
856
  "div",
839
857
  {
840
858
  ref,
841
- className: `${inView ? "animate-fade-up" : ""} ${className ?? ""}`,
842
- style: { ...style, animationDelay: delay ? `${delay}ms` : void 0 },
859
+ className: `${phase === "playing" ? "animate-fade-up" : ""} ${className ?? ""}`,
860
+ style: {
861
+ ...style,
862
+ // Off screen only. From there the class carries the fade.
863
+ ...phase === "waiting" ? { opacity: 0 } : null,
864
+ animationDelay: delay ? `${delay}ms` : void 0
865
+ },
843
866
  ...rest,
844
867
  children
845
868
  }
@@ -11100,5 +11123,5 @@ ${formatErrors(report.errors)}`;
11100
11123
  }
11101
11124
 
11102
11125
  export { BEFORE_PLACE_ORDER_VALVE, BLOCK_STRUCTURAL_KEYS, BenefitsRow, BlockDataError, CART_LINE_ANNOTATION_POINT, CATALOG_BODY_BLOCK, CHECKOUT_FIELD_POINT, CartDrawer, CatalogPage, CategoryShowcase, CheckoutPage, CollectionCta, CollectionHero, ContentPage, CountdownBand, EmailConfirmationRequiredError, EntityListBlock, FaqSection, FiltersPanel, FormBlock, HeroSection, ImageTiles, Link, ManifestoBlock, MediaCarousel, MotifStrip, MyPurchasesPage, NewsletterBand, ORDER_METADATA_POINT, OrderConfirmationPage, OrderTrackingTimeline, PAGE_DATA_SCRIPT_ID, PLACEHOLDER_ASPECTS, PRODUCT_BODY_BLOCK, PRODUCT_CARD_BADGE_POINT, PageDataScope, PaymentTerms, Price, ProductCard, ProductDetailPage, ProductEnquiryForm, ProductGallery, ProductGrid, ProductOptionSelector, ProductRail, ProductReviews, ProductSlider, ProductSpecs, ProductSpotlight, PromoBanner, QuantityInput, Reveal, STOREFRONT_COMPONENT_KEYS, STOREFRONT_PAGE_KINDS, STOREFRONT_SLOTS, STORE_BACKEND_PROVIDERS, STORE_COMMERCE_MODES, STORE_DOCUMENT_KIND, STORE_PAYMENT_METHOD_KINDS, STORE_PAYMENT_MODES, STORE_ROUTE_CHROMES, STORE_ROUTE_KINDS, STORE_SECTIONS, STORE_SECTION_NAMES, SealsBand, SearchOverlay, Slot, SmoothImage, StepsSection, StorefrontConfigHost, StorefrontConfigProvider, StorefrontFooter, StorefrontHeader, StorefrontPage, StorefrontRouterProvider, StorefrontShell, StorefrontThemeStyle, StoryQuote, THEME_SCALE_FIELDS, THEME_SCALE_VAR_PREFIX, TID, Testimonials, TierCards, applyStoreSettings, bannerPlaceholder, blockInstanceId, buildEnquiryFromForm, checkPageBlocks, collectDataNeeds, collectOrderMetadata, contentPagePath, createStorefront, createStorefrontApp, currentStaticRenderPass, defaultPageBlocks, entityListBlockMeta, establishCustomerSession, exportStore, formatMoney, formatProductOptionSelection, getCartLineAnnotations, getCheckoutFieldContributions, getCustomerAuthAdapter, getProductCardBadges, getProductOptionGroups, hydrateStoreDocument, hydratedEntriesFor, initStorefrontRuntime, isJsonValue, isKnownPath, isNestedBlockRef, isPublicPath, isRecord, listSlots, matchContentPage, matchPath, matchesFacets, mergeCollectionFacet, mergePageTheme, navigateTo, nextMilestone, normalizeProductOptionSelection, orderGalleryImages, overrideComponent, overrideProps, pageSeo, pageThemeSelector, pickProductCardImage, placeStorefrontOrder, prefersReducedMotion, primaryImageUrl, productCardComponentContract, productJsonLd, productOptionSelectionKey, productPlaceholder, productSeo, readHydratedPageData, registerStorefrontBlocks, registerStorefrontEntities, registerStorefrontExtensionPoints, registerStorefrontLoaders, resetPageDiagnostics, resetProductOptionsDeprecationWarnings, resetStorefrontExtensionPoints, resolveAuthAdapter, resolveConfig, resolveDataParams, resolveOverride, resolvePageData, resolvePageDataNeed, resolvePaymentTerms, resolveStorefrontProvider, resolveStorefrontRoute, resolveVariantForSelection, roundCents, routePathParams, runBeforePlaceOrderValve, sectionToJsonSchema, sectionsToBlocks, selectCount, selectDiscountTotal, selectRequiresShipping, selectShipping, selectSubtotal, selectTotal, selectionPrice, serializePageData, shellRouterAdapter, signInByEmail, signOutCustomer, signUpCustomer, slugifyStoreName, storefrontComponentContracts, storefrontPaths, themeToCss, toBlockNodes, toFacetMap, useBlockData, useCartStore, useCatalogStore, useCategories, useDeliveryStore, useDiscountValidator, useEnquiry, useHashPath, useInView, useLoader, useMyOrders, useNavigate, usePopOnChange, useProduct, useProducts, useRoutePath, useRouterAdapter, useScrollToTopOnNavigate, useScrolled, useSessionStore, useSlotContext, useStorefrontActions, useStorefrontConfig, useStorefrontConfigOptional, useStorefrontHead, useStorefrontPage, useStorefrontPageOptional, usedSlots, validateStore, withFacet, withStaticRenderPass };
11103
- //# sourceMappingURL=chunk-NBYDY2C3.js.map
11104
- //# sourceMappingURL=chunk-NBYDY2C3.js.map
11126
+ //# sourceMappingURL=chunk-GS7TDBF5.js.map
11127
+ //# sourceMappingURL=chunk-GS7TDBF5.js.map