@sesionario/blocks 1.6.0 → 1.7.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.cjs +297 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.js +299 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -95,6 +95,26 @@ declare function EmptyTitle({ className, ...props }: React.ComponentProps<"div">
|
|
|
95
95
|
declare function EmptyDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
|
|
96
96
|
declare function EmptyContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
97
97
|
|
|
98
|
+
type ImageLightboxLabels = {
|
|
99
|
+
ariaLabel?: string;
|
|
100
|
+
close?: string;
|
|
101
|
+
previous?: string;
|
|
102
|
+
next?: string;
|
|
103
|
+
};
|
|
104
|
+
type ImageLightboxProps = {
|
|
105
|
+
images: string[];
|
|
106
|
+
index: number;
|
|
107
|
+
onIndexChange: (index: number) => void;
|
|
108
|
+
onClose: () => void;
|
|
109
|
+
labels?: ImageLightboxLabels;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Fullscreen image gallery viewer. Portal overlay with Esc/click-to-close,
|
|
113
|
+
* arrow-key navigation, wheel/pinch zoom, and pan when zoomed. Locks page
|
|
114
|
+
* scroll while mounted.
|
|
115
|
+
*/
|
|
116
|
+
declare function ImageLightbox({ images, index, onIndexChange, onClose, labels, }: ImageLightboxProps): React.ReactPortal;
|
|
117
|
+
|
|
98
118
|
type ThemeSwitcherLabels = {
|
|
99
119
|
/** Tooltip label for the theme switcher */
|
|
100
120
|
theme?: string;
|
|
@@ -939,4 +959,4 @@ declare function useSupportConversation({ client, getWsUrl, conversationId: conv
|
|
|
939
959
|
|
|
940
960
|
declare function cn(...inputs: ClassValue[]): string;
|
|
941
961
|
|
|
942
|
-
export { type AutoplayState, AvatarEditor, AvatarEditorDialog, type AvatarEditorDialogProps, type AvatarEditorProps, type BlocksLanguage, Bubble, BubbleContent, BubbleGroup, BubbleReactions, type ChatListMessage, ChatMessageList, type ChatMessageListProps, ConfirmDestructiveDialog, type ConfirmDestructiveDialogProps, type ConversationKind, type DescribedPlaybackError, 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, type FeatureEntry, type FindOrCreateConversationInput, type HlsPlayerMode, type Language, LanguageContext, type LanguageContextValue, LanguageSwitcher, type LanguageSwitcherLabels, type LanguageSwitcherProps, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, Message, MessageAvatar, 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, PhoneInput, type PhoneInputProps, type PlaybackErrorContext, type PlaybackErrorDetail, type PlaybackErrorKind, type PlaybackState, type PlaybackStats, type ProfessionalVerificationStatus, type QualityLevel, SearchCommand, type SearchCommandLabels, type SearchCommandProps, type SearchCommandSelection, type SearchHit, type SupportChatClient, type SupportConversation, type SupportMessage, type SupportMessengerItem, type SupportMessengerLabels, SupportMessengerProvider, type SupportMessengerProviderProps, type SupportMessengerTab, ThemeSwitcher, type ThemeSwitcherLabels, type ThemeSwitcherProps, type UseHlsPlaybackOptions, type UseHlsPlaybackResult, type UsePlaybackStatsOptions, type UseSearchHotkeyOptions, type UseSearchHotkeyResult, type UseSupportConversationOptions, type UseSupportConversationResult, VerifiedProfessionalBadge, type VerifiedProfessionalBadgeProps, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, bubbleVariants, cn, createLiveHlsConfig, createSupportChatClient, createVodHlsConfig, defaultLanguages, describePlaybackError, fuzzyMatch, insertAtCaret, markerVariants, normalizeEmojiQuery, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useHlsPlayback, useLanguageContext, usePlaybackStats, useSearchHotkey, useSupportConversation, useSupportMessenger, useSupportMessengerOptional };
|
|
962
|
+
export { type AutoplayState, AvatarEditor, AvatarEditorDialog, type AvatarEditorDialogProps, type AvatarEditorProps, type BlocksLanguage, Bubble, BubbleContent, BubbleGroup, BubbleReactions, type ChatListMessage, ChatMessageList, type ChatMessageListProps, ConfirmDestructiveDialog, type ConfirmDestructiveDialogProps, type ConversationKind, type DescribedPlaybackError, 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, type FeatureEntry, 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, Message, MessageAvatar, 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, PhoneInput, type PhoneInputProps, type PlaybackErrorContext, type PlaybackErrorDetail, type PlaybackErrorKind, type PlaybackState, type PlaybackStats, type ProfessionalVerificationStatus, type QualityLevel, SearchCommand, type SearchCommandLabels, type SearchCommandProps, type SearchCommandSelection, type SearchHit, type SupportChatClient, type SupportConversation, type SupportMessage, type SupportMessengerItem, type SupportMessengerLabels, SupportMessengerProvider, type SupportMessengerProviderProps, type SupportMessengerTab, ThemeSwitcher, type ThemeSwitcherLabels, type ThemeSwitcherProps, type UseHlsPlaybackOptions, type UseHlsPlaybackResult, type UsePlaybackStatsOptions, type UseSearchHotkeyOptions, type UseSearchHotkeyResult, type UseSupportConversationOptions, type UseSupportConversationResult, VerifiedProfessionalBadge, type VerifiedProfessionalBadgeProps, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, bubbleVariants, cn, createLiveHlsConfig, createSupportChatClient, createVodHlsConfig, defaultLanguages, describePlaybackError, fuzzyMatch, insertAtCaret, markerVariants, normalizeEmojiQuery, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useHlsPlayback, useLanguageContext, usePlaybackStats, useSearchHotkey, useSupportConversation, useSupportMessenger, useSupportMessengerOptional };
|
package/dist/index.d.ts
CHANGED
|
@@ -95,6 +95,26 @@ declare function EmptyTitle({ className, ...props }: React.ComponentProps<"div">
|
|
|
95
95
|
declare function EmptyDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
|
|
96
96
|
declare function EmptyContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
97
97
|
|
|
98
|
+
type ImageLightboxLabels = {
|
|
99
|
+
ariaLabel?: string;
|
|
100
|
+
close?: string;
|
|
101
|
+
previous?: string;
|
|
102
|
+
next?: string;
|
|
103
|
+
};
|
|
104
|
+
type ImageLightboxProps = {
|
|
105
|
+
images: string[];
|
|
106
|
+
index: number;
|
|
107
|
+
onIndexChange: (index: number) => void;
|
|
108
|
+
onClose: () => void;
|
|
109
|
+
labels?: ImageLightboxLabels;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Fullscreen image gallery viewer. Portal overlay with Esc/click-to-close,
|
|
113
|
+
* arrow-key navigation, wheel/pinch zoom, and pan when zoomed. Locks page
|
|
114
|
+
* scroll while mounted.
|
|
115
|
+
*/
|
|
116
|
+
declare function ImageLightbox({ images, index, onIndexChange, onClose, labels, }: ImageLightboxProps): React.ReactPortal;
|
|
117
|
+
|
|
98
118
|
type ThemeSwitcherLabels = {
|
|
99
119
|
/** Tooltip label for the theme switcher */
|
|
100
120
|
theme?: string;
|
|
@@ -939,4 +959,4 @@ declare function useSupportConversation({ client, getWsUrl, conversationId: conv
|
|
|
939
959
|
|
|
940
960
|
declare function cn(...inputs: ClassValue[]): string;
|
|
941
961
|
|
|
942
|
-
export { type AutoplayState, AvatarEditor, AvatarEditorDialog, type AvatarEditorDialogProps, type AvatarEditorProps, type BlocksLanguage, Bubble, BubbleContent, BubbleGroup, BubbleReactions, type ChatListMessage, ChatMessageList, type ChatMessageListProps, ConfirmDestructiveDialog, type ConfirmDestructiveDialogProps, type ConversationKind, type DescribedPlaybackError, 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, type FeatureEntry, type FindOrCreateConversationInput, type HlsPlayerMode, type Language, LanguageContext, type LanguageContextValue, LanguageSwitcher, type LanguageSwitcherLabels, type LanguageSwitcherProps, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, Message, MessageAvatar, 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, PhoneInput, type PhoneInputProps, type PlaybackErrorContext, type PlaybackErrorDetail, type PlaybackErrorKind, type PlaybackState, type PlaybackStats, type ProfessionalVerificationStatus, type QualityLevel, SearchCommand, type SearchCommandLabels, type SearchCommandProps, type SearchCommandSelection, type SearchHit, type SupportChatClient, type SupportConversation, type SupportMessage, type SupportMessengerItem, type SupportMessengerLabels, SupportMessengerProvider, type SupportMessengerProviderProps, type SupportMessengerTab, ThemeSwitcher, type ThemeSwitcherLabels, type ThemeSwitcherProps, type UseHlsPlaybackOptions, type UseHlsPlaybackResult, type UsePlaybackStatsOptions, type UseSearchHotkeyOptions, type UseSearchHotkeyResult, type UseSupportConversationOptions, type UseSupportConversationResult, VerifiedProfessionalBadge, type VerifiedProfessionalBadgeProps, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, bubbleVariants, cn, createLiveHlsConfig, createSupportChatClient, createVodHlsConfig, defaultLanguages, describePlaybackError, fuzzyMatch, insertAtCaret, markerVariants, normalizeEmojiQuery, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useHlsPlayback, useLanguageContext, usePlaybackStats, useSearchHotkey, useSupportConversation, useSupportMessenger, useSupportMessengerOptional };
|
|
962
|
+
export { type AutoplayState, AvatarEditor, AvatarEditorDialog, type AvatarEditorDialogProps, type AvatarEditorProps, type BlocksLanguage, Bubble, BubbleContent, BubbleGroup, BubbleReactions, type ChatListMessage, ChatMessageList, type ChatMessageListProps, ConfirmDestructiveDialog, type ConfirmDestructiveDialogProps, type ConversationKind, type DescribedPlaybackError, 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, type FeatureEntry, 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, Message, MessageAvatar, 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, PhoneInput, type PhoneInputProps, type PlaybackErrorContext, type PlaybackErrorDetail, type PlaybackErrorKind, type PlaybackState, type PlaybackStats, type ProfessionalVerificationStatus, type QualityLevel, SearchCommand, type SearchCommandLabels, type SearchCommandProps, type SearchCommandSelection, type SearchHit, type SupportChatClient, type SupportConversation, type SupportMessage, type SupportMessengerItem, type SupportMessengerLabels, SupportMessengerProvider, type SupportMessengerProviderProps, type SupportMessengerTab, ThemeSwitcher, type ThemeSwitcherLabels, type ThemeSwitcherProps, type UseHlsPlaybackOptions, type UseHlsPlaybackResult, type UsePlaybackStatsOptions, type UseSearchHotkeyOptions, type UseSearchHotkeyResult, type UseSupportConversationOptions, type UseSupportConversationResult, VerifiedProfessionalBadge, type VerifiedProfessionalBadgeProps, VideoPlayer, type VideoPlayerLabels, type VideoPlayerProps, bubbleVariants, cn, createLiveHlsConfig, createSupportChatClient, createVodHlsConfig, defaultLanguages, describePlaybackError, fuzzyMatch, insertAtCaret, markerVariants, normalizeEmojiQuery, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useHlsPlayback, useLanguageContext, usePlaybackStats, useSearchHotkey, useSupportConversation, useSupportMessenger, useSupportMessengerOptional };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React6 from 'react';
|
|
3
|
-
import { createContext, useContext, useState, useCallback, useEffect,
|
|
4
|
-
import { ChevronsUpDown, CheckIcon, Smile, SearchIcon, Search, Clock, Flag, Hash, Lightbulb, Trophy, Plane, Apple, Leaf, Hand, Loader2, AlertTriangle, Inbox, Monitor, Sun, Moon, Building2, Check, Plus, Languages, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw,
|
|
3
|
+
import { createContext, useContext, useState, useRef, useCallback, useEffect, useMemo } from 'react';
|
|
4
|
+
import { ChevronsUpDown, CheckIcon, Smile, SearchIcon, Search, Clock, Flag, Hash, Lightbulb, Trophy, Plane, Apple, Leaf, Hand, Loader2, AlertTriangle, Inbox, X, ChevronLeft, ChevronRight, Monitor, Sun, Moon, Building2, Check, Plus, Languages, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw, User, Pencil, Play, AlertCircle, VolumeX, Pause, Volume1, Volume2, Settings, PictureInPicture2, Minimize, Maximize, BadgeCheck, ArrowDownIcon, MessageCircleDashedIcon, MessageCircle, XIcon } from 'lucide-react';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { cva } from 'class-variance-authority';
|
|
8
8
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
10
10
|
import { Slot } from '@radix-ui/react-slot';
|
|
11
|
+
import { createPortal } from 'react-dom';
|
|
11
12
|
import { useTheme } from 'next-themes';
|
|
12
13
|
import { useReducedMotion, AnimatePresence, motion } from 'framer-motion';
|
|
13
14
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
@@ -424,6 +425,301 @@ function ConfirmDestructiveDialog({
|
|
|
424
425
|
] })
|
|
425
426
|
] }) });
|
|
426
427
|
}
|
|
428
|
+
var MIN_SCALE = 1;
|
|
429
|
+
var MAX_SCALE = 4;
|
|
430
|
+
var DOUBLE_TAP_MS = 300;
|
|
431
|
+
var IDENTITY = { scale: 1, tx: 0, ty: 0 };
|
|
432
|
+
function clamp(value, min, max) {
|
|
433
|
+
return Math.min(max, Math.max(min, value));
|
|
434
|
+
}
|
|
435
|
+
function zoomToward(prev, nextScale, originX, originY) {
|
|
436
|
+
const scale = clamp(nextScale, MIN_SCALE, MAX_SCALE);
|
|
437
|
+
if (scale === MIN_SCALE) return IDENTITY;
|
|
438
|
+
const ratio = scale / prev.scale;
|
|
439
|
+
return {
|
|
440
|
+
scale,
|
|
441
|
+
tx: originX - (originX - prev.tx) * ratio,
|
|
442
|
+
ty: originY - (originY - prev.ty) * ratio
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
function pointerDistance(a, b) {
|
|
446
|
+
return Math.hypot(b.x - a.x, b.y - a.y);
|
|
447
|
+
}
|
|
448
|
+
function ImageLightbox({
|
|
449
|
+
images,
|
|
450
|
+
index,
|
|
451
|
+
onIndexChange,
|
|
452
|
+
onClose,
|
|
453
|
+
labels
|
|
454
|
+
}) {
|
|
455
|
+
const ariaLabel = labels?.ariaLabel ?? "Visor de im\xE1genes";
|
|
456
|
+
const closeLabel = labels?.close ?? "Cerrar";
|
|
457
|
+
const previousLabel = labels?.previous ?? "Anterior";
|
|
458
|
+
const nextLabel = labels?.next ?? "Siguiente";
|
|
459
|
+
const hasMultiple = images.length > 1;
|
|
460
|
+
const [transform, setTransform] = useState(IDENTITY);
|
|
461
|
+
const transformRef = useRef(transform);
|
|
462
|
+
transformRef.current = transform;
|
|
463
|
+
const stageRef = useRef(null);
|
|
464
|
+
const pointersRef = useRef(/* @__PURE__ */ new Map());
|
|
465
|
+
const pinchStartRef = useRef(null);
|
|
466
|
+
const panRef = useRef(null);
|
|
467
|
+
const lastTapRef = useRef(
|
|
468
|
+
null
|
|
469
|
+
);
|
|
470
|
+
const resetZoom = useCallback(() => {
|
|
471
|
+
setTransform(IDENTITY);
|
|
472
|
+
}, []);
|
|
473
|
+
useEffect(() => {
|
|
474
|
+
resetZoom();
|
|
475
|
+
}, [index, images[index], resetZoom]);
|
|
476
|
+
function goPrev() {
|
|
477
|
+
onIndexChange((index - 1 + images.length) % images.length);
|
|
478
|
+
}
|
|
479
|
+
function goNext() {
|
|
480
|
+
onIndexChange((index + 1) % images.length);
|
|
481
|
+
}
|
|
482
|
+
useEffect(() => {
|
|
483
|
+
function handleKeyDown(e) {
|
|
484
|
+
if (e.key === "Escape") {
|
|
485
|
+
onClose();
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
if (!hasMultiple) return;
|
|
489
|
+
if (e.key === "ArrowLeft") {
|
|
490
|
+
onIndexChange((index - 1 + images.length) % images.length);
|
|
491
|
+
} else if (e.key === "ArrowRight") {
|
|
492
|
+
onIndexChange((index + 1) % images.length);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
496
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
497
|
+
}, [index, images.length, hasMultiple, onClose, onIndexChange]);
|
|
498
|
+
useEffect(() => {
|
|
499
|
+
const previousOverflow = document.body.style.overflow;
|
|
500
|
+
document.body.style.overflow = "hidden";
|
|
501
|
+
return () => {
|
|
502
|
+
document.body.style.overflow = previousOverflow;
|
|
503
|
+
};
|
|
504
|
+
}, []);
|
|
505
|
+
const stageOrigin = useCallback((clientX, clientY) => {
|
|
506
|
+
const stage = stageRef.current;
|
|
507
|
+
if (!stage) return { x: 0, y: 0 };
|
|
508
|
+
const rect = stage.getBoundingClientRect();
|
|
509
|
+
return {
|
|
510
|
+
x: clientX - rect.left - rect.width / 2,
|
|
511
|
+
y: clientY - rect.top - rect.height / 2
|
|
512
|
+
};
|
|
513
|
+
}, []);
|
|
514
|
+
useEffect(() => {
|
|
515
|
+
const stage = stageRef.current;
|
|
516
|
+
if (!stage) return;
|
|
517
|
+
const handleWheel = (e) => {
|
|
518
|
+
e.preventDefault();
|
|
519
|
+
e.stopPropagation();
|
|
520
|
+
const prev = transformRef.current;
|
|
521
|
+
const factor = e.deltaY > 0 ? 0.9 : 1.1;
|
|
522
|
+
const { x, y } = stageOrigin(e.clientX, e.clientY);
|
|
523
|
+
setTransform(zoomToward(prev, prev.scale * factor, x, y));
|
|
524
|
+
};
|
|
525
|
+
stage.addEventListener("wheel", handleWheel, { passive: false });
|
|
526
|
+
return () => stage.removeEventListener("wheel", handleWheel);
|
|
527
|
+
}, [stageOrigin]);
|
|
528
|
+
function beginPinch() {
|
|
529
|
+
const pts = [...pointersRef.current.values()];
|
|
530
|
+
const [a, b] = pts;
|
|
531
|
+
if (!a || !b) return;
|
|
532
|
+
const midX = (a.x + b.x) / 2;
|
|
533
|
+
const midY = (a.y + b.y) / 2;
|
|
534
|
+
const { x, y } = stageOrigin(midX, midY);
|
|
535
|
+
pinchStartRef.current = {
|
|
536
|
+
distance: Math.max(pointerDistance(a, b), 1),
|
|
537
|
+
originX: x,
|
|
538
|
+
originY: y,
|
|
539
|
+
transform: { ...transformRef.current }
|
|
540
|
+
};
|
|
541
|
+
panRef.current = null;
|
|
542
|
+
}
|
|
543
|
+
function onPointerDown(e) {
|
|
544
|
+
e.stopPropagation();
|
|
545
|
+
const stage = stageRef.current;
|
|
546
|
+
if (!stage) return;
|
|
547
|
+
stage.setPointerCapture(e.pointerId);
|
|
548
|
+
pointersRef.current.set(e.pointerId, { x: e.clientX, y: e.clientY });
|
|
549
|
+
if (pointersRef.current.size === 2) {
|
|
550
|
+
beginPinch();
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
if (transformRef.current.scale > MIN_SCALE) {
|
|
554
|
+
panRef.current = {
|
|
555
|
+
pointerId: e.pointerId,
|
|
556
|
+
startX: e.clientX,
|
|
557
|
+
startY: e.clientY,
|
|
558
|
+
originTx: transformRef.current.tx,
|
|
559
|
+
originTy: transformRef.current.ty,
|
|
560
|
+
moved: false
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
function onPointerMove(e) {
|
|
565
|
+
if (!pointersRef.current.has(e.pointerId)) return;
|
|
566
|
+
pointersRef.current.set(e.pointerId, { x: e.clientX, y: e.clientY });
|
|
567
|
+
const pinchStart = pinchStartRef.current;
|
|
568
|
+
if (pointersRef.current.size >= 2 && pinchStart) {
|
|
569
|
+
const pts = [...pointersRef.current.values()];
|
|
570
|
+
const [a, b] = pts;
|
|
571
|
+
if (!a || !b) return;
|
|
572
|
+
const distance = Math.max(pointerDistance(a, b), 1);
|
|
573
|
+
const nextScale = pinchStart.transform.scale * (distance / pinchStart.distance);
|
|
574
|
+
setTransform(
|
|
575
|
+
zoomToward(
|
|
576
|
+
pinchStart.transform,
|
|
577
|
+
nextScale,
|
|
578
|
+
pinchStart.originX,
|
|
579
|
+
pinchStart.originY
|
|
580
|
+
)
|
|
581
|
+
);
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
const pan = panRef.current;
|
|
585
|
+
if (pan && pan.pointerId === e.pointerId) {
|
|
586
|
+
const dx = e.clientX - pan.startX;
|
|
587
|
+
const dy = e.clientY - pan.startY;
|
|
588
|
+
if (Math.abs(dx) > 2 || Math.abs(dy) > 2) pan.moved = true;
|
|
589
|
+
setTransform((prev) => ({
|
|
590
|
+
...prev,
|
|
591
|
+
tx: pan.originTx + dx,
|
|
592
|
+
ty: pan.originTy + dy
|
|
593
|
+
}));
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
function onPointerUp(e) {
|
|
597
|
+
const stage = stageRef.current;
|
|
598
|
+
if (stage?.hasPointerCapture(e.pointerId)) {
|
|
599
|
+
stage.releasePointerCapture(e.pointerId);
|
|
600
|
+
}
|
|
601
|
+
pointersRef.current.delete(e.pointerId);
|
|
602
|
+
if (pointersRef.current.size < 2) {
|
|
603
|
+
pinchStartRef.current = null;
|
|
604
|
+
}
|
|
605
|
+
if (pointersRef.current.size === 1) {
|
|
606
|
+
const remaining = [...pointersRef.current.entries()][0];
|
|
607
|
+
if (remaining && transformRef.current.scale > MIN_SCALE) {
|
|
608
|
+
const [pointerId, point] = remaining;
|
|
609
|
+
panRef.current = {
|
|
610
|
+
pointerId,
|
|
611
|
+
startX: point.x,
|
|
612
|
+
startY: point.y,
|
|
613
|
+
originTx: transformRef.current.tx,
|
|
614
|
+
originTy: transformRef.current.ty,
|
|
615
|
+
moved: true
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
const pan = panRef.current;
|
|
620
|
+
if (pan && pan.pointerId === e.pointerId) {
|
|
621
|
+
const wasMoved = pan.moved;
|
|
622
|
+
panRef.current = null;
|
|
623
|
+
if (wasMoved) return;
|
|
624
|
+
}
|
|
625
|
+
if (pointersRef.current.size === 0 && e.button === 0) {
|
|
626
|
+
const now = Date.now();
|
|
627
|
+
const last = lastTapRef.current;
|
|
628
|
+
if (last && now - last.time < DOUBLE_TAP_MS && Math.hypot(e.clientX - last.x, e.clientY - last.y) < 24) {
|
|
629
|
+
lastTapRef.current = null;
|
|
630
|
+
resetZoom();
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
lastTapRef.current = { time: now, x: e.clientX, y: e.clientY };
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
function stopDialogClose(e) {
|
|
637
|
+
e.stopPropagation();
|
|
638
|
+
}
|
|
639
|
+
const { scale, tx, ty } = transform;
|
|
640
|
+
return createPortal(
|
|
641
|
+
/* @__PURE__ */ jsxs(
|
|
642
|
+
"div",
|
|
643
|
+
{
|
|
644
|
+
className: "fixed inset-x-0 top-0 z-50 flex h-dvh items-center justify-center bg-black/90 p-4",
|
|
645
|
+
onClick: onClose,
|
|
646
|
+
role: "dialog",
|
|
647
|
+
"aria-modal": "true",
|
|
648
|
+
"aria-label": ariaLabel,
|
|
649
|
+
children: [
|
|
650
|
+
/* @__PURE__ */ jsx(
|
|
651
|
+
"button",
|
|
652
|
+
{
|
|
653
|
+
type: "button",
|
|
654
|
+
onClick: onClose,
|
|
655
|
+
"aria-label": closeLabel,
|
|
656
|
+
className: "absolute right-4 top-4 z-10 rounded-full bg-black/50 p-2 text-white transition-colors hover:bg-black/70",
|
|
657
|
+
children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" })
|
|
658
|
+
}
|
|
659
|
+
),
|
|
660
|
+
hasMultiple && /* @__PURE__ */ jsx(
|
|
661
|
+
"button",
|
|
662
|
+
{
|
|
663
|
+
type: "button",
|
|
664
|
+
onClick: (e) => {
|
|
665
|
+
e.stopPropagation();
|
|
666
|
+
goPrev();
|
|
667
|
+
},
|
|
668
|
+
"aria-label": previousLabel,
|
|
669
|
+
className: "absolute left-4 top-1/2 z-10 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white transition-colors hover:bg-black/70",
|
|
670
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-6 w-6" })
|
|
671
|
+
}
|
|
672
|
+
),
|
|
673
|
+
/* @__PURE__ */ jsx(
|
|
674
|
+
"div",
|
|
675
|
+
{
|
|
676
|
+
ref: stageRef,
|
|
677
|
+
className: "relative flex max-h-full max-w-full touch-none items-center justify-center",
|
|
678
|
+
"data-scale": scale,
|
|
679
|
+
onClick: stopDialogClose,
|
|
680
|
+
onPointerDown,
|
|
681
|
+
onPointerMove,
|
|
682
|
+
onPointerUp,
|
|
683
|
+
onPointerCancel: onPointerUp,
|
|
684
|
+
children: /* @__PURE__ */ jsx(
|
|
685
|
+
"img",
|
|
686
|
+
{
|
|
687
|
+
src: images[index],
|
|
688
|
+
alt: "",
|
|
689
|
+
draggable: false,
|
|
690
|
+
className: "max-h-[calc(100dvh-2rem)] max-w-full select-none rounded-lg object-contain",
|
|
691
|
+
style: {
|
|
692
|
+
transform: `translate(${tx}px, ${ty}px) scale(${scale})`,
|
|
693
|
+
cursor: scale > MIN_SCALE ? "grab" : "default"
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
)
|
|
697
|
+
}
|
|
698
|
+
),
|
|
699
|
+
hasMultiple && /* @__PURE__ */ jsx(
|
|
700
|
+
"button",
|
|
701
|
+
{
|
|
702
|
+
type: "button",
|
|
703
|
+
onClick: (e) => {
|
|
704
|
+
e.stopPropagation();
|
|
705
|
+
goNext();
|
|
706
|
+
},
|
|
707
|
+
"aria-label": nextLabel,
|
|
708
|
+
className: "absolute right-4 top-1/2 z-10 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white transition-colors hover:bg-black/70",
|
|
709
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-6 w-6" })
|
|
710
|
+
}
|
|
711
|
+
),
|
|
712
|
+
hasMultiple && /* @__PURE__ */ jsxs("div", { className: "absolute bottom-4 left-1/2 z-10 -translate-x-1/2 rounded-full bg-black/50 px-3 py-1 text-xs text-white", children: [
|
|
713
|
+
index + 1,
|
|
714
|
+
" / ",
|
|
715
|
+
images.length
|
|
716
|
+
] })
|
|
717
|
+
]
|
|
718
|
+
}
|
|
719
|
+
),
|
|
720
|
+
document.body
|
|
721
|
+
);
|
|
722
|
+
}
|
|
427
723
|
var miniMenuContentClassName = "max-h-none overflow-x-visible overflow-y-visible";
|
|
428
724
|
var miniMenuContentDefaults = {
|
|
429
725
|
sideOffset: 8,
|
|
@@ -5670,6 +5966,6 @@ function createSupportChatClient(basePath = "/api/chat-svc") {
|
|
|
5670
5966
|
};
|
|
5671
5967
|
}
|
|
5672
5968
|
|
|
5673
|
-
export { AvatarEditor, AvatarEditorDialog, Bubble, BubbleContent, BubbleGroup, BubbleReactions, ChatMessageList, ConfirmDestructiveDialog, EmojiInput, EmojiPicker, EmojiPickerPopover, EmojiTextarea, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, ErrorState, LanguageContext, LanguageSwitcher, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, OrgSwitcher, PhoneInput, SearchCommand, SupportMessengerProvider, ThemeSwitcher, VerifiedProfessionalBadge, VideoPlayer, avatarFallbackStyle, bubbleVariants, cn, createLiveHlsConfig, createSupportChatClient, createVodHlsConfig, defaultLanguages, describePlaybackError, fuzzyMatch, getAvatarColors, getInitials, insertAtCaret, markerVariants, normalizeEmojiQuery, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useHlsPlayback, useLanguageContext, usePlaybackStats, useSearchHotkey, useSupportConversation, useSupportMessenger, useSupportMessengerOptional };
|
|
5969
|
+
export { AvatarEditor, AvatarEditorDialog, Bubble, BubbleContent, BubbleGroup, BubbleReactions, ChatMessageList, ConfirmDestructiveDialog, EmojiInput, EmojiPicker, EmojiPickerPopover, EmojiTextarea, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, ErrorState, ImageLightbox, LanguageContext, LanguageSwitcher, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, OrgSwitcher, PhoneInput, SearchCommand, SupportMessengerProvider, ThemeSwitcher, VerifiedProfessionalBadge, VideoPlayer, avatarFallbackStyle, bubbleVariants, cn, createLiveHlsConfig, createSupportChatClient, createVodHlsConfig, defaultLanguages, describePlaybackError, fuzzyMatch, getAvatarColors, getInitials, insertAtCaret, markerVariants, normalizeEmojiQuery, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useHlsPlayback, useLanguageContext, usePlaybackStats, useSearchHotkey, useSupportConversation, useSupportMessenger, useSupportMessengerOptional };
|
|
5674
5970
|
//# sourceMappingURL=index.js.map
|
|
5675
5971
|
//# sourceMappingURL=index.js.map
|