@sesionario/blocks 1.22.2 → 1.23.0

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/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { FormEvent, KeyboardEvent, RefObject, CSSProperties, ReactNode, ComponentProps, SVGProps } from 'react';
2
+ import { FormEvent, KeyboardEvent, RefObject, CSSProperties, ReactNode, ComponentProps, Dispatch, SetStateAction, SVGProps } from 'react';
3
3
  import { LucideIcon } from 'lucide-react';
4
4
  import * as class_variance_authority_types from 'class-variance-authority/types';
5
5
  import { VariantProps } from 'class-variance-authority';
@@ -990,6 +990,57 @@ interface UseSearchHotkeyResult {
990
990
  */
991
991
  declare function useSearchHotkey(options?: UseSearchHotkeyOptions): UseSearchHotkeyResult;
992
992
 
993
+ /**
994
+ * Like `useState`, but when the surrounding `ScrollRestorationProvider` is
995
+ * mounting a browser back/forward traversal, the initial state is read from
996
+ * an in-memory snapshot (so infinite lists paint tall enough to restore
997
+ * scroll). Writes back on every change. Outside a provider, degrades to
998
+ * plain `useState`.
999
+ */
1000
+ declare function useRestorableState<T>(subKey: string, initializer: () => T): [T, Dispatch<SetStateAction<T>>];
1001
+
1002
+ type ScrollRestorationContextValue = {
1003
+ routeKey: string;
1004
+ /** True when this route mount is a browser back/forward traversal. */
1005
+ isTraversal: boolean;
1006
+ anchorAttribute: string;
1007
+ };
1008
+ declare function useScrollRestorationContext(): ScrollRestorationContextValue | null;
1009
+ type ScrollRestorationProviderProps = {
1010
+ /** App-supplied key, typically `pathname + search`. */
1011
+ routeKey: string;
1012
+ /**
1013
+ * Nested scroll container. Omit to use the document (window) scroller.
1014
+ * Required when the app shells content inside `overflow-auto` / `overflow-y-auto`.
1015
+ */
1016
+ containerRef?: RefObject<HTMLElement | null>;
1017
+ /** Attribute used to mark restore anchors. Default: `data-scroll-anchor`. */
1018
+ anchorAttribute?: string;
1019
+ children: ReactNode;
1020
+ };
1021
+ /**
1022
+ * Owns per-route scroll marks: saves on scroll, resets to top on fresh
1023
+ * navigation, and restores (with anchor alignment) on browser back/forward.
1024
+ *
1025
+ * Apps must supply `routeKey` from their router (`usePathname` +
1026
+ * `useSearchParams`) so this package stays free of `next/*` imports.
1027
+ */
1028
+ declare function ScrollRestorationProvider({ routeKey, containerRef, anchorAttribute, children, }: ScrollRestorationProviderProps): React.JSX.Element;
1029
+
1030
+ /**
1031
+ * Framework-free scroll-restoration store.
1032
+ *
1033
+ * Keeps per-route scroll marks (offset + anchor) and in-memory list snapshots
1034
+ * so infinite-scroll pages can remount tall enough for the browser to land
1035
+ * where the user left off. No `next/*` imports — apps supply the route key.
1036
+ */
1037
+ type ScrollMark = {
1038
+ top: number;
1039
+ anchorId: string | null;
1040
+ /** Anchor's top edge relative to the scrollport top at save time. */
1041
+ anchorTop: number;
1042
+ };
1043
+
993
1044
  type SearchablePickerLabels = {
994
1045
  placeholder?: string;
995
1046
  searchPlaceholder?: string;
@@ -1501,4 +1552,4 @@ declare function useRealtimeChannel({ getWsUrl, onEvent, enabled, reconnectDelay
1501
1552
 
1502
1553
  declare function cn(...inputs: ClassValue[]): string;
1503
1554
 
1504
- export { type AutoplayState, AvatarEditor, AvatarEditorDialog, type AvatarEditorDialogProps, type AvatarEditorProps, type BlocksLanguage, BrandX, type BrandXProps, Bubble, BubbleContent, BubbleGroup, BubbleReactions, type ChatListMessage, ChatMessageList, type ChatMessageListProps, ConfirmDestructiveDialog, type ConfirmDestructiveDialogProps, type ConversationKind, DEFAULT_EDITABLE_SECTION_LABELS, DataList, DataListItem, type DataListItemProps, type DataListProps, type DescribedPlaybackError, DropdownMenuItem, DropdownMenuSeparator, EditableSection, type EditableSectionLabels, type EditableSectionMode, type EditableSectionProps, type EditableSectionSlots, type EmojiCategoryData, type EmojiCategoryKey, type EmojiDatum, EmojiInput, type EmojiInputProps, EmojiPicker, type EmojiPickerLabels, type EmojiPickerLocale, EmojiPickerPopover, type EmojiPickerPopoverProps, type EmojiPickerProps, type EmojiSkinTone, EmojiTextarea, type EmojiTextareaProps, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, type EmptyStateProps, EmptyTitle, ErrorState, ExpandableText, type ExpandableTextProps, type FeatureEntry, FeedVideoPlayer, type FeedVideoPlayerProps, FieldMessage, type FieldMessageProps, type FindOrCreateConversationInput, type HlsPlayerMode, ImageLightbox, type ImageLightboxLabels, type ImageLightboxProps, type Language, LanguageContext, type LanguageContextValue, LanguageSwitcher, type LanguageSwitcherLabels, type LanguageSwitcherProps, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, type MergedPlatformAccountOrg, Message, MessageAvatar, MessageComposer, type MessageComposerProps, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, type MexicoMapProps, type MexicoState, type MexicoStateId, type OpenThreadRequest, OrgSwitcher, type OrgSwitcherLabels, type OrgSwitcherProps, type OrgSwitcherTenant, PLATFORM_ACCOUNT_ORG_COLLAPSE_AT, PaymentIcon, type PaymentIconFormat, type PaymentIconProps, PhoneInput, type PhoneInputProps, PlatformAccountMenu, type PlatformAccountMenuLabels, type PlatformAccountMenuOrg, type PlatformAccountMenuProps, type PlatformAccountMenuUrls, type PlatformAccountMenuUser, type PlatformAccountMenuVariant, PlatformNavbar, type PlatformNavbarProps, type PlaybackErrorContext, type PlaybackErrorDetail, type PlaybackErrorKind, type PlaybackState, type PlaybackStats, type ProfessionalVerificationStatus, type QualityLevel, type RealtimeEvent, type ScrollFadeXEdges, SearchCommand, type SearchCommandLabels, type SearchCommandProps, type SearchCommandSelection, type SearchHit, SearchablePicker, type SearchablePickerCreateOption, type SearchablePickerLabels, type SearchablePickerMultipleProps, type SearchablePickerPinned, type SearchablePickerProps, type SearchablePickerSingleProps, type SupportChatClient, type SupportConversation, type SupportMessage, type SupportMessengerItem, type SupportMessengerLabels, SupportMessengerProvider, type SupportMessengerProviderProps, type SupportMessengerTab, ThemeSwitcher, type ThemeSwitcherLabels, type ThemeSwitcherProps, type UseEditableSectionOptions, type UseEditableSectionResult, type UseFeedExclusivePlaybackResult, type UseHlsPlaybackOptions, type UseHlsPlaybackResult, type UsePlaybackStatsOptions, type UseRealtimeChannelOptions, type UseSearchHotkeyOptions, type UseSearchHotkeyResult, type UseSupportConversationOptions, type UseSupportConversationResult, VerifiedProfessionalBadge, type VerifiedProfessionalBadgeProps, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, bubbleVariants, cn, createLiveHlsConfig, createSupportChatClient, createVodHlsConfig, defaultLanguages, describeAvResync, describePlaybackError, formatPaymentCardBrand, fuzzyMatch, insertAtCaret, markerVariants, mergePlatformAccountOrgs, normalizeEmojiQuery, normalizePaymentCardBrand, paymentIconBrandFromStripe, paymentTypeFromStripeBrand, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useEditableSection, useFeedExclusivePlayback, useHlsPlayback, useLanguageContext, useMediaQuery, usePlaybackStats, useRealtimeChannel, useScrollFadeXEdges, useSearchHotkey, useSupportConversation, useSupportMessenger, useSupportMessengerOptional };
1555
+ export { type AutoplayState, AvatarEditor, AvatarEditorDialog, type AvatarEditorDialogProps, type AvatarEditorProps, type BlocksLanguage, BrandX, type BrandXProps, Bubble, BubbleContent, BubbleGroup, BubbleReactions, type ChatListMessage, ChatMessageList, type ChatMessageListProps, ConfirmDestructiveDialog, type ConfirmDestructiveDialogProps, type ConversationKind, DEFAULT_EDITABLE_SECTION_LABELS, DataList, DataListItem, type DataListItemProps, type DataListProps, type DescribedPlaybackError, DropdownMenuItem, DropdownMenuSeparator, EditableSection, type EditableSectionLabels, type EditableSectionMode, type EditableSectionProps, type EditableSectionSlots, type EmojiCategoryData, type EmojiCategoryKey, type EmojiDatum, EmojiInput, type EmojiInputProps, EmojiPicker, type EmojiPickerLabels, type EmojiPickerLocale, EmojiPickerPopover, type EmojiPickerPopoverProps, type EmojiPickerProps, type EmojiSkinTone, EmojiTextarea, type EmojiTextareaProps, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, type EmptyStateProps, EmptyTitle, ErrorState, ExpandableText, type ExpandableTextProps, type FeatureEntry, FeedVideoPlayer, type FeedVideoPlayerProps, FieldMessage, type FieldMessageProps, type FindOrCreateConversationInput, type HlsPlayerMode, ImageLightbox, type ImageLightboxLabels, type ImageLightboxProps, type Language, LanguageContext, type LanguageContextValue, LanguageSwitcher, type LanguageSwitcherLabels, type LanguageSwitcherProps, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, type MergedPlatformAccountOrg, Message, MessageAvatar, MessageComposer, type MessageComposerProps, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, type MexicoMapProps, type MexicoState, type MexicoStateId, type OpenThreadRequest, OrgSwitcher, type OrgSwitcherLabels, type OrgSwitcherProps, type OrgSwitcherTenant, PLATFORM_ACCOUNT_ORG_COLLAPSE_AT, PaymentIcon, type PaymentIconFormat, type PaymentIconProps, PhoneInput, type PhoneInputProps, PlatformAccountMenu, type PlatformAccountMenuLabels, type PlatformAccountMenuOrg, type PlatformAccountMenuProps, type PlatformAccountMenuUrls, type PlatformAccountMenuUser, type PlatformAccountMenuVariant, PlatformNavbar, type PlatformNavbarProps, type PlaybackErrorContext, type PlaybackErrorDetail, type PlaybackErrorKind, type PlaybackState, type PlaybackStats, type ProfessionalVerificationStatus, type QualityLevel, type RealtimeEvent, type ScrollFadeXEdges, type ScrollMark, type ScrollRestorationContextValue, ScrollRestorationProvider, type ScrollRestorationProviderProps, SearchCommand, type SearchCommandLabels, type SearchCommandProps, type SearchCommandSelection, type SearchHit, SearchablePicker, type SearchablePickerCreateOption, type SearchablePickerLabels, type SearchablePickerMultipleProps, type SearchablePickerPinned, type SearchablePickerProps, type SearchablePickerSingleProps, type SupportChatClient, type SupportConversation, type SupportMessage, type SupportMessengerItem, type SupportMessengerLabels, SupportMessengerProvider, type SupportMessengerProviderProps, type SupportMessengerTab, ThemeSwitcher, type ThemeSwitcherLabels, type ThemeSwitcherProps, type UseEditableSectionOptions, type UseEditableSectionResult, type UseFeedExclusivePlaybackResult, type UseHlsPlaybackOptions, type UseHlsPlaybackResult, type UsePlaybackStatsOptions, type UseRealtimeChannelOptions, type UseSearchHotkeyOptions, type UseSearchHotkeyResult, type UseSupportConversationOptions, type UseSupportConversationResult, VerifiedProfessionalBadge, type VerifiedProfessionalBadgeProps, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, bubbleVariants, cn, createLiveHlsConfig, createSupportChatClient, createVodHlsConfig, defaultLanguages, describeAvResync, describePlaybackError, formatPaymentCardBrand, fuzzyMatch, insertAtCaret, markerVariants, mergePlatformAccountOrgs, normalizeEmojiQuery, normalizePaymentCardBrand, paymentIconBrandFromStripe, paymentTypeFromStripeBrand, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useEditableSection, useFeedExclusivePlayback, useHlsPlayback, useLanguageContext, useMediaQuery, usePlaybackStats, useRealtimeChannel, useRestorableState, useScrollFadeXEdges, useScrollRestorationContext, useSearchHotkey, useSupportConversation, useSupportMessenger, useSupportMessengerOptional };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { FormEvent, KeyboardEvent, RefObject, CSSProperties, ReactNode, ComponentProps, SVGProps } from 'react';
2
+ import { FormEvent, KeyboardEvent, RefObject, CSSProperties, ReactNode, ComponentProps, Dispatch, SetStateAction, SVGProps } from 'react';
3
3
  import { LucideIcon } from 'lucide-react';
4
4
  import * as class_variance_authority_types from 'class-variance-authority/types';
5
5
  import { VariantProps } from 'class-variance-authority';
@@ -990,6 +990,57 @@ interface UseSearchHotkeyResult {
990
990
  */
991
991
  declare function useSearchHotkey(options?: UseSearchHotkeyOptions): UseSearchHotkeyResult;
992
992
 
993
+ /**
994
+ * Like `useState`, but when the surrounding `ScrollRestorationProvider` is
995
+ * mounting a browser back/forward traversal, the initial state is read from
996
+ * an in-memory snapshot (so infinite lists paint tall enough to restore
997
+ * scroll). Writes back on every change. Outside a provider, degrades to
998
+ * plain `useState`.
999
+ */
1000
+ declare function useRestorableState<T>(subKey: string, initializer: () => T): [T, Dispatch<SetStateAction<T>>];
1001
+
1002
+ type ScrollRestorationContextValue = {
1003
+ routeKey: string;
1004
+ /** True when this route mount is a browser back/forward traversal. */
1005
+ isTraversal: boolean;
1006
+ anchorAttribute: string;
1007
+ };
1008
+ declare function useScrollRestorationContext(): ScrollRestorationContextValue | null;
1009
+ type ScrollRestorationProviderProps = {
1010
+ /** App-supplied key, typically `pathname + search`. */
1011
+ routeKey: string;
1012
+ /**
1013
+ * Nested scroll container. Omit to use the document (window) scroller.
1014
+ * Required when the app shells content inside `overflow-auto` / `overflow-y-auto`.
1015
+ */
1016
+ containerRef?: RefObject<HTMLElement | null>;
1017
+ /** Attribute used to mark restore anchors. Default: `data-scroll-anchor`. */
1018
+ anchorAttribute?: string;
1019
+ children: ReactNode;
1020
+ };
1021
+ /**
1022
+ * Owns per-route scroll marks: saves on scroll, resets to top on fresh
1023
+ * navigation, and restores (with anchor alignment) on browser back/forward.
1024
+ *
1025
+ * Apps must supply `routeKey` from their router (`usePathname` +
1026
+ * `useSearchParams`) so this package stays free of `next/*` imports.
1027
+ */
1028
+ declare function ScrollRestorationProvider({ routeKey, containerRef, anchorAttribute, children, }: ScrollRestorationProviderProps): React.JSX.Element;
1029
+
1030
+ /**
1031
+ * Framework-free scroll-restoration store.
1032
+ *
1033
+ * Keeps per-route scroll marks (offset + anchor) and in-memory list snapshots
1034
+ * so infinite-scroll pages can remount tall enough for the browser to land
1035
+ * where the user left off. No `next/*` imports — apps supply the route key.
1036
+ */
1037
+ type ScrollMark = {
1038
+ top: number;
1039
+ anchorId: string | null;
1040
+ /** Anchor's top edge relative to the scrollport top at save time. */
1041
+ anchorTop: number;
1042
+ };
1043
+
993
1044
  type SearchablePickerLabels = {
994
1045
  placeholder?: string;
995
1046
  searchPlaceholder?: string;
@@ -1501,4 +1552,4 @@ declare function useRealtimeChannel({ getWsUrl, onEvent, enabled, reconnectDelay
1501
1552
 
1502
1553
  declare function cn(...inputs: ClassValue[]): string;
1503
1554
 
1504
- export { type AutoplayState, AvatarEditor, AvatarEditorDialog, type AvatarEditorDialogProps, type AvatarEditorProps, type BlocksLanguage, BrandX, type BrandXProps, Bubble, BubbleContent, BubbleGroup, BubbleReactions, type ChatListMessage, ChatMessageList, type ChatMessageListProps, ConfirmDestructiveDialog, type ConfirmDestructiveDialogProps, type ConversationKind, DEFAULT_EDITABLE_SECTION_LABELS, DataList, DataListItem, type DataListItemProps, type DataListProps, type DescribedPlaybackError, DropdownMenuItem, DropdownMenuSeparator, EditableSection, type EditableSectionLabels, type EditableSectionMode, type EditableSectionProps, type EditableSectionSlots, type EmojiCategoryData, type EmojiCategoryKey, type EmojiDatum, EmojiInput, type EmojiInputProps, EmojiPicker, type EmojiPickerLabels, type EmojiPickerLocale, EmojiPickerPopover, type EmojiPickerPopoverProps, type EmojiPickerProps, type EmojiSkinTone, EmojiTextarea, type EmojiTextareaProps, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, type EmptyStateProps, EmptyTitle, ErrorState, ExpandableText, type ExpandableTextProps, type FeatureEntry, FeedVideoPlayer, type FeedVideoPlayerProps, FieldMessage, type FieldMessageProps, type FindOrCreateConversationInput, type HlsPlayerMode, ImageLightbox, type ImageLightboxLabels, type ImageLightboxProps, type Language, LanguageContext, type LanguageContextValue, LanguageSwitcher, type LanguageSwitcherLabels, type LanguageSwitcherProps, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, type MergedPlatformAccountOrg, Message, MessageAvatar, MessageComposer, type MessageComposerProps, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, type MexicoMapProps, type MexicoState, type MexicoStateId, type OpenThreadRequest, OrgSwitcher, type OrgSwitcherLabels, type OrgSwitcherProps, type OrgSwitcherTenant, PLATFORM_ACCOUNT_ORG_COLLAPSE_AT, PaymentIcon, type PaymentIconFormat, type PaymentIconProps, PhoneInput, type PhoneInputProps, PlatformAccountMenu, type PlatformAccountMenuLabels, type PlatformAccountMenuOrg, type PlatformAccountMenuProps, type PlatformAccountMenuUrls, type PlatformAccountMenuUser, type PlatformAccountMenuVariant, PlatformNavbar, type PlatformNavbarProps, type PlaybackErrorContext, type PlaybackErrorDetail, type PlaybackErrorKind, type PlaybackState, type PlaybackStats, type ProfessionalVerificationStatus, type QualityLevel, type RealtimeEvent, type ScrollFadeXEdges, SearchCommand, type SearchCommandLabels, type SearchCommandProps, type SearchCommandSelection, type SearchHit, SearchablePicker, type SearchablePickerCreateOption, type SearchablePickerLabels, type SearchablePickerMultipleProps, type SearchablePickerPinned, type SearchablePickerProps, type SearchablePickerSingleProps, type SupportChatClient, type SupportConversation, type SupportMessage, type SupportMessengerItem, type SupportMessengerLabels, SupportMessengerProvider, type SupportMessengerProviderProps, type SupportMessengerTab, ThemeSwitcher, type ThemeSwitcherLabels, type ThemeSwitcherProps, type UseEditableSectionOptions, type UseEditableSectionResult, type UseFeedExclusivePlaybackResult, type UseHlsPlaybackOptions, type UseHlsPlaybackResult, type UsePlaybackStatsOptions, type UseRealtimeChannelOptions, type UseSearchHotkeyOptions, type UseSearchHotkeyResult, type UseSupportConversationOptions, type UseSupportConversationResult, VerifiedProfessionalBadge, type VerifiedProfessionalBadgeProps, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, bubbleVariants, cn, createLiveHlsConfig, createSupportChatClient, createVodHlsConfig, defaultLanguages, describeAvResync, describePlaybackError, formatPaymentCardBrand, fuzzyMatch, insertAtCaret, markerVariants, mergePlatformAccountOrgs, normalizeEmojiQuery, normalizePaymentCardBrand, paymentIconBrandFromStripe, paymentTypeFromStripeBrand, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useEditableSection, useFeedExclusivePlayback, useHlsPlayback, useLanguageContext, useMediaQuery, usePlaybackStats, useRealtimeChannel, useScrollFadeXEdges, useSearchHotkey, useSupportConversation, useSupportMessenger, useSupportMessengerOptional };
1555
+ export { type AutoplayState, AvatarEditor, AvatarEditorDialog, type AvatarEditorDialogProps, type AvatarEditorProps, type BlocksLanguage, BrandX, type BrandXProps, Bubble, BubbleContent, BubbleGroup, BubbleReactions, type ChatListMessage, ChatMessageList, type ChatMessageListProps, ConfirmDestructiveDialog, type ConfirmDestructiveDialogProps, type ConversationKind, DEFAULT_EDITABLE_SECTION_LABELS, DataList, DataListItem, type DataListItemProps, type DataListProps, type DescribedPlaybackError, DropdownMenuItem, DropdownMenuSeparator, EditableSection, type EditableSectionLabels, type EditableSectionMode, type EditableSectionProps, type EditableSectionSlots, type EmojiCategoryData, type EmojiCategoryKey, type EmojiDatum, EmojiInput, type EmojiInputProps, EmojiPicker, type EmojiPickerLabels, type EmojiPickerLocale, EmojiPickerPopover, type EmojiPickerPopoverProps, type EmojiPickerProps, type EmojiSkinTone, EmojiTextarea, type EmojiTextareaProps, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, type EmptyStateProps, EmptyTitle, ErrorState, ExpandableText, type ExpandableTextProps, type FeatureEntry, FeedVideoPlayer, type FeedVideoPlayerProps, FieldMessage, type FieldMessageProps, type FindOrCreateConversationInput, type HlsPlayerMode, ImageLightbox, type ImageLightboxLabels, type ImageLightboxProps, type Language, LanguageContext, type LanguageContextValue, LanguageSwitcher, type LanguageSwitcherLabels, type LanguageSwitcherProps, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, type MergedPlatformAccountOrg, Message, MessageAvatar, MessageComposer, type MessageComposerProps, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, type MexicoMapProps, type MexicoState, type MexicoStateId, type OpenThreadRequest, OrgSwitcher, type OrgSwitcherLabels, type OrgSwitcherProps, type OrgSwitcherTenant, PLATFORM_ACCOUNT_ORG_COLLAPSE_AT, PaymentIcon, type PaymentIconFormat, type PaymentIconProps, PhoneInput, type PhoneInputProps, PlatformAccountMenu, type PlatformAccountMenuLabels, type PlatformAccountMenuOrg, type PlatformAccountMenuProps, type PlatformAccountMenuUrls, type PlatformAccountMenuUser, type PlatformAccountMenuVariant, PlatformNavbar, type PlatformNavbarProps, type PlaybackErrorContext, type PlaybackErrorDetail, type PlaybackErrorKind, type PlaybackState, type PlaybackStats, type ProfessionalVerificationStatus, type QualityLevel, type RealtimeEvent, type ScrollFadeXEdges, type ScrollMark, type ScrollRestorationContextValue, ScrollRestorationProvider, type ScrollRestorationProviderProps, SearchCommand, type SearchCommandLabels, type SearchCommandProps, type SearchCommandSelection, type SearchHit, SearchablePicker, type SearchablePickerCreateOption, type SearchablePickerLabels, type SearchablePickerMultipleProps, type SearchablePickerPinned, type SearchablePickerProps, type SearchablePickerSingleProps, type SupportChatClient, type SupportConversation, type SupportMessage, type SupportMessengerItem, type SupportMessengerLabels, SupportMessengerProvider, type SupportMessengerProviderProps, type SupportMessengerTab, ThemeSwitcher, type ThemeSwitcherLabels, type ThemeSwitcherProps, type UseEditableSectionOptions, type UseEditableSectionResult, type UseFeedExclusivePlaybackResult, type UseHlsPlaybackOptions, type UseHlsPlaybackResult, type UsePlaybackStatsOptions, type UseRealtimeChannelOptions, type UseSearchHotkeyOptions, type UseSearchHotkeyResult, type UseSupportConversationOptions, type UseSupportConversationResult, VerifiedProfessionalBadge, type VerifiedProfessionalBadgeProps, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, bubbleVariants, cn, createLiveHlsConfig, createSupportChatClient, createVodHlsConfig, defaultLanguages, describeAvResync, describePlaybackError, formatPaymentCardBrand, fuzzyMatch, insertAtCaret, markerVariants, mergePlatformAccountOrgs, normalizeEmojiQuery, normalizePaymentCardBrand, paymentIconBrandFromStripe, paymentTypeFromStripeBrand, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useEditableSection, useFeedExclusivePlayback, useHlsPlayback, useLanguageContext, useMediaQuery, usePlaybackStats, useRealtimeChannel, useRestorableState, useScrollFadeXEdges, useScrollRestorationContext, useSearchHotkey, useSupportConversation, useSupportMessenger, useSupportMessengerOptional };
package/dist/index.js CHANGED
@@ -5150,7 +5150,7 @@ function VideoPlayer({
5150
5150
  setUserStarted(true);
5151
5151
  revealControls();
5152
5152
  },
5153
- className: "absolute inset-0 flex items-center justify-center bg-cover bg-center",
5153
+ className: "absolute inset-0 flex items-center justify-center bg-black bg-contain bg-center bg-no-repeat",
5154
5154
  style: poster ? { backgroundImage: `url(${poster})` } : void 0,
5155
5155
  children: /* @__PURE__ */ jsx("span", { className: "flex size-16 items-center justify-center rounded-full bg-black/50 backdrop-blur-sm transition group-hover:bg-black/70", children: /* @__PURE__ */ jsx(Play, { className: "size-8 translate-x-0.5", fill: "currentColor" }) })
5156
5156
  }
@@ -5615,6 +5615,340 @@ function useSearchHotkey(options = {}) {
5615
5615
  return { open, setOpen, toggle };
5616
5616
  }
5617
5617
 
5618
+ // src/lib/scroll-restoration/store.ts
5619
+ var MAX_MARKS = 30;
5620
+ var MAX_SNAPSHOT_ROUTES = 3;
5621
+ var PENDING_TRAVERSAL_TTL_MS = 1e3;
5622
+ var scrollMarks = /* @__PURE__ */ new Map();
5623
+ var snapshotsByRoute = /* @__PURE__ */ new Map();
5624
+ var pendingTraversalKey = null;
5625
+ var pendingTraversalTimeout = null;
5626
+ var popstateInstalled = false;
5627
+ function touchMapEntry(map, key, value, max) {
5628
+ if (map.has(key)) map.delete(key);
5629
+ map.set(key, value);
5630
+ while (map.size > max) {
5631
+ const oldest = map.keys().next().value;
5632
+ if (oldest === void 0) break;
5633
+ map.delete(oldest);
5634
+ }
5635
+ }
5636
+ function getScrollMark(routeKey) {
5637
+ const mark = scrollMarks.get(routeKey);
5638
+ if (!mark) return void 0;
5639
+ scrollMarks.delete(routeKey);
5640
+ scrollMarks.set(routeKey, mark);
5641
+ return mark;
5642
+ }
5643
+ function setScrollMark(routeKey, mark) {
5644
+ touchMapEntry(scrollMarks, routeKey, mark, MAX_MARKS);
5645
+ }
5646
+ function deleteScrollMark(routeKey) {
5647
+ scrollMarks.delete(routeKey);
5648
+ }
5649
+ function getSnapshot(routeKey, subKey) {
5650
+ const route = snapshotsByRoute.get(routeKey);
5651
+ if (!route) return void 0;
5652
+ snapshotsByRoute.delete(routeKey);
5653
+ snapshotsByRoute.set(routeKey, route);
5654
+ return route.get(subKey);
5655
+ }
5656
+ function setSnapshot(routeKey, subKey, value) {
5657
+ let route = snapshotsByRoute.get(routeKey);
5658
+ if (route) {
5659
+ snapshotsByRoute.delete(routeKey);
5660
+ } else {
5661
+ route = /* @__PURE__ */ new Map();
5662
+ }
5663
+ route.set(subKey, value);
5664
+ snapshotsByRoute.set(routeKey, route);
5665
+ while (snapshotsByRoute.size > MAX_SNAPSHOT_ROUTES) {
5666
+ const oldest = snapshotsByRoute.keys().next().value;
5667
+ if (oldest === void 0) break;
5668
+ snapshotsByRoute.delete(oldest);
5669
+ }
5670
+ }
5671
+ function deleteSnapshotsForRoute(routeKey) {
5672
+ snapshotsByRoute.delete(routeKey);
5673
+ }
5674
+ function clearRoute(routeKey) {
5675
+ deleteScrollMark(routeKey);
5676
+ deleteSnapshotsForRoute(routeKey);
5677
+ }
5678
+ function clearPendingTraversalTimer() {
5679
+ if (pendingTraversalTimeout !== null) {
5680
+ clearTimeout(pendingTraversalTimeout);
5681
+ pendingTraversalTimeout = null;
5682
+ }
5683
+ }
5684
+ function schedulePendingTraversalClear() {
5685
+ clearPendingTraversalTimer();
5686
+ pendingTraversalTimeout = setTimeout(() => {
5687
+ pendingTraversalKey = null;
5688
+ pendingTraversalTimeout = null;
5689
+ }, PENDING_TRAVERSAL_TTL_MS);
5690
+ }
5691
+ function ensurePopstateListener() {
5692
+ if (popstateInstalled || typeof window === "undefined") return;
5693
+ popstateInstalled = true;
5694
+ window.addEventListener("popstate", () => {
5695
+ pendingTraversalKey = window.location.pathname + window.location.search;
5696
+ schedulePendingTraversalClear();
5697
+ });
5698
+ }
5699
+ function isPendingTraversal(routeKey) {
5700
+ ensurePopstateListener();
5701
+ return pendingTraversalKey === routeKey;
5702
+ }
5703
+ function consumePendingTraversal(routeKey) {
5704
+ ensurePopstateListener();
5705
+ if (pendingTraversalKey !== routeKey) return false;
5706
+ pendingTraversalKey = null;
5707
+ clearPendingTraversalTimer();
5708
+ return true;
5709
+ }
5710
+ function getScrollTop(container) {
5711
+ if (!container) {
5712
+ return window.scrollY || document.documentElement.scrollTop || 0;
5713
+ }
5714
+ return container.scrollTop;
5715
+ }
5716
+ function setScrollTop(container, top) {
5717
+ if (!container) {
5718
+ window.scrollTo(0, top);
5719
+ return;
5720
+ }
5721
+ container.scrollTop = top;
5722
+ }
5723
+ function scrollportTop(container) {
5724
+ return container ? container.getBoundingClientRect().top : 0;
5725
+ }
5726
+ function scrollportBottom(container) {
5727
+ if (!container) return window.innerHeight;
5728
+ return container.getBoundingClientRect().bottom;
5729
+ }
5730
+ function escapeAttrValue(value) {
5731
+ if (typeof CSS !== "undefined" && typeof CSS.escape === "function") {
5732
+ return CSS.escape(value);
5733
+ }
5734
+ return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
5735
+ }
5736
+ function resolveAnchor(container, attribute) {
5737
+ const scope = container ?? document;
5738
+ const nodes = scope.querySelectorAll(`[${attribute}]`);
5739
+ if (nodes.length === 0) return null;
5740
+ const portTop = scrollportTop(container);
5741
+ const portBottom = scrollportBottom(container);
5742
+ let bestId = null;
5743
+ let bestTop = 0;
5744
+ let bestScore = Infinity;
5745
+ for (const node of nodes) {
5746
+ if (!(node instanceof HTMLElement)) continue;
5747
+ const id = node.getAttribute(attribute);
5748
+ if (!id) continue;
5749
+ const rect = node.getBoundingClientRect();
5750
+ if (rect.bottom <= portTop || rect.top >= portBottom) continue;
5751
+ const relativeTop = rect.top - portTop;
5752
+ const score = Math.abs(relativeTop);
5753
+ if (score < bestScore) {
5754
+ bestScore = score;
5755
+ bestId = id;
5756
+ bestTop = relativeTop;
5757
+ }
5758
+ }
5759
+ if (!bestId) return null;
5760
+ return { id: bestId, top: bestTop };
5761
+ }
5762
+ function captureMark(container, attribute) {
5763
+ const anchor = resolveAnchor(container, attribute);
5764
+ return {
5765
+ top: getScrollTop(container),
5766
+ anchorId: anchor?.id ?? null,
5767
+ anchorTop: anchor?.top ?? 0
5768
+ };
5769
+ }
5770
+ function applyMark(container, mark, attribute) {
5771
+ if (mark.anchorId) {
5772
+ const scope = container ?? document;
5773
+ const el = scope.querySelector(
5774
+ `[${attribute}="${escapeAttrValue(mark.anchorId)}"]`
5775
+ );
5776
+ if (el instanceof HTMLElement) {
5777
+ const portTop = scrollportTop(container);
5778
+ const currentRelativeTop = el.getBoundingClientRect().top - portTop;
5779
+ const delta = currentRelativeTop - mark.anchorTop;
5780
+ setScrollTop(container, getScrollTop(container) + delta);
5781
+ return true;
5782
+ }
5783
+ }
5784
+ setScrollTop(container, mark.top);
5785
+ return false;
5786
+ }
5787
+ function getScrollHeight(container) {
5788
+ if (!container) {
5789
+ return Math.max(
5790
+ document.documentElement.scrollHeight,
5791
+ document.body?.scrollHeight ?? 0
5792
+ );
5793
+ }
5794
+ return container.scrollHeight;
5795
+ }
5796
+ var DEFAULT_ANCHOR_ATTRIBUTE = "data-scroll-anchor";
5797
+ var STABILIZE_MS = 600;
5798
+ var ScrollRestorationContext = createContext(null);
5799
+ function useScrollRestorationContext() {
5800
+ return useContext(ScrollRestorationContext);
5801
+ }
5802
+ function readContainer(containerRef) {
5803
+ return containerRef?.current ?? null;
5804
+ }
5805
+ function ScrollRestorationProvider({
5806
+ routeKey,
5807
+ containerRef,
5808
+ anchorAttribute = DEFAULT_ANCHOR_ATTRIBUTE,
5809
+ children
5810
+ }) {
5811
+ ensurePopstateListener();
5812
+ const traversalForRouteRef = useRef({ routeKey: "", isTraversal: false });
5813
+ if (traversalForRouteRef.current.routeKey !== routeKey) {
5814
+ traversalForRouteRef.current = {
5815
+ routeKey,
5816
+ isTraversal: isPendingTraversal(routeKey)
5817
+ };
5818
+ }
5819
+ const isTraversal = traversalForRouteRef.current.isTraversal;
5820
+ const value = useMemo(
5821
+ () => ({
5822
+ routeKey,
5823
+ isTraversal,
5824
+ anchorAttribute
5825
+ }),
5826
+ [routeKey, isTraversal, anchorAttribute]
5827
+ );
5828
+ useEffect(() => {
5829
+ if (typeof window === "undefined" || !("scrollRestoration" in history)) {
5830
+ return;
5831
+ }
5832
+ const previous = history.scrollRestoration;
5833
+ history.scrollRestoration = "manual";
5834
+ return () => {
5835
+ history.scrollRestoration = previous;
5836
+ };
5837
+ }, []);
5838
+ const prevRouteKeyRef = useRef(routeKey);
5839
+ const anchorAttributeRef = useRef(anchorAttribute);
5840
+ anchorAttributeRef.current = anchorAttribute;
5841
+ useEffect(() => {
5842
+ const container = readContainer(containerRef);
5843
+ const target = container ?? window;
5844
+ let rafId = 0;
5845
+ const onScroll = () => {
5846
+ if (rafId) return;
5847
+ rafId = requestAnimationFrame(() => {
5848
+ rafId = 0;
5849
+ setScrollMark(
5850
+ routeKey,
5851
+ captureMark(readContainer(containerRef), anchorAttribute)
5852
+ );
5853
+ });
5854
+ };
5855
+ target.addEventListener("scroll", onScroll, { passive: true });
5856
+ return () => {
5857
+ target.removeEventListener("scroll", onScroll);
5858
+ if (rafId) cancelAnimationFrame(rafId);
5859
+ };
5860
+ }, [routeKey, containerRef, anchorAttribute]);
5861
+ useLayoutEffect(() => {
5862
+ const container = readContainer(containerRef);
5863
+ const prevKey = prevRouteKeyRef.current;
5864
+ if (prevKey !== routeKey) {
5865
+ setScrollMark(
5866
+ prevKey,
5867
+ captureMark(container, anchorAttributeRef.current)
5868
+ );
5869
+ prevRouteKeyRef.current = routeKey;
5870
+ }
5871
+ const hasHash = typeof window !== "undefined" && window.location.hash.length > 1;
5872
+ if (isTraversal) {
5873
+ consumePendingTraversal(routeKey);
5874
+ const mark = getScrollMark(routeKey);
5875
+ if (!mark) return void 0;
5876
+ applyMark(container, mark, anchorAttribute);
5877
+ return startStabilizationLoop(container, mark, anchorAttribute);
5878
+ }
5879
+ clearRoute(routeKey);
5880
+ if (!hasHash) {
5881
+ setScrollTop(container, 0);
5882
+ }
5883
+ return void 0;
5884
+ }, [routeKey, isTraversal, containerRef, anchorAttribute]);
5885
+ return /* @__PURE__ */ jsx(ScrollRestorationContext.Provider, { value, children });
5886
+ }
5887
+ function startStabilizationLoop(container, mark, attribute) {
5888
+ const startedAt = performance.now();
5889
+ let lastHeight = getScrollHeight(container);
5890
+ let rafId = 0;
5891
+ let aborted = false;
5892
+ const abort = () => {
5893
+ aborted = true;
5894
+ };
5895
+ const onUserIntent = () => {
5896
+ abort();
5897
+ };
5898
+ window.addEventListener("wheel", onUserIntent, {
5899
+ passive: true,
5900
+ once: true
5901
+ });
5902
+ window.addEventListener("touchstart", onUserIntent, {
5903
+ passive: true,
5904
+ once: true
5905
+ });
5906
+ window.addEventListener("keydown", onUserIntent, {
5907
+ passive: true,
5908
+ once: true
5909
+ });
5910
+ window.addEventListener("pointerdown", onUserIntent, {
5911
+ passive: true,
5912
+ once: true
5913
+ });
5914
+ const tick = () => {
5915
+ if (aborted) return;
5916
+ if (performance.now() - startedAt > STABILIZE_MS) return;
5917
+ const height = getScrollHeight(container);
5918
+ if (height !== lastHeight) {
5919
+ lastHeight = height;
5920
+ applyMark(container, mark, attribute);
5921
+ }
5922
+ rafId = requestAnimationFrame(tick);
5923
+ };
5924
+ rafId = requestAnimationFrame(tick);
5925
+ return () => {
5926
+ abort();
5927
+ if (rafId) cancelAnimationFrame(rafId);
5928
+ window.removeEventListener("wheel", onUserIntent);
5929
+ window.removeEventListener("touchstart", onUserIntent);
5930
+ window.removeEventListener("keydown", onUserIntent);
5931
+ window.removeEventListener("pointerdown", onUserIntent);
5932
+ };
5933
+ }
5934
+
5935
+ // src/hooks/useRestorableState.ts
5936
+ function useRestorableState(subKey, initializer) {
5937
+ const ctx = useScrollRestorationContext();
5938
+ const [state, setState] = useState(() => {
5939
+ if (!ctx) return initializer();
5940
+ const traversal = ctx.isTraversal || isPendingTraversal(ctx.routeKey);
5941
+ if (!traversal) return initializer();
5942
+ const snap = getSnapshot(ctx.routeKey, subKey);
5943
+ return snap !== void 0 ? snap : initializer();
5944
+ });
5945
+ useEffect(() => {
5946
+ if (!ctx) return;
5947
+ setSnapshot(ctx.routeKey, subKey, state);
5948
+ }, [ctx, subKey, state]);
5949
+ return [state, setState];
5950
+ }
5951
+
5618
5952
  // src/components/search/fuzzy.ts
5619
5953
  function normalize(value) {
5620
5954
  return value.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
@@ -8665,6 +8999,6 @@ function useRealtimeChannel({
8665
8999
  }, [enabled, reconnectDelayMs]);
8666
9000
  }
8667
9001
 
8668
- export { AvatarEditor, AvatarEditorDialog, BrandX, Bubble, BubbleContent, BubbleGroup, BubbleReactions, ChatMessageList, ConfirmDestructiveDialog, DEFAULT_EDITABLE_SECTION_LABELS, DataList, DataListItem, DropdownMenuItem, DropdownMenuSeparator, EditableSection, EmojiInput, EmojiPicker, EmojiPickerPopover, EmojiTextarea, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, ErrorState, ExpandableText, FeedVideoPlayer, FieldMessage, ImageLightbox, LanguageContext, LanguageSwitcher, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, Message, MessageAvatar, MessageComposer, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, OrgSwitcher, PLATFORM_ACCOUNT_ORG_COLLAPSE_AT, PaymentIcon, PhoneInput, PlatformAccountMenu, PlatformNavbar, SearchCommand, SearchablePicker, SupportMessengerProvider, ThemeSwitcher, VerifiedProfessionalBadge, VideoPlayer, avatarFallbackStyle, bubbleVariants, cn, createLiveHlsConfig, createSupportChatClient, createVodHlsConfig, defaultLanguages, describeAvResync, describePlaybackError, formatPaymentCardBrand, fuzzyMatch, getAvatarColors, getInitials, insertAtCaret, markerVariants, mergePlatformAccountOrgs, normalizeEmojiQuery, normalizePaymentCardBrand, paymentIconBrandFromStripe, paymentTypeFromStripeBrand, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useEditableSection, useFeedExclusivePlayback, useHlsPlayback, useLanguageContext, useMediaQuery2 as useMediaQuery, usePlaybackStats, useRealtimeChannel, useScrollFadeXEdges, useSearchHotkey, useSupportConversation, useSupportMessenger, useSupportMessengerOptional };
9002
+ export { AvatarEditor, AvatarEditorDialog, BrandX, Bubble, BubbleContent, BubbleGroup, BubbleReactions, ChatMessageList, ConfirmDestructiveDialog, DEFAULT_EDITABLE_SECTION_LABELS, DataList, DataListItem, DropdownMenuItem, DropdownMenuSeparator, EditableSection, EmojiInput, EmojiPicker, EmojiPickerPopover, EmojiTextarea, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, ErrorState, ExpandableText, FeedVideoPlayer, FieldMessage, ImageLightbox, LanguageContext, LanguageSwitcher, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, Message, MessageAvatar, MessageComposer, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, OrgSwitcher, PLATFORM_ACCOUNT_ORG_COLLAPSE_AT, PaymentIcon, PhoneInput, PlatformAccountMenu, PlatformNavbar, ScrollRestorationProvider, SearchCommand, SearchablePicker, SupportMessengerProvider, ThemeSwitcher, VerifiedProfessionalBadge, VideoPlayer, avatarFallbackStyle, bubbleVariants, cn, createLiveHlsConfig, createSupportChatClient, createVodHlsConfig, defaultLanguages, describeAvResync, describePlaybackError, formatPaymentCardBrand, fuzzyMatch, getAvatarColors, getInitials, insertAtCaret, markerVariants, mergePlatformAccountOrgs, normalizeEmojiQuery, normalizePaymentCardBrand, paymentIconBrandFromStripe, paymentTypeFromStripeBrand, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useEditableSection, useFeedExclusivePlayback, useHlsPlayback, useLanguageContext, useMediaQuery2 as useMediaQuery, usePlaybackStats, useRealtimeChannel, useRestorableState, useScrollFadeXEdges, useScrollRestorationContext, useSearchHotkey, useSupportConversation, useSupportMessenger, useSupportMessengerOptional };
8669
9003
  //# sourceMappingURL=index.js.map
8670
9004
  //# sourceMappingURL=index.js.map