@patternmode/aperto 0.1.1 → 0.1.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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +340 -196
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +10 -6
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -6,16 +6,15 @@ import {
|
|
|
6
6
|
useCallback as useCallback3,
|
|
7
7
|
useId as useId2,
|
|
8
8
|
useLayoutEffect,
|
|
9
|
-
useMemo as
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
useMemo as useMemo3,
|
|
10
|
+
useReducer,
|
|
11
|
+
useRef
|
|
12
12
|
} from "react";
|
|
13
|
-
import { flushSync } from "react-dom";
|
|
14
13
|
|
|
15
14
|
// src/aperto-content.tsx
|
|
16
15
|
import * as Dialog from "@radix-ui/react-dialog";
|
|
17
16
|
import {
|
|
18
|
-
|
|
17
|
+
m,
|
|
19
18
|
useMotionValue,
|
|
20
19
|
useSpring,
|
|
21
20
|
useTransform
|
|
@@ -211,7 +210,7 @@ var ApertoContent = forwardRef(
|
|
|
211
210
|
]
|
|
212
211
|
);
|
|
213
212
|
return /* @__PURE__ */ jsx(Dialog.Content, { asChild: true, forceMount: true, ...props, children: /* @__PURE__ */ jsx(
|
|
214
|
-
|
|
213
|
+
m.div,
|
|
215
214
|
{
|
|
216
215
|
className,
|
|
217
216
|
"data-slot": "aperto-content",
|
|
@@ -258,7 +257,7 @@ function useApertoGroup() {
|
|
|
258
257
|
|
|
259
258
|
// src/aperto-overlay.tsx
|
|
260
259
|
import * as Dialog3 from "@radix-ui/react-dialog";
|
|
261
|
-
import {
|
|
260
|
+
import { m as m2 } from "motion/react";
|
|
262
261
|
import { forwardRef as forwardRef3 } from "react";
|
|
263
262
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
264
263
|
var OVERLAY_TRANSITION = {
|
|
@@ -274,7 +273,7 @@ var ApertoOverlay = forwardRef3(
|
|
|
274
273
|
const ctx = useApertoContext();
|
|
275
274
|
const transition = ctx.reduceMotion ? OVERLAY_TRANSITION_REDUCED : OVERLAY_TRANSITION;
|
|
276
275
|
return /* @__PURE__ */ jsx3(Dialog3.Overlay, { asChild: true, forceMount: true, children: /* @__PURE__ */ jsx3(
|
|
277
|
-
|
|
276
|
+
m2.div,
|
|
278
277
|
{
|
|
279
278
|
animate: { opacity: fadeOut ? 0 : 1 },
|
|
280
279
|
className,
|
|
@@ -301,10 +300,16 @@ function ApertoPortal({ children, container }) {
|
|
|
301
300
|
|
|
302
301
|
// src/aperto-root.tsx
|
|
303
302
|
import * as Dialog5 from "@radix-ui/react-dialog";
|
|
304
|
-
import {
|
|
303
|
+
import {
|
|
304
|
+
domMax,
|
|
305
|
+
LayoutGroup,
|
|
306
|
+
LazyMotion,
|
|
307
|
+
useReducedMotion
|
|
308
|
+
} from "motion/react";
|
|
305
309
|
import {
|
|
306
310
|
useCallback as useCallback2,
|
|
307
311
|
useId,
|
|
312
|
+
useMemo as useMemo2,
|
|
308
313
|
useState as useState2
|
|
309
314
|
} from "react";
|
|
310
315
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
@@ -338,22 +343,29 @@ function ApertoRoot({
|
|
|
338
343
|
const variants = typeof motionProp === "object" ? motionProp : void 0;
|
|
339
344
|
const presetName = shouldReduce ? "reduced" : globalPresetName;
|
|
340
345
|
const preset = PRESETS[presetName];
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
346
|
+
const contextValue = useMemo2(
|
|
347
|
+
() => ({
|
|
348
|
+
dismissible,
|
|
349
|
+
layoutId,
|
|
350
|
+
onOpenChange,
|
|
351
|
+
open,
|
|
352
|
+
preset,
|
|
353
|
+
presetName,
|
|
354
|
+
reduceMotion: shouldReduce,
|
|
355
|
+
variants
|
|
356
|
+
}),
|
|
357
|
+
[
|
|
358
|
+
dismissible,
|
|
359
|
+
layoutId,
|
|
360
|
+
onOpenChange,
|
|
361
|
+
open,
|
|
362
|
+
preset,
|
|
363
|
+
presetName,
|
|
364
|
+
shouldReduce,
|
|
365
|
+
variants
|
|
366
|
+
]
|
|
356
367
|
);
|
|
368
|
+
return /* @__PURE__ */ jsx5(ApertoContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx5(Dialog5.Root, { onOpenChange, open, ...dialogProps, children: /* @__PURE__ */ jsx5(LazyMotion, { features: domMax, children: /* @__PURE__ */ jsx5(LayoutGroup, { id: layoutId, children }) }) }) });
|
|
357
369
|
}
|
|
358
370
|
|
|
359
371
|
// src/aperto-title.tsx
|
|
@@ -368,32 +380,31 @@ ApertoTitle.displayName = "ApertoTitle";
|
|
|
368
380
|
// src/expanded-media-stage.tsx
|
|
369
381
|
import {
|
|
370
382
|
AnimatePresence as AnimatePresence2,
|
|
371
|
-
|
|
383
|
+
m as m3
|
|
372
384
|
} from "motion/react";
|
|
373
385
|
|
|
374
386
|
// src/media-rendering.tsx
|
|
387
|
+
import { createElement } from "react";
|
|
375
388
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
376
|
-
function getMediaLabel(item) {
|
|
377
|
-
return item.title ?? item.alt ?? "media";
|
|
378
|
-
}
|
|
379
|
-
function getMediaKey(item, index) {
|
|
380
|
-
return item.id ?? `${item.type}:${item.src}:${index}`;
|
|
381
|
-
}
|
|
382
|
-
function getDescriptionProps(item) {
|
|
383
|
-
return item.description ? {} : { "aria-describedby": void 0 };
|
|
384
|
-
}
|
|
385
389
|
function renderDefaultImage(props) {
|
|
386
390
|
const { item: _item, variant: _variant, ...imageProps } = props;
|
|
387
|
-
return
|
|
391
|
+
return createElement("img", { ...imageProps, alt: imageProps.alt ?? "" });
|
|
388
392
|
}
|
|
389
393
|
function renderDefaultVideo(props) {
|
|
390
394
|
const { item: _item, variant, ...videoProps } = props;
|
|
391
395
|
if (variant === "thumbnail") {
|
|
392
|
-
return
|
|
396
|
+
return createElement("img", {
|
|
397
|
+
alt: videoProps["aria-label"] ?? "",
|
|
398
|
+
src: props.item.thumbnailSrc
|
|
399
|
+
});
|
|
393
400
|
}
|
|
394
|
-
return /* @__PURE__ */ jsx7("video", { ...videoProps });
|
|
401
|
+
return /* @__PURE__ */ jsx7("video", { ...videoProps, children: /* @__PURE__ */ jsx7("track", { kind: "captions", src: props.item.captionsSrc ?? "data:text/vtt," }) });
|
|
395
402
|
}
|
|
396
|
-
function
|
|
403
|
+
function ApertoThumbnailMedia({
|
|
404
|
+
item,
|
|
405
|
+
renderImage,
|
|
406
|
+
renderVideo
|
|
407
|
+
}) {
|
|
397
408
|
if (item.type === "image") {
|
|
398
409
|
const imageProps = {
|
|
399
410
|
alt: "",
|
|
@@ -416,7 +427,11 @@ function renderThumbnail(item, renderImage, renderVideo) {
|
|
|
416
427
|
};
|
|
417
428
|
return (renderVideo ?? renderDefaultVideo)(videoProps);
|
|
418
429
|
}
|
|
419
|
-
function
|
|
430
|
+
function ApertoExpandedMedia({
|
|
431
|
+
item,
|
|
432
|
+
renderImage,
|
|
433
|
+
renderVideo
|
|
434
|
+
}) {
|
|
420
435
|
if (item.type === "image") {
|
|
421
436
|
const imageProps = {
|
|
422
437
|
alt: item.alt,
|
|
@@ -440,11 +455,43 @@ function renderExpandedMedia(item, renderImage, renderVideo) {
|
|
|
440
455
|
};
|
|
441
456
|
return (renderVideo ?? renderDefaultVideo)(videoProps);
|
|
442
457
|
}
|
|
443
|
-
function
|
|
458
|
+
function ApertoTransitionMedia({
|
|
459
|
+
item,
|
|
460
|
+
renderImage,
|
|
461
|
+
renderVideo
|
|
462
|
+
}) {
|
|
444
463
|
if (item.type === "image") {
|
|
445
|
-
|
|
464
|
+
const imageProps = {
|
|
465
|
+
alt: item.alt,
|
|
466
|
+
height: item.height,
|
|
467
|
+
item,
|
|
468
|
+
src: item.src,
|
|
469
|
+
variant: "expanded",
|
|
470
|
+
width: item.width
|
|
471
|
+
};
|
|
472
|
+
return (renderImage ?? renderDefaultImage)(imageProps);
|
|
446
473
|
}
|
|
447
|
-
|
|
474
|
+
const videoProps = {
|
|
475
|
+
"aria-label": item.alt ?? item.title ?? "Video",
|
|
476
|
+
height: item.height,
|
|
477
|
+
item,
|
|
478
|
+
poster: item.poster,
|
|
479
|
+
src: item.src,
|
|
480
|
+
variant: "expanded",
|
|
481
|
+
width: item.width
|
|
482
|
+
};
|
|
483
|
+
return (renderVideo ?? renderDefaultVideo)(videoProps);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
// src/media-utils.ts
|
|
487
|
+
function getMediaLabel(item) {
|
|
488
|
+
return item.title ?? item.alt ?? "media";
|
|
489
|
+
}
|
|
490
|
+
function getMediaKey(item, index) {
|
|
491
|
+
return item.id ?? `${item.type}:${item.src}:${index}`;
|
|
492
|
+
}
|
|
493
|
+
function getDescriptionProps(item) {
|
|
494
|
+
return item.description ? {} : { "aria-describedby": void 0 };
|
|
448
495
|
}
|
|
449
496
|
|
|
450
497
|
// src/expanded-media-stage.tsx
|
|
@@ -539,7 +586,7 @@ function ApertoExpandedMediaStage({
|
|
|
539
586
|
scale: preset.scale
|
|
540
587
|
};
|
|
541
588
|
return /* @__PURE__ */ jsx8(AnimatePresence2, { custom: animationCustom, initial: false, mode: "sync", children: /* @__PURE__ */ jsx8(
|
|
542
|
-
|
|
589
|
+
m3.div,
|
|
543
590
|
{
|
|
544
591
|
animate: "center",
|
|
545
592
|
custom: animationCustom,
|
|
@@ -550,18 +597,24 @@ function ApertoExpandedMediaStage({
|
|
|
550
597
|
initial: "enter",
|
|
551
598
|
transition,
|
|
552
599
|
variants,
|
|
553
|
-
children:
|
|
600
|
+
children: /* @__PURE__ */ jsx8(
|
|
601
|
+
ApertoExpandedMedia,
|
|
602
|
+
{
|
|
603
|
+
item,
|
|
604
|
+
renderImage,
|
|
605
|
+
renderVideo
|
|
606
|
+
}
|
|
607
|
+
)
|
|
554
608
|
},
|
|
555
609
|
getMediaKey(item, index)
|
|
556
610
|
) });
|
|
557
611
|
}
|
|
558
612
|
|
|
559
613
|
// src/media-transition.tsx
|
|
560
|
-
import {
|
|
561
|
-
motion as motion4
|
|
562
|
-
} from "motion/react";
|
|
614
|
+
import { m as m4 } from "motion/react";
|
|
563
615
|
import { useEffect } from "react";
|
|
564
|
-
|
|
616
|
+
|
|
617
|
+
// src/media-transition-utils.ts
|
|
565
618
|
function rectFromElement(element) {
|
|
566
619
|
if (!element) {
|
|
567
620
|
return null;
|
|
@@ -585,8 +638,13 @@ function rectTarget(rect) {
|
|
|
585
638
|
function transitionDurationMs(transition) {
|
|
586
639
|
return typeof transition.duration === "number" ? transition.duration * 1e3 : 450;
|
|
587
640
|
}
|
|
641
|
+
|
|
642
|
+
// src/media-transition.tsx
|
|
643
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
588
644
|
function ApertoMediaTransitionClone({
|
|
589
645
|
onComplete,
|
|
646
|
+
renderImage,
|
|
647
|
+
renderVideo,
|
|
590
648
|
transition
|
|
591
649
|
}) {
|
|
592
650
|
const ctx = useApertoContext();
|
|
@@ -604,9 +662,10 @@ function ApertoMediaTransitionClone({
|
|
|
604
662
|
return null;
|
|
605
663
|
}
|
|
606
664
|
return /* @__PURE__ */ jsx9(
|
|
607
|
-
|
|
665
|
+
m4.div,
|
|
608
666
|
{
|
|
609
667
|
animate: rectTarget(transition.to),
|
|
668
|
+
"aria-hidden": "true",
|
|
610
669
|
"data-slot": "aperto-transition-media",
|
|
611
670
|
initial: rectTarget(transition.from),
|
|
612
671
|
style: {
|
|
@@ -614,15 +673,81 @@ function ApertoMediaTransitionClone({
|
|
|
614
673
|
overflow: "hidden",
|
|
615
674
|
pointerEvents: "none",
|
|
616
675
|
position: "fixed",
|
|
617
|
-
|
|
618
|
-
zIndex: 1002
|
|
676
|
+
zIndex: 30
|
|
619
677
|
},
|
|
620
678
|
transition: ctx.preset.transition,
|
|
621
|
-
children:
|
|
679
|
+
children: /* @__PURE__ */ jsx9(
|
|
680
|
+
ApertoTransitionMedia,
|
|
681
|
+
{
|
|
682
|
+
item: transition.item,
|
|
683
|
+
renderImage,
|
|
684
|
+
renderVideo
|
|
685
|
+
}
|
|
686
|
+
)
|
|
622
687
|
}
|
|
623
688
|
);
|
|
624
689
|
}
|
|
625
690
|
|
|
691
|
+
// src/Aperto/ApertoGroupState.ts
|
|
692
|
+
function getInitialGroupState(initialIndex) {
|
|
693
|
+
return {
|
|
694
|
+
closing: false,
|
|
695
|
+
internalIndex: initialIndex,
|
|
696
|
+
layoutSourceIndex: initialIndex,
|
|
697
|
+
mediaTransition: null,
|
|
698
|
+
navigationDirection: 0,
|
|
699
|
+
open: false
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
function apertoGroupReducer(state, action) {
|
|
703
|
+
switch (action.type) {
|
|
704
|
+
case "close-without-transition":
|
|
705
|
+
return { ...state, closing: false, mediaTransition: null, open: false };
|
|
706
|
+
case "complete-opening-target":
|
|
707
|
+
if (state.mediaTransition?.phase !== "opening" || state.mediaTransition.to) {
|
|
708
|
+
return state;
|
|
709
|
+
}
|
|
710
|
+
return {
|
|
711
|
+
...state,
|
|
712
|
+
mediaTransition: { ...state.mediaTransition, to: action.rect }
|
|
713
|
+
};
|
|
714
|
+
case "finish-transition":
|
|
715
|
+
return {
|
|
716
|
+
...state,
|
|
717
|
+
closing: false,
|
|
718
|
+
mediaTransition: null,
|
|
719
|
+
open: state.mediaTransition?.phase === "closing" ? false : state.open
|
|
720
|
+
};
|
|
721
|
+
case "navigate":
|
|
722
|
+
return {
|
|
723
|
+
...state,
|
|
724
|
+
internalIndex: action.index,
|
|
725
|
+
layoutSourceIndex: action.index,
|
|
726
|
+
navigationDirection: action.direction
|
|
727
|
+
};
|
|
728
|
+
case "open-at-index":
|
|
729
|
+
return {
|
|
730
|
+
...state,
|
|
731
|
+
closing: false,
|
|
732
|
+
internalIndex: action.index,
|
|
733
|
+
layoutSourceIndex: action.index,
|
|
734
|
+
mediaTransition: action.transition,
|
|
735
|
+
navigationDirection: 0,
|
|
736
|
+
open: true
|
|
737
|
+
};
|
|
738
|
+
case "set-index":
|
|
739
|
+
return { ...state, internalIndex: action.index };
|
|
740
|
+
case "set-open":
|
|
741
|
+
return action.open ? { ...state, closing: false, open: true } : { ...state, open: false };
|
|
742
|
+
case "start-close":
|
|
743
|
+
return {
|
|
744
|
+
...state,
|
|
745
|
+
closing: true,
|
|
746
|
+
mediaTransition: action.transition
|
|
747
|
+
};
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
|
|
626
751
|
// src/Aperto/ApertoKeyboard.ts
|
|
627
752
|
function shouldIgnoreKeyboardNavigationTarget(target) {
|
|
628
753
|
if (!(target instanceof Element)) {
|
|
@@ -651,33 +776,31 @@ function ApertoGroup({
|
|
|
651
776
|
renderVideo
|
|
652
777
|
}) {
|
|
653
778
|
const generatedId = useId2();
|
|
654
|
-
const [
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
779
|
+
const [state, dispatch] = useReducer(
|
|
780
|
+
apertoGroupReducer,
|
|
781
|
+
initialIndex,
|
|
782
|
+
getInitialGroupState
|
|
783
|
+
);
|
|
659
784
|
const isControlled = controlledIndex !== void 0;
|
|
660
|
-
const index = isControlled ? controlledIndex : internalIndex;
|
|
785
|
+
const index = isControlled ? controlledIndex : state.internalIndex;
|
|
661
786
|
const activeMedia = media[index] ?? media[0];
|
|
662
|
-
const [layoutSourceIndex, setLayoutSourceIndex] = useState3(index);
|
|
663
787
|
const expandedMediaRef = useRef(null);
|
|
664
|
-
const thumbnailRefs = useRef(
|
|
788
|
+
const thumbnailRefs = useRef(null);
|
|
789
|
+
if (thumbnailRefs.current === null) {
|
|
790
|
+
thumbnailRefs.current = /* @__PURE__ */ new Map();
|
|
791
|
+
}
|
|
792
|
+
const thumbnailMap = thumbnailRefs.current;
|
|
665
793
|
const sharedLayoutIdForIndex = useCallback3(
|
|
666
794
|
(nextIndex) => `aperto-group-${generatedId}-${nextIndex}-shared`,
|
|
667
795
|
[generatedId]
|
|
668
796
|
);
|
|
669
|
-
const sharedLayoutId = sharedLayoutIdForIndex(layoutSourceIndex);
|
|
797
|
+
const sharedLayoutId = sharedLayoutIdForIndex(state.layoutSourceIndex);
|
|
670
798
|
const measureOpeningTarget = useCallback3((node) => {
|
|
671
799
|
const targetRect = rectFromElement(node);
|
|
672
800
|
if (!targetRect) {
|
|
673
801
|
return;
|
|
674
802
|
}
|
|
675
|
-
|
|
676
|
-
if (current?.phase !== "opening" || current.to) {
|
|
677
|
-
return current;
|
|
678
|
-
}
|
|
679
|
-
return { ...current, to: targetRect };
|
|
680
|
-
});
|
|
803
|
+
dispatch({ rect: targetRect, type: "complete-opening-target" });
|
|
681
804
|
}, []);
|
|
682
805
|
const setExpandedMediaNode = useCallback3(
|
|
683
806
|
(node) => {
|
|
@@ -691,23 +814,23 @@ function ApertoGroup({
|
|
|
691
814
|
const registerThumbnail = useCallback3(
|
|
692
815
|
(thumbIndex, node) => {
|
|
693
816
|
if (node) {
|
|
694
|
-
|
|
817
|
+
thumbnailMap.set(thumbIndex, node);
|
|
695
818
|
return;
|
|
696
819
|
}
|
|
697
|
-
|
|
820
|
+
thumbnailMap.delete(thumbIndex);
|
|
698
821
|
},
|
|
699
|
-
[]
|
|
822
|
+
[thumbnailMap]
|
|
700
823
|
);
|
|
701
824
|
useLayoutEffect(() => {
|
|
702
|
-
if (mediaTransition?.phase !== "opening" || mediaTransition.to || !expandedMediaRef.current) {
|
|
825
|
+
if (state.mediaTransition?.phase !== "opening" || state.mediaTransition.to || !expandedMediaRef.current) {
|
|
703
826
|
return;
|
|
704
827
|
}
|
|
705
828
|
measureOpeningTarget(expandedMediaRef.current);
|
|
706
|
-
}, [measureOpeningTarget, mediaTransition]);
|
|
829
|
+
}, [measureOpeningTarget, state.mediaTransition]);
|
|
707
830
|
const setIndex = useCallback3(
|
|
708
831
|
(nextIndex) => {
|
|
709
832
|
if (!isControlled) {
|
|
710
|
-
|
|
833
|
+
dispatch({ index: nextIndex, type: "set-index" });
|
|
711
834
|
}
|
|
712
835
|
onIndexChange?.(nextIndex);
|
|
713
836
|
},
|
|
@@ -715,71 +838,60 @@ function ApertoGroup({
|
|
|
715
838
|
);
|
|
716
839
|
const openAtIndex = useCallback3(
|
|
717
840
|
(thumbIndex) => {
|
|
718
|
-
const sourceRect = rectFromElement(
|
|
719
|
-
thumbnailRefs.current.get(thumbIndex) ?? null
|
|
720
|
-
);
|
|
841
|
+
const sourceRect = rectFromElement(thumbnailMap.get(thumbIndex) ?? null);
|
|
721
842
|
const item = media[thumbIndex];
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
sourceRect && item ? { from: sourceRect, item, phase: "opening" } : null
|
|
726
|
-
);
|
|
727
|
-
setNavigationDirection(0);
|
|
728
|
-
setLayoutSourceIndex(thumbIndex);
|
|
729
|
-
setIndex(thumbIndex);
|
|
730
|
-
setOpen(true);
|
|
731
|
-
});
|
|
843
|
+
const transition = sourceRect && item ? { from: sourceRect, item, phase: "opening" } : null;
|
|
844
|
+
dispatch({ index: thumbIndex, transition, type: "open-at-index" });
|
|
845
|
+
onIndexChange?.(thumbIndex);
|
|
732
846
|
},
|
|
733
|
-
[media,
|
|
847
|
+
[media, onIndexChange, thumbnailMap]
|
|
734
848
|
);
|
|
735
849
|
const startClose = useCallback3(() => {
|
|
736
|
-
if (!open || closing) {
|
|
850
|
+
if (!state.open || state.closing) {
|
|
737
851
|
return;
|
|
738
852
|
}
|
|
739
853
|
const sourceRect = rectFromElement(expandedMediaRef.current);
|
|
740
|
-
const targetRect = rectFromElement(
|
|
741
|
-
thumbnailRefs.current.get(index) ?? null
|
|
742
|
-
);
|
|
854
|
+
const targetRect = rectFromElement(thumbnailMap.get(index) ?? null);
|
|
743
855
|
if (!activeMedia || !sourceRect || !targetRect) {
|
|
744
|
-
|
|
745
|
-
setClosing(false);
|
|
746
|
-
setOpen(false);
|
|
856
|
+
dispatch({ type: "close-without-transition" });
|
|
747
857
|
return;
|
|
748
858
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
setMediaTransition({
|
|
859
|
+
dispatch({
|
|
860
|
+
transition: {
|
|
752
861
|
from: sourceRect,
|
|
753
862
|
item: activeMedia,
|
|
754
863
|
phase: "closing",
|
|
755
864
|
to: targetRect
|
|
756
|
-
}
|
|
865
|
+
},
|
|
866
|
+
type: "start-close"
|
|
757
867
|
});
|
|
758
|
-
}, [activeMedia, closing,
|
|
868
|
+
}, [activeMedia, index, state.closing, state.open, thumbnailMap]);
|
|
869
|
+
const handleCloseAutoFocus = useCallback3(
|
|
870
|
+
(event) => {
|
|
871
|
+
event.preventDefault();
|
|
872
|
+
thumbnailMap.get(index)?.focus({ preventScroll: true });
|
|
873
|
+
},
|
|
874
|
+
[index, thumbnailMap]
|
|
875
|
+
);
|
|
759
876
|
const handleMediaTransitionComplete = useCallback3(() => {
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
setClosing(false);
|
|
763
|
-
}
|
|
764
|
-
setMediaTransition(null);
|
|
765
|
-
}, [mediaTransition?.phase]);
|
|
877
|
+
dispatch({ type: "finish-transition" });
|
|
878
|
+
}, []);
|
|
766
879
|
const handleOpenChange = useCallback3(
|
|
767
880
|
(nextOpen) => {
|
|
768
881
|
if (nextOpen) {
|
|
769
|
-
|
|
770
|
-
setOpen(true);
|
|
882
|
+
dispatch({ open: true, type: "set-open" });
|
|
771
883
|
return;
|
|
772
884
|
}
|
|
773
885
|
startClose();
|
|
774
886
|
},
|
|
775
887
|
[startClose]
|
|
776
888
|
);
|
|
777
|
-
const value =
|
|
889
|
+
const value = useMemo3(
|
|
778
890
|
() => ({
|
|
779
891
|
classNames,
|
|
780
892
|
index,
|
|
781
893
|
media,
|
|
782
|
-
open,
|
|
894
|
+
open: state.open,
|
|
783
895
|
openAtIndex,
|
|
784
896
|
registerThumbnail,
|
|
785
897
|
renderImage,
|
|
@@ -792,7 +904,7 @@ function ApertoGroup({
|
|
|
792
904
|
classNames,
|
|
793
905
|
index,
|
|
794
906
|
media,
|
|
795
|
-
open,
|
|
907
|
+
state.open,
|
|
796
908
|
openAtIndex,
|
|
797
909
|
registerThumbnail,
|
|
798
910
|
renderImage,
|
|
@@ -805,11 +917,10 @@ function ApertoGroup({
|
|
|
805
917
|
const hasNavigation = media.length > 1;
|
|
806
918
|
const navigateToIndex = useCallback3(
|
|
807
919
|
(nextIndex, direction) => {
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
setIndex(nextIndex);
|
|
920
|
+
dispatch({ direction, index: nextIndex, type: "navigate" });
|
|
921
|
+
onIndexChange?.(nextIndex);
|
|
811
922
|
},
|
|
812
|
-
[
|
|
923
|
+
[onIndexChange]
|
|
813
924
|
);
|
|
814
925
|
const goToPrevious = useCallback3(() => {
|
|
815
926
|
navigateToIndex((index - 1 + media.length) % media.length, -1);
|
|
@@ -833,77 +944,73 @@ function ApertoGroup({
|
|
|
833
944
|
},
|
|
834
945
|
[goToNext, goToPrevious]
|
|
835
946
|
);
|
|
947
|
+
const expandedMediaStyle = useMemo3(() => {
|
|
948
|
+
if (!activeMedia?.width || !activeMedia.height) {
|
|
949
|
+
return void 0;
|
|
950
|
+
}
|
|
951
|
+
return {
|
|
952
|
+
"--aperto-expanded-aspect-ratio": `${activeMedia.width} / ${activeMedia.height}`,
|
|
953
|
+
"--aperto-expanded-aspect-ratio-height": activeMedia.height,
|
|
954
|
+
"--aperto-expanded-aspect-ratio-width": activeMedia.width
|
|
955
|
+
};
|
|
956
|
+
}, [activeMedia?.height, activeMedia?.width]);
|
|
836
957
|
return /* @__PURE__ */ jsx10(ApertoGroupContext.Provider, { value, children: /* @__PURE__ */ jsxs(
|
|
837
958
|
ApertoRoot,
|
|
838
959
|
{
|
|
839
960
|
dismissible,
|
|
840
961
|
motion: motionProp,
|
|
841
962
|
onOpenChange: handleOpenChange,
|
|
842
|
-
open,
|
|
963
|
+
open: state.open,
|
|
843
964
|
children: [
|
|
844
965
|
children,
|
|
845
966
|
activeMedia ? /* @__PURE__ */ jsxs(ApertoPortal, { children: [
|
|
846
|
-
/* @__PURE__ */ jsx10(
|
|
967
|
+
/* @__PURE__ */ jsx10(
|
|
968
|
+
ApertoOverlay,
|
|
969
|
+
{
|
|
970
|
+
className: classNames?.overlay,
|
|
971
|
+
fadeOut: state.closing
|
|
972
|
+
}
|
|
973
|
+
),
|
|
847
974
|
/* @__PURE__ */ jsxs(
|
|
848
975
|
ApertoContent,
|
|
849
976
|
{
|
|
850
977
|
className: classNames?.content,
|
|
851
|
-
"data-aperto-transition": mediaTransition?.phase,
|
|
978
|
+
"data-aperto-transition": state.mediaTransition?.phase,
|
|
979
|
+
onCloseAutoFocus: handleCloseAutoFocus,
|
|
852
980
|
onKeyDown: hasNavigation ? handleContentKeyDown : void 0,
|
|
853
981
|
sharedLayoutId: false,
|
|
854
982
|
...getDescriptionProps(activeMedia),
|
|
855
983
|
children: [
|
|
856
|
-
/* @__PURE__ */ jsxs(
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
),
|
|
887
|
-
/* @__PURE__ */ jsx10(
|
|
888
|
-
"button",
|
|
889
|
-
{
|
|
890
|
-
"aria-label": "Next media",
|
|
891
|
-
className: classNames?.nextButton,
|
|
892
|
-
"data-slot": "aperto-next-button",
|
|
893
|
-
onClick: goToNext,
|
|
894
|
-
type: "button",
|
|
895
|
-
children: /* @__PURE__ */ jsx10(
|
|
896
|
-
ChevronRight,
|
|
897
|
-
{
|
|
898
|
-
"aria-hidden": "true",
|
|
899
|
-
size: 18,
|
|
900
|
-
strokeWidth: 2
|
|
901
|
-
}
|
|
902
|
-
)
|
|
903
|
-
}
|
|
904
|
-
)
|
|
905
|
-
] }) : null
|
|
906
|
-
] }),
|
|
984
|
+
/* @__PURE__ */ jsxs(
|
|
985
|
+
"div",
|
|
986
|
+
{
|
|
987
|
+
"data-slot": "aperto-media",
|
|
988
|
+
ref: setExpandedMediaNode,
|
|
989
|
+
style: expandedMediaStyle,
|
|
990
|
+
children: [
|
|
991
|
+
/* @__PURE__ */ jsx10(
|
|
992
|
+
ApertoExpandedMediaStage,
|
|
993
|
+
{
|
|
994
|
+
direction: state.navigationDirection,
|
|
995
|
+
index,
|
|
996
|
+
item: activeMedia,
|
|
997
|
+
navigationMotion,
|
|
998
|
+
renderImage,
|
|
999
|
+
renderVideo
|
|
1000
|
+
}
|
|
1001
|
+
),
|
|
1002
|
+
/* @__PURE__ */ jsx10(
|
|
1003
|
+
ApertoMediaNavigationButtons,
|
|
1004
|
+
{
|
|
1005
|
+
classNames,
|
|
1006
|
+
enabled: hasNavigation,
|
|
1007
|
+
onNext: goToNext,
|
|
1008
|
+
onPrevious: goToPrevious
|
|
1009
|
+
}
|
|
1010
|
+
)
|
|
1011
|
+
]
|
|
1012
|
+
}
|
|
1013
|
+
),
|
|
907
1014
|
/* @__PURE__ */ jsx10(ApertoTitle, { children: activeMedia.title ?? getMediaLabel(activeMedia) }),
|
|
908
1015
|
activeMedia.description ? /* @__PURE__ */ jsx10(ApertoDescription, { children: activeMedia.description }) : null,
|
|
909
1016
|
hasNavigation ? /* @__PURE__ */ jsxs("div", { className: classNames?.counter, "data-slot": "aperto-counter", children: [
|
|
@@ -929,7 +1036,9 @@ function ApertoGroup({
|
|
|
929
1036
|
ApertoMediaTransitionClone,
|
|
930
1037
|
{
|
|
931
1038
|
onComplete: handleMediaTransitionComplete,
|
|
932
|
-
|
|
1039
|
+
renderImage,
|
|
1040
|
+
renderVideo,
|
|
1041
|
+
transition: state.mediaTransition
|
|
933
1042
|
}
|
|
934
1043
|
)
|
|
935
1044
|
] }) : null
|
|
@@ -937,6 +1046,40 @@ function ApertoGroup({
|
|
|
937
1046
|
}
|
|
938
1047
|
) });
|
|
939
1048
|
}
|
|
1049
|
+
function ApertoMediaNavigationButtons({
|
|
1050
|
+
classNames,
|
|
1051
|
+
enabled,
|
|
1052
|
+
onNext,
|
|
1053
|
+
onPrevious
|
|
1054
|
+
}) {
|
|
1055
|
+
if (!enabled) {
|
|
1056
|
+
return null;
|
|
1057
|
+
}
|
|
1058
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1059
|
+
/* @__PURE__ */ jsx10(
|
|
1060
|
+
"button",
|
|
1061
|
+
{
|
|
1062
|
+
"aria-label": "Previous media",
|
|
1063
|
+
className: classNames?.previousButton,
|
|
1064
|
+
"data-slot": "aperto-previous-button",
|
|
1065
|
+
onClick: onPrevious,
|
|
1066
|
+
type: "button",
|
|
1067
|
+
children: /* @__PURE__ */ jsx10(ChevronLeft, { "aria-hidden": "true", size: 18, strokeWidth: 2 })
|
|
1068
|
+
}
|
|
1069
|
+
),
|
|
1070
|
+
/* @__PURE__ */ jsx10(
|
|
1071
|
+
"button",
|
|
1072
|
+
{
|
|
1073
|
+
"aria-label": "Next media",
|
|
1074
|
+
className: classNames?.nextButton,
|
|
1075
|
+
"data-slot": "aperto-next-button",
|
|
1076
|
+
onClick: onNext,
|
|
1077
|
+
type: "button",
|
|
1078
|
+
children: /* @__PURE__ */ jsx10(ChevronRight, { "aria-hidden": "true", size: 18, strokeWidth: 2 })
|
|
1079
|
+
}
|
|
1080
|
+
)
|
|
1081
|
+
] });
|
|
1082
|
+
}
|
|
940
1083
|
|
|
941
1084
|
// src/aperto-close.tsx
|
|
942
1085
|
import * as Dialog7 from "@radix-ui/react-dialog";
|
|
@@ -950,34 +1093,15 @@ ApertoClose.displayName = "ApertoClose";
|
|
|
950
1093
|
|
|
951
1094
|
// src/aperto-trigger.tsx
|
|
952
1095
|
import * as Dialog8 from "@radix-ui/react-dialog";
|
|
953
|
-
import {
|
|
954
|
-
import {
|
|
955
|
-
forwardRef as forwardRef6,
|
|
956
|
-
useCallback as useCallback4,
|
|
957
|
-
useEffect as useEffect2,
|
|
958
|
-
useState as useState4
|
|
959
|
-
} from "react";
|
|
1096
|
+
import { m as m5 } from "motion/react";
|
|
1097
|
+
import { forwardRef as forwardRef6 } from "react";
|
|
960
1098
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
961
1099
|
var TRIGGER_OPEN_Z_INDEX = 1e3;
|
|
962
1100
|
var ApertoTrigger = forwardRef6(
|
|
963
1101
|
({ active, children, motion: motionOverride, sharedLayoutId, ...props }, ref) => {
|
|
964
1102
|
const ctx = useApertoContext();
|
|
965
1103
|
const shouldRaise = ctx.open && (active ?? true);
|
|
966
|
-
const
|
|
967
|
-
shouldRaise ? TRIGGER_OPEN_Z_INDEX : 0
|
|
968
|
-
);
|
|
969
|
-
useEffect2(() => {
|
|
970
|
-
if (shouldRaise) {
|
|
971
|
-
setZIndex(TRIGGER_OPEN_Z_INDEX);
|
|
972
|
-
} else if (ctx.open) {
|
|
973
|
-
setZIndex(0);
|
|
974
|
-
}
|
|
975
|
-
}, [ctx.open, shouldRaise]);
|
|
976
|
-
const handleLayoutAnimationComplete = useCallback4(() => {
|
|
977
|
-
if (!shouldRaise) {
|
|
978
|
-
setZIndex(0);
|
|
979
|
-
}
|
|
980
|
-
}, [shouldRaise]);
|
|
1104
|
+
const zIndex = shouldRaise ? TRIGGER_OPEN_Z_INDEX : 0;
|
|
981
1105
|
const resolved = resolvePreset(
|
|
982
1106
|
"trigger",
|
|
983
1107
|
motionOverride,
|
|
@@ -987,14 +1111,13 @@ var ApertoTrigger = forwardRef6(
|
|
|
987
1111
|
);
|
|
988
1112
|
const layoutId = sharedLayoutId === false ? void 0 : sharedLayoutId ?? `${ctx.layoutId}-shared`;
|
|
989
1113
|
return /* @__PURE__ */ jsx12(Dialog8.Trigger, { asChild: true, ref, ...props, children: /* @__PURE__ */ jsx12(
|
|
990
|
-
|
|
1114
|
+
m5.button,
|
|
991
1115
|
{
|
|
992
1116
|
"data-aperto-active": shouldRaise ? "" : void 0,
|
|
993
1117
|
"data-slot": "aperto-trigger",
|
|
994
1118
|
layout: true,
|
|
995
1119
|
layoutCrossfade: false,
|
|
996
1120
|
layoutId,
|
|
997
|
-
onLayoutAnimationComplete: handleLayoutAnimationComplete,
|
|
998
1121
|
style: { zIndex },
|
|
999
1122
|
transition: resolved.transition,
|
|
1000
1123
|
type: "button",
|
|
@@ -1023,7 +1146,14 @@ function ApertoSingle({
|
|
|
1023
1146
|
{
|
|
1024
1147
|
"aria-label": `Open ${label}`,
|
|
1025
1148
|
className: classNames?.thumbnail,
|
|
1026
|
-
children:
|
|
1149
|
+
children: /* @__PURE__ */ jsx13(
|
|
1150
|
+
ApertoThumbnailMedia,
|
|
1151
|
+
{
|
|
1152
|
+
item: media,
|
|
1153
|
+
renderImage,
|
|
1154
|
+
renderVideo
|
|
1155
|
+
}
|
|
1156
|
+
)
|
|
1027
1157
|
}
|
|
1028
1158
|
),
|
|
1029
1159
|
/* @__PURE__ */ jsxs2(ApertoPortal, { children: [
|
|
@@ -1034,7 +1164,14 @@ function ApertoSingle({
|
|
|
1034
1164
|
className: classNames?.content,
|
|
1035
1165
|
...getDescriptionProps(media),
|
|
1036
1166
|
children: [
|
|
1037
|
-
|
|
1167
|
+
/* @__PURE__ */ jsx13(
|
|
1168
|
+
ApertoExpandedMedia,
|
|
1169
|
+
{
|
|
1170
|
+
item: media,
|
|
1171
|
+
renderImage,
|
|
1172
|
+
renderVideo
|
|
1173
|
+
}
|
|
1174
|
+
),
|
|
1038
1175
|
/* @__PURE__ */ jsx13(ApertoTitle, { children: title }),
|
|
1039
1176
|
media.description ? /* @__PURE__ */ jsx13(ApertoDescription, { children: media.description }) : null,
|
|
1040
1177
|
/* @__PURE__ */ jsx13(
|
|
@@ -1073,7 +1210,14 @@ function ApertoThumbnail({
|
|
|
1073
1210
|
onClick: () => group.openAtIndex(index),
|
|
1074
1211
|
ref: (node) => group.registerThumbnail(index, node),
|
|
1075
1212
|
sharedLayoutId: false,
|
|
1076
|
-
children: children ??
|
|
1213
|
+
children: children ?? /* @__PURE__ */ jsx14(
|
|
1214
|
+
ApertoThumbnailMedia,
|
|
1215
|
+
{
|
|
1216
|
+
item: media,
|
|
1217
|
+
renderImage: group.renderImage,
|
|
1218
|
+
renderVideo: group.renderVideo
|
|
1219
|
+
}
|
|
1220
|
+
)
|
|
1077
1221
|
}
|
|
1078
1222
|
);
|
|
1079
1223
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Aperto/ApertoGroup.tsx","../src/aperto-content.tsx","../src/context.ts","../src/physics.ts","../src/motion-tokens.ts","../src/presets.ts","../src/aperto-description.tsx","../src/aperto-group-context.ts","../src/aperto-overlay.tsx","../src/aperto-portal.tsx","../src/aperto-root.tsx","../src/aperto-title.tsx","../src/expanded-media-stage.tsx","../src/media-rendering.tsx","../src/media-transition.tsx","../src/Aperto/ApertoKeyboard.ts","../src/aperto-close.tsx","../src/aperto-trigger.tsx","../src/Aperto/ApertoSingle.tsx","../src/Aperto/ApertoThumbnail.tsx","../src/index.ts"],"sourcesContent":["\"use client\";\n\nimport { ChevronLeft, ChevronRight, X } from \"lucide-react\";\nimport {\n\ttype KeyboardEvent,\n\tuseCallback,\n\tuseId,\n\tuseLayoutEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from \"react\";\nimport { flushSync } from \"react-dom\";\n\nimport { ApertoContent } from \"../aperto-content\";\nimport { ApertoDescription } from \"../aperto-description\";\nimport { ApertoGroupContext } from \"../aperto-group-context\";\nimport { ApertoOverlay } from \"../aperto-overlay\";\nimport { ApertoPortal } from \"../aperto-portal\";\nimport { ApertoRoot } from \"../aperto-root\";\nimport { ApertoTitle } from \"../aperto-title\";\nimport {\n\tApertoExpandedMediaStage,\n\ttype NavigationDirection,\n} from \"../expanded-media-stage\";\nimport { getDescriptionProps, getMediaLabel } from \"../media-rendering\";\nimport {\n\ttype ApertoMediaTransition,\n\tApertoMediaTransitionClone,\n\trectFromElement,\n} from \"../media-transition\";\nimport { shouldIgnoreKeyboardNavigationTarget } from \"./ApertoKeyboard\";\nimport type { ApertoGroupProps } from \"./ApertoTypes\";\n\nexport function ApertoGroup({\n\tchildren,\n\tclassNames,\n\tdismissible,\n\tindex: controlledIndex,\n\tinitialIndex = 0,\n\tmedia,\n\tmotion: motionProp,\n\tnavigationMotion = \"glide\",\n\tonIndexChange,\n\trenderImage,\n\trenderVideo,\n}: ApertoGroupProps) {\n\tconst generatedId = useId();\n\tconst [internalIndex, setInternalIndex] = useState(initialIndex);\n\tconst [open, setOpen] = useState(false);\n\tconst [closing, setClosing] = useState(false);\n\tconst [mediaTransition, setMediaTransition] =\n\t\tuseState<ApertoMediaTransition | null>(null);\n\tconst [navigationDirection, setNavigationDirection] =\n\t\tuseState<NavigationDirection>(0);\n\tconst isControlled = controlledIndex !== undefined;\n\tconst index = isControlled ? controlledIndex : internalIndex;\n\tconst activeMedia = media[index] ?? media[0];\n\tconst [layoutSourceIndex, setLayoutSourceIndex] = useState(index);\n\tconst expandedMediaRef = useRef<HTMLDivElement | null>(null);\n\tconst thumbnailRefs = useRef(new Map<number, HTMLButtonElement>());\n\tconst sharedLayoutIdForIndex = useCallback(\n\t\t(nextIndex: number) => `aperto-group-${generatedId}-${nextIndex}-shared`,\n\t\t[generatedId],\n\t);\n\tconst sharedLayoutId = sharedLayoutIdForIndex(layoutSourceIndex);\n\tconst measureOpeningTarget = useCallback((node: HTMLDivElement) => {\n\t\tconst targetRect = rectFromElement(node);\n\t\tif (!targetRect) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetMediaTransition((current) => {\n\t\t\tif (current?.phase !== \"opening\" || current.to) {\n\t\t\t\treturn current;\n\t\t\t}\n\t\t\treturn { ...current, to: targetRect };\n\t\t});\n\t}, []);\n\tconst setExpandedMediaNode = useCallback(\n\t\t(node: HTMLDivElement | null) => {\n\t\t\texpandedMediaRef.current = node;\n\t\t\tif (node) {\n\t\t\t\tmeasureOpeningTarget(node);\n\t\t\t}\n\t\t},\n\t\t[measureOpeningTarget],\n\t);\n\n\tconst registerThumbnail = useCallback(\n\t\t(thumbIndex: number, node: HTMLButtonElement | null) => {\n\t\t\tif (node) {\n\t\t\t\tthumbnailRefs.current.set(thumbIndex, node);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthumbnailRefs.current.delete(thumbIndex);\n\t\t},\n\t\t[],\n\t);\n\n\tuseLayoutEffect(() => {\n\t\tif (\n\t\t\tmediaTransition?.phase !== \"opening\" ||\n\t\t\tmediaTransition.to ||\n\t\t\t!expandedMediaRef.current\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tmeasureOpeningTarget(expandedMediaRef.current);\n\t}, [measureOpeningTarget, mediaTransition]);\n\n\tconst setIndex = useCallback(\n\t\t(nextIndex: number) => {\n\t\t\tif (!isControlled) {\n\t\t\t\tsetInternalIndex(nextIndex);\n\t\t\t}\n\t\t\tonIndexChange?.(nextIndex);\n\t\t},\n\t\t[isControlled, onIndexChange],\n\t);\n\n\tconst openAtIndex = useCallback(\n\t\t(thumbIndex: number) => {\n\t\t\tconst sourceRect = rectFromElement(\n\t\t\t\tthumbnailRefs.current.get(thumbIndex) ?? null,\n\t\t\t);\n\t\t\tconst item = media[thumbIndex];\n\n\t\t\tflushSync(() => {\n\t\t\t\tsetClosing(false);\n\t\t\t\tsetMediaTransition(\n\t\t\t\t\tsourceRect && item\n\t\t\t\t\t\t? { from: sourceRect, item, phase: \"opening\" }\n\t\t\t\t\t\t: null,\n\t\t\t\t);\n\t\t\t\tsetNavigationDirection(0);\n\t\t\t\tsetLayoutSourceIndex(thumbIndex);\n\t\t\t\tsetIndex(thumbIndex);\n\t\t\t\tsetOpen(true);\n\t\t\t});\n\t\t},\n\t\t[media, setIndex],\n\t);\n\n\tconst startClose = useCallback(() => {\n\t\tif (!open || closing) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst sourceRect = rectFromElement(expandedMediaRef.current);\n\t\tconst targetRect = rectFromElement(\n\t\t\tthumbnailRefs.current.get(index) ?? null,\n\t\t);\n\n\t\tif (!activeMedia || !sourceRect || !targetRect) {\n\t\t\tsetMediaTransition(null);\n\t\t\tsetClosing(false);\n\t\t\tsetOpen(false);\n\t\t\treturn;\n\t\t}\n\n\t\tflushSync(() => {\n\t\t\tsetClosing(true);\n\t\t\tsetMediaTransition({\n\t\t\t\tfrom: sourceRect,\n\t\t\t\titem: activeMedia,\n\t\t\t\tphase: \"closing\",\n\t\t\t\tto: targetRect,\n\t\t\t});\n\t\t});\n\t}, [activeMedia, closing, index, open]);\n\n\tconst handleMediaTransitionComplete = useCallback(() => {\n\t\tif (mediaTransition?.phase === \"closing\") {\n\t\t\tsetOpen(false);\n\t\t\tsetClosing(false);\n\t\t}\n\t\tsetMediaTransition(null);\n\t}, [mediaTransition?.phase]);\n\n\tconst handleOpenChange = useCallback(\n\t\t(nextOpen: boolean) => {\n\t\t\tif (nextOpen) {\n\t\t\t\tsetClosing(false);\n\t\t\t\tsetOpen(true);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tstartClose();\n\t\t},\n\t\t[startClose],\n\t);\n\n\tconst value = useMemo(\n\t\t() => ({\n\t\t\tclassNames,\n\t\t\tindex,\n\t\t\tmedia,\n\t\t\topen,\n\t\t\topenAtIndex,\n\t\t\tregisterThumbnail,\n\t\t\trenderImage,\n\t\t\trenderVideo,\n\t\t\tsetIndex,\n\t\t\tsharedLayoutId,\n\t\t\tsharedLayoutIdForIndex,\n\t\t}),\n\t\t[\n\t\t\tclassNames,\n\t\t\tindex,\n\t\t\tmedia,\n\t\t\topen,\n\t\t\topenAtIndex,\n\t\t\tregisterThumbnail,\n\t\t\trenderImage,\n\t\t\trenderVideo,\n\t\t\tsetIndex,\n\t\t\tsharedLayoutId,\n\t\t\tsharedLayoutIdForIndex,\n\t\t],\n\t);\n\tconst hasNavigation = media.length > 1;\n\tconst navigateToIndex = useCallback(\n\t\t(nextIndex: number, direction: NavigationDirection) => {\n\t\t\tsetNavigationDirection(direction);\n\t\t\tsetLayoutSourceIndex(nextIndex);\n\t\t\tsetIndex(nextIndex);\n\t\t},\n\t\t[setIndex],\n\t);\n\tconst goToPrevious = useCallback(() => {\n\t\tnavigateToIndex((index - 1 + media.length) % media.length, -1);\n\t}, [index, media.length, navigateToIndex]);\n\tconst goToNext = useCallback(() => {\n\t\tnavigateToIndex((index + 1) % media.length, 1);\n\t}, [index, media.length, navigateToIndex]);\n\tconst handleContentKeyDown = useCallback(\n\t\t(event: KeyboardEvent<HTMLDivElement>) => {\n\t\t\tif (\n\t\t\t\tevent.defaultPrevented ||\n\t\t\t\tevent.altKey ||\n\t\t\t\tevent.ctrlKey ||\n\t\t\t\tevent.metaKey ||\n\t\t\t\tshouldIgnoreKeyboardNavigationTarget(event.target)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (event.key === \"ArrowLeft\") {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tgoToPrevious();\n\t\t\t}\n\n\t\t\tif (event.key === \"ArrowRight\") {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tgoToNext();\n\t\t\t}\n\t\t},\n\t\t[goToNext, goToPrevious],\n\t);\n\n\treturn (\n\t\t<ApertoGroupContext.Provider value={value}>\n\t\t\t<ApertoRoot\n\t\t\t\tdismissible={dismissible}\n\t\t\t\tmotion={motionProp}\n\t\t\t\tonOpenChange={handleOpenChange}\n\t\t\t\topen={open}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t{activeMedia ? (\n\t\t\t\t\t<ApertoPortal>\n\t\t\t\t\t\t<ApertoOverlay className={classNames?.overlay} fadeOut={closing} />\n\t\t\t\t\t\t<ApertoContent\n\t\t\t\t\t\t\tclassName={classNames?.content}\n\t\t\t\t\t\t\tdata-aperto-transition={mediaTransition?.phase}\n\t\t\t\t\t\t\tonKeyDown={hasNavigation ? handleContentKeyDown : undefined}\n\t\t\t\t\t\t\tsharedLayoutId={false}\n\t\t\t\t\t\t\t{...getDescriptionProps(activeMedia)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div data-slot=\"aperto-media\" ref={setExpandedMediaNode}>\n\t\t\t\t\t\t\t\t<ApertoExpandedMediaStage\n\t\t\t\t\t\t\t\t\tdirection={navigationDirection}\n\t\t\t\t\t\t\t\t\tindex={index}\n\t\t\t\t\t\t\t\t\titem={activeMedia}\n\t\t\t\t\t\t\t\t\tnavigationMotion={navigationMotion}\n\t\t\t\t\t\t\t\t\trenderImage={renderImage}\n\t\t\t\t\t\t\t\t\trenderVideo={renderVideo}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{hasNavigation ? (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\taria-label=\"Previous media\"\n\t\t\t\t\t\t\t\t\t\t\tclassName={classNames?.previousButton}\n\t\t\t\t\t\t\t\t\t\t\tdata-slot=\"aperto-previous-button\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={goToPrevious}\n\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<ChevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t\tsize={18}\n\t\t\t\t\t\t\t\t\t\t\t\tstrokeWidth={2}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\taria-label=\"Next media\"\n\t\t\t\t\t\t\t\t\t\t\tclassName={classNames?.nextButton}\n\t\t\t\t\t\t\t\t\t\t\tdata-slot=\"aperto-next-button\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={goToNext}\n\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<ChevronRight\n\t\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t\tsize={18}\n\t\t\t\t\t\t\t\t\t\t\t\tstrokeWidth={2}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<ApertoTitle>\n\t\t\t\t\t\t\t\t{activeMedia.title ?? getMediaLabel(activeMedia)}\n\t\t\t\t\t\t\t</ApertoTitle>\n\t\t\t\t\t\t\t{activeMedia.description ? (\n\t\t\t\t\t\t\t\t<ApertoDescription>{activeMedia.description}</ApertoDescription>\n\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t{hasNavigation ? (\n\t\t\t\t\t\t\t\t<div className={classNames?.counter} data-slot=\"aperto-counter\">\n\t\t\t\t\t\t\t\t\t{index + 1} / {media.length}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\taria-label=\"Close\"\n\t\t\t\t\t\t\t\tclassName={classNames?.closeButton}\n\t\t\t\t\t\t\t\tdata-slot=\"aperto-close\"\n\t\t\t\t\t\t\t\tonClick={startClose}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<X aria-hidden=\"true\" size={17} strokeWidth={2} />\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</ApertoContent>\n\t\t\t\t\t\t<ApertoMediaTransitionClone\n\t\t\t\t\t\t\tonComplete={handleMediaTransitionComplete}\n\t\t\t\t\t\t\ttransition={mediaTransition}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ApertoPortal>\n\t\t\t\t) : null}\n\t\t\t</ApertoRoot>\n\t\t</ApertoGroupContext.Provider>\n\t);\n}\n","\"use client\";\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport {\n\ttype MotionStyle,\n\tmotion,\n\ttype PanInfo,\n\tuseMotionValue,\n\tuseSpring,\n\tuseTransform,\n} from \"motion/react\";\nimport {\n\ttype ComponentPropsWithoutRef,\n\tforwardRef,\n\tuseCallback,\n\tuseMemo,\n\tuseState,\n} from \"react\";\n\nimport { useApertoContext } from \"./context\";\nimport {\n\tcalculateResistance,\n\tDEFAULT_DISTANCE_THRESHOLD,\n\tDEFAULT_VELOCITY_THRESHOLD,\n\tOPACITY_INPUT,\n\tOPACITY_OUTPUT,\n\tSCALE_INPUT,\n\tSCALE_OUTPUT,\n} from \"./physics\";\nimport { getDragSpring, resolvePreset } from \"./presets\";\nimport type { DismissibleConfig, MotionPresetName } from \"./types\";\n\nexport interface ApertoContentProps\n\textends Omit<\n\t\tComponentPropsWithoutRef<typeof Dialog.Content>,\n\t\t\"asChild\" | \"forceMount\"\n\t> {\n\t/** Motion preset override for this content panel, independent of the root preset. */\n\tmotion?: MotionPresetName;\n\t/** Built-in positioning strategy. Use \"none\" for custom primitive compositions. */\n\tplacement?: \"center\" | \"none\";\n\t/** Internal shared layout ID override for grouped media. */\n\tsharedLayoutId?: string | false;\n}\n\nconst ApertoContent = forwardRef<HTMLDivElement, ApertoContentProps>(\n\t(\n\t\t{\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tmotion: motionOverride,\n\t\t\tplacement = \"center\",\n\t\t\tsharedLayoutId,\n\t\t\tstyle,\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst ctx = useApertoContext();\n\t\tconst [isDragging, setIsDragging] = useState(false);\n\t\tconst resolved = resolvePreset(\n\t\t\t\"content\",\n\t\t\tmotionOverride,\n\t\t\tctx.presetName,\n\t\t\tctx.variants,\n\t\t\tctx.reduceMotion,\n\t\t);\n\n\t\tconst contentLayoutId =\n\t\t\tsharedLayoutId === false\n\t\t\t\t? undefined\n\t\t\t\t: (sharedLayoutId ?? `${ctx.layoutId}-shared`);\n\n\t\tconst dragSpring = getDragSpring(resolved);\n\t\tconst isDismissible = ctx.dismissible !== false;\n\n\t\tconst dismissConfig: DismissibleConfig =\n\t\t\ttypeof ctx.dismissible === \"object\" ? ctx.dismissible : {};\n\t\tconst distanceThreshold =\n\t\t\tdismissConfig.threshold ?? DEFAULT_DISTANCE_THRESHOLD;\n\t\tconst velocityThreshold =\n\t\t\tdismissConfig.velocity ?? DEFAULT_VELOCITY_THRESHOLD;\n\n\t\tconst dragX = useMotionValue(0);\n\t\tconst dragY = useMotionValue(0);\n\t\tconst springX = useSpring(dragX, dragSpring);\n\t\tconst springY = useSpring(dragY, dragSpring);\n\n\t\tconst distance = useTransform(() =>\n\t\t\tMath.hypot(springX.get(), springY.get()),\n\t\t);\n\t\tconst scaleMotion = useTransform(distance, SCALE_INPUT, SCALE_OUTPUT);\n\t\tconst opacityMotion = useTransform(distance, OPACITY_INPUT, OPACITY_OUTPUT);\n\t\tconst resistance = useTransform(distance, calculateResistance);\n\n\t\tconst handleDrag = useCallback(\n\t\t\t(_event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {\n\t\t\t\tif (!isDragging) {\n\t\t\t\t\tsetIsDragging(true);\n\t\t\t\t}\n\t\t\t\tconst r = resistance.get();\n\t\t\t\tdragX.set(info.offset.x * r);\n\t\t\t\tdragY.set(info.offset.y * r);\n\t\t\t},\n\t\t\t[dragX, dragY, isDragging, resistance],\n\t\t);\n\n\t\tconst handleDragEnd = useCallback(\n\t\t\t(_event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {\n\t\t\t\tsetIsDragging(false);\n\t\t\t\tconst speed = Math.hypot(info.velocity.x, info.velocity.y);\n\t\t\t\tconst dist = Math.hypot(info.offset.x, info.offset.y);\n\n\t\t\t\tif (speed > velocityThreshold || dist > distanceThreshold) {\n\t\t\t\t\tctx.onOpenChange(false);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdragX.set(0);\n\t\t\t\tdragY.set(0);\n\t\t\t},\n\t\t\t[ctx.onOpenChange, distanceThreshold, dragX, dragY, velocityThreshold],\n\t\t);\n\n\t\tconst motionStyle = useMemo(\n\t\t\t(): MotionStyle => ({\n\t\t\t\tcursor: isDragging ? \"grabbing\" : isDismissible ? \"grab\" : undefined,\n\t\t\t\topacity: opacityMotion,\n\t\t\t\tscale: scaleMotion,\n\t\t\t\tx: springX,\n\t\t\t\ty: springY,\n\t\t\t\t...(placement === \"center\"\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tleft: \"50%\",\n\t\t\t\t\t\t\ttop: \"50%\",\n\t\t\t\t\t\t\ttranslate: \"-50% -50%\",\n\t\t\t\t\t\t}\n\t\t\t\t\t: {}),\n\t\t\t\t...style,\n\t\t\t}),\n\t\t\t[\n\t\t\t\tisDismissible,\n\t\t\t\tisDragging,\n\t\t\t\topacityMotion,\n\t\t\t\tplacement,\n\t\t\t\tscaleMotion,\n\t\t\t\tspringX,\n\t\t\t\tspringY,\n\t\t\t\tstyle,\n\t\t\t],\n\t\t);\n\n\t\treturn (\n\t\t\t<Dialog.Content asChild forceMount {...props}>\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName={className}\n\t\t\t\t\tdata-slot=\"aperto-content\"\n\t\t\t\t\tdrag={isDismissible}\n\t\t\t\t\tdragConstraints={{ bottom: 0, left: 0, right: 0, top: 0 }}\n\t\t\t\t\tdragElastic={0}\n\t\t\t\t\tdragMomentum={false}\n\t\t\t\t\tdragSnapToOrigin\n\t\t\t\t\tlayout={contentLayoutId ? true : undefined}\n\t\t\t\t\tlayoutId={contentLayoutId}\n\t\t\t\t\tonDrag={isDismissible ? handleDrag : undefined}\n\t\t\t\t\tonDragEnd={isDismissible ? handleDragEnd : undefined}\n\t\t\t\t\tref={ref}\n\t\t\t\t\tstyle={motionStyle}\n\t\t\t\t\ttransition={resolved.transition}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</motion.div>\n\t\t\t</Dialog.Content>\n\t\t);\n\t},\n);\n\nApertoContent.displayName = \"ApertoContent\";\n\nexport { ApertoContent };\n","\"use client\";\n\nimport { createContext, useContext } from \"react\";\nimport type { ApertoContextValue } from \"./types\";\n\nexport const ApertoContext = createContext<ApertoContextValue | null>(null);\n\nexport function useApertoContext(): ApertoContextValue {\n\tconst ctx = useContext(ApertoContext);\n\tif (!ctx) {\n\t\tthrow new Error(\"Aperto components must be used within <Aperto.Root>\");\n\t}\n\treturn ctx;\n}\n","/**\n * Drag physics utilities.\n *\n * The logarithmic resistance function creates a rubber-band feel:\n * initial movement is free, but gets progressively harder the further\n * you drag. Combined with spring-smoothed motion values, this produces\n * a natural, elastic gesture.\n */\n\nconst RESISTANCE_DIVISOR = 20;\nconst RESISTANCE_SCALE = 4;\nconst RESISTANCE_MIN = 0.1;\n\n/**\n * Logarithmic resistance — decelerates drag progressively.\n * Returns a multiplier between RESISTANCE_MIN and 1.0.\n *\n * At distance 0: returns 1.0 (full movement)\n * At distance 50: returns ~0.77\n * At distance 100: returns ~0.58\n * At distance 200: returns ~0.42\n */\nexport function calculateResistance(distance: number): number {\n\treturn Math.max(\n\t\tRESISTANCE_MIN,\n\t\t1 - Math.log(distance / RESISTANCE_DIVISOR + 1) / RESISTANCE_SCALE,\n\t);\n}\n\n/** Scale mapping: distance → visual scale (1.0 → 0.95) */\nexport const SCALE_INPUT = [0, 50, 100];\nexport const SCALE_OUTPUT = [1, 0.98, 0.95];\n\n/** Opacity mapping: distance → visual opacity (1.0 → 0.96) */\nexport const OPACITY_INPUT = [0, 80];\nexport const OPACITY_OUTPUT = [1, 0.96];\n\n/** Default dismissal thresholds */\nexport const DEFAULT_DISTANCE_THRESHOLD = 100;\nexport const DEFAULT_VELOCITY_THRESHOLD = 500;\n","import type { Easing } from \"motion/react\";\n\nexport const durations = {\n\tsnappy: 0.22,\n\tmoderate: 0.4,\n} as const;\n\nexport const easings = {\n\tcustomGentle: [0.25, 0.1, 0.12, 1],\n\tsnappy: [0.22, 1, 0.36, 1],\n} satisfies Record<string, Easing>;\n\nexport const springs = {\n\tbouncy: { stiffness: 260, damping: 12, mass: 1 },\n\tnatural: { stiffness: 200, damping: 20, mass: 1 },\n\tsnappy: { stiffness: 400, damping: 28, mass: 0.8 },\n\tstiff: { stiffness: 500, damping: 30, mass: 1 },\n} as const;\n","import { durations, easings, springs } from \"./motion-tokens\";\nimport type {\n\tDragSpringConfig,\n\tMotionPreset,\n\tMotionPresetName,\n\tMotionVariants,\n} from \"./types\";\n\n/**\n * Motion presets — each bundles transition timing AND drag physics\n * so \"snappy\" feels snappy everywhere: open, close, and drag.\n *\n * Curves and springs are local copies of the Howells motion tokens so the\n * published package has no private workspace runtime dependencies.\n */\nexport const PRESETS: Record<MotionPresetName, MotionPreset> = {\n\tsnappy: {\n\t\ttransition: { ease: easings.snappy, duration: durations.snappy },\n\t\tdrag: {\n\t\t\tstiffness: springs.stiff.stiffness,\n\t\t\tdamping: springs.stiff.damping,\n\t\t\trestDelta: 0.01,\n\t\t},\n\t},\n\tsmooth: {\n\t\ttransition: { ease: easings.customGentle, duration: durations.moderate },\n\t\tdrag: {\n\t\t\tstiffness: springs.natural.stiffness,\n\t\t\tdamping: springs.natural.damping,\n\t\t\trestDelta: 0.01,\n\t\t},\n\t},\n\tbouncy: {\n\t\ttransition: {\n\t\t\ttype: \"spring\",\n\t\t\tstiffness: springs.bouncy.stiffness,\n\t\t\tdamping: springs.bouncy.damping,\n\t\t\tmass: springs.bouncy.mass,\n\t\t},\n\t\tdrag: {\n\t\t\tstiffness: springs.snappy.stiffness,\n\t\t\tdamping: springs.snappy.damping,\n\t\t\trestDelta: 0.01,\n\t\t},\n\t},\n\treduced: {\n\t\ttransition: { ease: \"linear\", duration: 0.01 },\n\t\tdrag: { stiffness: 1000, damping: 50, restDelta: 0.1 },\n\t},\n};\n\ntype ComponentType = \"trigger\" | \"content\" | \"backdrop\";\n\n/**\n * Three-level motion resolution:\n * 1. Component-level override (highest)\n * 2. Per-component variant from Root\n * 3. Global preset from Root (lowest)\n *\n * If `prefers-reduced-motion` is active, always returns \"reduced\".\n */\nexport function resolvePreset(\n\tcomponentType: ComponentType,\n\tcomponentMotion: MotionPresetName | undefined,\n\tglobalPreset: MotionPresetName,\n\tvariants: MotionVariants | undefined,\n\treduceMotion: boolean,\n): MotionPreset {\n\tif (reduceMotion) {\n\t\treturn PRESETS.reduced;\n\t}\n\n\t// 1. Component-level override\n\tif (componentMotion) {\n\t\treturn PRESETS[componentMotion];\n\t}\n\n\t// 2. Per-component variant\n\tif (variants?.[componentType]) {\n\t\treturn PRESETS[variants[componentType]];\n\t}\n\n\t// 3. Global preset\n\treturn PRESETS[globalPreset];\n}\n\n/** Extract the drag spring config from a preset */\nexport function getDragSpring(preset: MotionPreset): DragSpringConfig {\n\treturn preset.drag;\n}\n","\"use client\";\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport { type ComponentPropsWithoutRef, forwardRef } from \"react\";\n\nconst ApertoDescription = forwardRef<\n\tHTMLParagraphElement,\n\tComponentPropsWithoutRef<typeof Dialog.Description>\n>((props, ref) => {\n\treturn (\n\t\t<Dialog.Description data-slot=\"aperto-description\" ref={ref} {...props} />\n\t);\n});\n\nApertoDescription.displayName = \"ApertoDescription\";\n\nexport { ApertoDescription };\n","import { createContext, useContext } from \"react\";\nimport type {\n\tApertoClassNames,\n\tApertoMediaItem,\n\tRenderImage,\n\tRenderVideo,\n} from \"./types\";\n\nexport interface ApertoGroupContextValue {\n\tclassNames?: ApertoClassNames;\n\tindex: number;\n\tmedia: ApertoMediaItem[];\n\topen: boolean;\n\topenAtIndex: (index: number) => void;\n\tregisterThumbnail: (index: number, node: HTMLButtonElement | null) => void;\n\trenderImage?: RenderImage;\n\trenderVideo?: RenderVideo;\n\tsetIndex: (index: number) => void;\n\tsharedLayoutId: string;\n\tsharedLayoutIdForIndex: (index: number) => string;\n}\n\nexport const ApertoGroupContext = createContext<ApertoGroupContextValue | null>(\n\tnull,\n);\n\nexport function useApertoGroup(): ApertoGroupContextValue {\n\tconst ctx = useContext(ApertoGroupContext);\n\tif (!ctx) {\n\t\tthrow new Error(\"Aperto.Thumbnail must be used within <Aperto.Group>\");\n\t}\n\treturn ctx;\n}\n","\"use client\";\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport { motion, type Transition } from \"motion/react\";\nimport { forwardRef } from \"react\";\n\nimport { useApertoContext } from \"./context\";\nimport { easings } from \"./motion-tokens\";\n\nexport interface ApertoOverlayProps {\n\tclassName?: string;\n\t/** Internal flag used to fade the overlay during measured close transitions. */\n\tfadeOut?: boolean;\n\tstyle?: React.CSSProperties;\n}\n\n/** Overlay always fades gently regardless of the content's motion preset. */\nconst OVERLAY_TRANSITION: Transition = {\n\tduration: 0.3,\n\tease: easings.customGentle,\n};\n\nconst OVERLAY_TRANSITION_REDUCED: Transition = {\n\tduration: 0.01,\n\tease: \"linear\",\n};\n\nconst ApertoOverlay = forwardRef<HTMLDivElement, ApertoOverlayProps>(\n\t({ className, fadeOut, style }, ref) => {\n\t\tconst ctx = useApertoContext();\n\t\tconst transition = ctx.reduceMotion\n\t\t\t? OVERLAY_TRANSITION_REDUCED\n\t\t\t: OVERLAY_TRANSITION;\n\n\t\treturn (\n\t\t\t<Dialog.Overlay asChild forceMount>\n\t\t\t\t<motion.div\n\t\t\t\t\tanimate={{ opacity: fadeOut ? 0 : 1 }}\n\t\t\t\t\tclassName={className}\n\t\t\t\t\tdata-slot=\"aperto-overlay\"\n\t\t\t\t\texit={{ opacity: 0 }}\n\t\t\t\t\tinitial={{ opacity: 0 }}\n\t\t\t\t\tref={ref}\n\t\t\t\t\tstyle={style}\n\t\t\t\t\ttransition={transition}\n\t\t\t\t/>\n\t\t\t</Dialog.Overlay>\n\t\t);\n\t},\n);\n\nApertoOverlay.displayName = \"ApertoOverlay\";\n\nexport { ApertoOverlay };\n","\"use client\";\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport { AnimatePresence } from \"motion/react\";\nimport type { ReactNode } from \"react\";\n\nimport { useApertoContext } from \"./context\";\n\nexport interface ApertoPortalProps {\n\tchildren: ReactNode;\n\t/** Container element for the portal (default: document.body) */\n\tcontainer?: HTMLElement;\n}\n\nfunction ApertoPortal({ children, container }: ApertoPortalProps) {\n\tconst { open } = useApertoContext();\n\n\treturn (\n\t\t<AnimatePresence>\n\t\t\t{open && (\n\t\t\t\t<Dialog.Portal container={container} forceMount>\n\t\t\t\t\t{children}\n\t\t\t\t</Dialog.Portal>\n\t\t\t)}\n\t\t</AnimatePresence>\n\t);\n}\n\nexport { ApertoPortal };\n","\"use client\";\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport { LayoutGroup, useReducedMotion } from \"motion/react\";\nimport {\n\ttype ComponentPropsWithoutRef,\n\ttype ReactNode,\n\tuseCallback,\n\tuseId,\n\tuseState,\n} from \"react\";\n\nimport { ApertoContext } from \"./context\";\nimport { PRESETS } from \"./presets\";\nimport type {\n\tDismissibleConfig,\n\tMotionPresetName,\n\tMotionVariants,\n} from \"./types\";\n\nexport interface ApertoRootProps\n\textends Omit<\n\t\tComponentPropsWithoutRef<typeof Dialog.Root>,\n\t\t\"open\" | \"onOpenChange\"\n\t> {\n\tchildren: ReactNode;\n\t/** Whether dragging can dismiss the content (default: true) */\n\tdismissible?: boolean | DismissibleConfig;\n\t/** Layout ID for shared element transition (auto-generated if omitted) */\n\tlayoutId?: string;\n\t/** Motion preset or per-component variants */\n\tmotion?: MotionPresetName | MotionVariants;\n\t/** Controlled open state */\n\topen?: boolean;\n\t/** Callback when open state changes */\n\tonOpenChange?: (open: boolean) => void;\n\t/** Force reduced motion regardless of system preference */\n\treduceMotion?: boolean;\n}\n\nfunction ApertoRoot({\n\tchildren,\n\tdismissible = true,\n\tlayoutId: layoutIdProp,\n\tmotion: motionProp = \"smooth\",\n\topen: controlledOpen,\n\tonOpenChange: controlledOnOpenChange,\n\treduceMotion: reduceMotionProp,\n\t...dialogProps\n}: ApertoRootProps) {\n\tconst generatedId = useId();\n\tconst layoutId = layoutIdProp ?? `aperto-${generatedId}`;\n\tconst systemReducedMotion = useReducedMotion() ?? false;\n\tconst shouldReduce = reduceMotionProp ?? systemReducedMotion;\n\n\t// Uncontrolled state fallback\n\tconst [internalOpen, setInternalOpen] = useState(false);\n\tconst isControlled = controlledOpen !== undefined;\n\tconst open = isControlled ? controlledOpen : internalOpen;\n\n\tconst onOpenChange = useCallback(\n\t\t(nextOpen: boolean) => {\n\t\t\tif (!isControlled) {\n\t\t\t\tsetInternalOpen(nextOpen);\n\t\t\t}\n\t\t\tcontrolledOnOpenChange?.(nextOpen);\n\t\t},\n\t\t[isControlled, controlledOnOpenChange],\n\t);\n\n\t// Resolve global preset name\n\tconst globalPresetName: MotionPresetName =\n\t\ttypeof motionProp === \"string\" ? motionProp : \"smooth\";\n\tconst variants: MotionVariants | undefined =\n\t\ttypeof motionProp === \"object\" ? motionProp : undefined;\n\n\tconst presetName: MotionPresetName = shouldReduce\n\t\t? \"reduced\"\n\t\t: globalPresetName;\n\tconst preset = PRESETS[presetName];\n\n\treturn (\n\t\t<ApertoContext.Provider\n\t\t\tvalue={{\n\t\t\t\tdismissible,\n\t\t\t\tlayoutId,\n\t\t\t\tonOpenChange,\n\t\t\t\topen,\n\t\t\t\tpreset,\n\t\t\t\tpresetName,\n\t\t\t\treduceMotion: shouldReduce,\n\t\t\t\tvariants,\n\t\t\t}}\n\t\t>\n\t\t\t<Dialog.Root onOpenChange={onOpenChange} open={open} {...dialogProps}>\n\t\t\t\t<LayoutGroup id={layoutId}>{children}</LayoutGroup>\n\t\t\t</Dialog.Root>\n\t\t</ApertoContext.Provider>\n\t);\n}\n\nexport { ApertoRoot };\n","\"use client\";\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport { type ComponentPropsWithoutRef, forwardRef } from \"react\";\n\nconst ApertoTitle = forwardRef<\n\tHTMLHeadingElement,\n\tComponentPropsWithoutRef<typeof Dialog.Title>\n>((props, ref) => {\n\treturn <Dialog.Title data-slot=\"aperto-title\" ref={ref} {...props} />;\n});\n\nApertoTitle.displayName = \"ApertoTitle\";\n\nexport { ApertoTitle };\n","import {\n\tAnimatePresence,\n\tmotion,\n\ttype TargetAndTransition,\n\ttype Transition,\n} from \"motion/react\";\nimport { useApertoContext } from \"./context\";\nimport { getMediaKey, renderExpandedMedia } from \"./media-rendering\";\nimport type {\n\tApertoMediaItem,\n\tNavigationMotionPresetName,\n\tRenderImage,\n\tRenderVideo,\n} from \"./types\";\n\nexport type NavigationDirection = -1 | 0 | 1;\n\ninterface NavigationMotionPreset {\n\toffset: number;\n\tscale: number;\n\ttransition: Transition;\n}\n\ninterface NavigationAnimationCustom {\n\tdirection: NavigationDirection;\n\toffset: number;\n\tscale: number;\n}\n\nconst NAVIGATION_MOTION_PRESETS: Record<\n\tNavigationMotionPresetName,\n\tNavigationMotionPreset\n> = {\n\tfloat: {\n\t\toffset: 96,\n\t\tscale: 0.97,\n\t\ttransition: {\n\t\t\topacity: { duration: 0.34, ease: [0.45, 0, 0.2, 1] },\n\t\t\tscale: { damping: 26, mass: 1.15, stiffness: 80, type: \"spring\" },\n\t\t\tx: { damping: 26, mass: 1.15, stiffness: 80, type: \"spring\" },\n\t\t},\n\t},\n\tglide: {\n\t\toffset: 58,\n\t\tscale: 0.984,\n\t\ttransition: {\n\t\t\topacity: { duration: 0.24, ease: [0.4, 0, 0.2, 1] },\n\t\t\tscale: { damping: 28, mass: 0.95, stiffness: 150, type: \"spring\" },\n\t\t\tx: { damping: 28, mass: 0.95, stiffness: 150, type: \"spring\" },\n\t\t},\n\t},\n\tsnap: {\n\t\toffset: 38,\n\t\tscale: 0.996,\n\t\ttransition: {\n\t\t\topacity: { duration: 0.12, ease: [0.2, 0, 0, 1] },\n\t\t\tscale: { damping: 34, mass: 0.7, stiffness: 420, type: \"spring\" },\n\t\t\tx: { damping: 34, mass: 0.7, stiffness: 420, type: \"spring\" },\n\t\t},\n\t},\n};\n\nconst REDUCED_EXPANDED_MEDIA_TRANSITION: Transition = {\n\tduration: 0.12,\n\tease: \"linear\",\n};\n\nconst expandedMediaVariants = {\n\tcenter: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\tx: 0,\n\t},\n\tenter: ({\n\t\tdirection,\n\t\toffset,\n\t\tscale,\n\t}: NavigationAnimationCustom): TargetAndTransition => ({\n\t\topacity: 0,\n\t\tscale: direction === 0 ? 1 : scale,\n\t\tx: direction * offset,\n\t}),\n\texit: ({\n\t\tdirection,\n\t\toffset,\n\t\tscale,\n\t}: NavigationAnimationCustom): TargetAndTransition => ({\n\t\topacity: 0,\n\t\tscale: direction === 0 ? 1 : scale,\n\t\tx: direction * -offset,\n\t}),\n};\n\nconst reducedExpandedMediaVariants = {\n\tcenter: {\n\t\topacity: 1,\n\t\tx: 0,\n\t},\n\tenter: {\n\t\topacity: 0,\n\t\tx: 0,\n\t},\n\texit: {\n\t\topacity: 0,\n\t\tx: 0,\n\t},\n};\n\nexport function ApertoExpandedMediaStage({\n\tdirection,\n\tindex,\n\titem,\n\tnavigationMotion,\n\trenderImage,\n\trenderVideo,\n}: {\n\tdirection: NavigationDirection;\n\tindex: number;\n\titem: ApertoMediaItem;\n\tnavigationMotion: NavigationMotionPresetName;\n\trenderImage?: RenderImage;\n\trenderVideo?: RenderVideo;\n}) {\n\tconst ctx = useApertoContext();\n\tconst preset = NAVIGATION_MOTION_PRESETS[navigationMotion];\n\tconst transition = ctx.reduceMotion\n\t\t? REDUCED_EXPANDED_MEDIA_TRANSITION\n\t\t: preset.transition;\n\tconst variants = ctx.reduceMotion\n\t\t? reducedExpandedMediaVariants\n\t\t: expandedMediaVariants;\n\tconst animationCustom: NavigationAnimationCustom = {\n\t\tdirection,\n\t\toffset: preset.offset,\n\t\tscale: preset.scale,\n\t};\n\n\treturn (\n\t\t<AnimatePresence custom={animationCustom} initial={false} mode=\"sync\">\n\t\t\t<motion.div\n\t\t\t\tanimate=\"center\"\n\t\t\t\tcustom={animationCustom}\n\t\t\t\tdata-navigation-direction={direction}\n\t\t\t\tdata-navigation-motion={navigationMotion}\n\t\t\t\tdata-slot=\"aperto-media-stage\"\n\t\t\t\texit=\"exit\"\n\t\t\t\tinitial=\"enter\"\n\t\t\t\tkey={getMediaKey(item, index)}\n\t\t\t\ttransition={transition}\n\t\t\t\tvariants={variants}\n\t\t\t>\n\t\t\t\t{renderExpandedMedia(item, renderImage, renderVideo)}\n\t\t\t</motion.div>\n\t\t</AnimatePresence>\n\t);\n}\n","import type { ReactNode } from \"react\";\nimport type { ApertoMediaItem, RenderImage, RenderVideo } from \"./types\";\n\nexport function getMediaLabel(item: ApertoMediaItem): string {\n\treturn item.title ?? item.alt ?? \"media\";\n}\n\nexport function getMediaKey(item: ApertoMediaItem, index: number): string {\n\treturn item.id ?? `${item.type}:${item.src}:${index}`;\n}\n\nexport function getDescriptionProps(item: ApertoMediaItem): {\n\t\"aria-describedby\"?: undefined;\n} {\n\treturn item.description ? {} : { \"aria-describedby\": undefined };\n}\n\nfunction renderDefaultImage(props: Parameters<RenderImage>[0]): ReactNode {\n\tconst { item: _item, variant: _variant, ...imageProps } = props;\n\treturn <img {...imageProps} alt={imageProps.alt ?? \"\"} />;\n}\n\nfunction renderDefaultVideo(props: Parameters<RenderVideo>[0]): ReactNode {\n\tconst { item: _item, variant, ...videoProps } = props;\n\tif (variant === \"thumbnail\") {\n\t\treturn (\n\t\t\t<img alt={videoProps[\"aria-label\"] ?? \"\"} src={props.item.thumbnailSrc} />\n\t\t);\n\t}\n\treturn <video {...videoProps} />;\n}\n\nexport function renderThumbnail(\n\titem: ApertoMediaItem,\n\trenderImage?: RenderImage,\n\trenderVideo?: RenderVideo,\n): ReactNode {\n\tif (item.type === \"image\") {\n\t\tconst imageProps: Parameters<RenderImage>[0] = {\n\t\t\talt: \"\",\n\t\t\theight: item.height,\n\t\t\titem,\n\t\t\tsrc: item.thumbnailSrc ?? item.src,\n\t\t\tvariant: \"thumbnail\",\n\t\t\twidth: item.width,\n\t\t};\n\t\treturn (renderImage ?? renderDefaultImage)(imageProps);\n\t}\n\n\tconst videoProps: Parameters<RenderVideo>[0] = {\n\t\t\"aria-label\": item.alt ?? item.title ?? \"Video thumbnail\",\n\t\theight: item.height,\n\t\titem,\n\t\tposter: item.poster,\n\t\tsrc: item.thumbnailSrc,\n\t\tvariant: \"thumbnail\",\n\t\twidth: item.width,\n\t};\n\treturn (renderVideo ?? renderDefaultVideo)(videoProps);\n}\n\nexport function renderExpandedMedia(\n\titem: ApertoMediaItem,\n\trenderImage?: RenderImage,\n\trenderVideo?: RenderVideo,\n): ReactNode {\n\tif (item.type === \"image\") {\n\t\tconst imageProps: Parameters<RenderImage>[0] = {\n\t\t\talt: item.alt,\n\t\t\theight: item.height,\n\t\t\titem,\n\t\t\tsrc: item.src,\n\t\t\tvariant: \"expanded\",\n\t\t\twidth: item.width,\n\t\t};\n\t\treturn (renderImage ?? renderDefaultImage)(imageProps);\n\t}\n\n\tconst videoProps: Parameters<RenderVideo>[0] = {\n\t\t\"aria-label\": item.alt ?? item.title ?? \"Video\",\n\t\tcontrols: true,\n\t\theight: item.height,\n\t\titem,\n\t\tposter: item.poster,\n\t\tsrc: item.src,\n\t\tvariant: \"expanded\",\n\t\twidth: item.width,\n\t};\n\treturn (renderVideo ?? renderDefaultVideo)(videoProps);\n}\n\nexport function renderTransitionMedia(item: ApertoMediaItem): ReactNode {\n\tif (item.type === \"image\") {\n\t\treturn <img alt=\"\" src={item.src} />;\n\t}\n\n\treturn <img alt=\"\" src={item.poster ?? item.thumbnailSrc} />;\n}\n","import {\n\tmotion,\n\ttype TargetAndTransition,\n\ttype Transition,\n} from \"motion/react\";\nimport { useEffect } from \"react\";\nimport { useApertoContext } from \"./context\";\nimport { renderTransitionMedia } from \"./media-rendering\";\nimport type { ApertoMediaItem } from \"./types\";\n\nexport interface ApertoRect {\n\theight: number;\n\tleft: number;\n\ttop: number;\n\twidth: number;\n}\n\nexport interface ApertoMediaTransition {\n\tfrom: ApertoRect;\n\titem: ApertoMediaItem;\n\tphase: \"opening\" | \"closing\";\n\tto?: ApertoRect;\n}\n\nexport function rectFromElement(element: Element | null): ApertoRect | null {\n\tif (!element) {\n\t\treturn null;\n\t}\n\n\tconst rect = element.getBoundingClientRect();\n\treturn {\n\t\theight: rect.height,\n\t\tleft: rect.left,\n\t\ttop: rect.top,\n\t\twidth: rect.width,\n\t};\n}\n\nfunction rectTarget(rect: ApertoRect): TargetAndTransition {\n\treturn {\n\t\theight: rect.height,\n\t\tleft: rect.left,\n\t\ttop: rect.top,\n\t\twidth: rect.width,\n\t};\n}\n\nfunction transitionDurationMs(transition: Transition): number {\n\treturn typeof transition.duration === \"number\"\n\t\t? transition.duration * 1000\n\t\t: 450;\n}\n\nexport function ApertoMediaTransitionClone({\n\tonComplete,\n\ttransition,\n}: {\n\tonComplete: () => void;\n\ttransition: ApertoMediaTransition | null;\n}) {\n\tconst ctx = useApertoContext();\n\n\tuseEffect(() => {\n\t\tif (!transition?.to) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst timer = setTimeout(\n\t\t\tonComplete,\n\t\t\ttransitionDurationMs(ctx.preset.transition),\n\t\t);\n\t\treturn () => clearTimeout(timer);\n\t}, [ctx.preset.transition, onComplete, transition]);\n\n\tif (!transition?.to) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<motion.div\n\t\t\tanimate={rectTarget(transition.to)}\n\t\t\tdata-slot=\"aperto-transition-media\"\n\t\t\tinitial={rectTarget(transition.from)}\n\t\t\tstyle={{\n\t\t\t\tborderRadius: \"var(--aperto-radius, 0.5rem)\",\n\t\t\t\toverflow: \"hidden\",\n\t\t\t\tpointerEvents: \"none\",\n\t\t\t\tposition: \"fixed\",\n\t\t\t\twillChange: \"left, top, width, height\",\n\t\t\t\tzIndex: 1002,\n\t\t\t}}\n\t\t\ttransition={ctx.preset.transition}\n\t\t>\n\t\t\t{renderTransitionMedia(transition.item)}\n\t\t</motion.div>\n\t);\n}\n","export function shouldIgnoreKeyboardNavigationTarget(\n\ttarget: EventTarget | null,\n): boolean {\n\tif (!(target instanceof Element)) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\t(target as HTMLElement).isContentEditable ||\n\t\tBoolean(\n\t\t\ttarget.closest(\n\t\t\t\t'input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"textbox\"], audio, video',\n\t\t\t),\n\t\t)\n\t);\n}\n","\"use client\";\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport { X } from \"lucide-react\";\nimport { type ComponentPropsWithoutRef, forwardRef } from \"react\";\n\nconst ApertoClose = forwardRef<\n\tHTMLButtonElement,\n\tComponentPropsWithoutRef<typeof Dialog.Close>\n>(({ children, ...props }, ref) => {\n\treturn (\n\t\t<Dialog.Close data-slot=\"aperto-close\" ref={ref} {...props}>\n\t\t\t{children ?? <X aria-hidden=\"true\" size={17} strokeWidth={2} />}\n\t\t</Dialog.Close>\n\t);\n});\n\nApertoClose.displayName = \"ApertoClose\";\n\nexport { ApertoClose };\n","\"use client\";\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport { motion } from \"motion/react\";\nimport {\n\ttype ComponentPropsWithoutRef,\n\tforwardRef,\n\tuseCallback,\n\tuseEffect,\n\tuseState,\n} from \"react\";\n\nimport { useApertoContext } from \"./context\";\nimport { resolvePreset } from \"./presets\";\nimport type { MotionPresetName } from \"./types\";\n\nconst TRIGGER_OPEN_Z_INDEX = 1000;\n\nexport interface ApertoTriggerProps\n\textends ComponentPropsWithoutRef<typeof Dialog.Trigger> {\n\t/** Internal flag used by grouped thumbnails to raise only the active trigger. */\n\tactive?: boolean;\n\t/** Override motion preset for this trigger */\n\tmotion?: MotionPresetName;\n\t/** Internal shared layout ID override for grouped thumbnails. */\n\tsharedLayoutId?: string | false;\n}\n\nconst ApertoTrigger = forwardRef<HTMLButtonElement, ApertoTriggerProps>(\n\t(\n\t\t{ active, children, motion: motionOverride, sharedLayoutId, ...props },\n\t\tref,\n\t) => {\n\t\tconst ctx = useApertoContext();\n\t\tconst shouldRaise = ctx.open && (active ?? true);\n\t\tconst [zIndex, setZIndex] = useState(\n\t\t\tshouldRaise ? TRIGGER_OPEN_Z_INDEX : 0,\n\t\t);\n\n\t\tuseEffect(() => {\n\t\t\tif (shouldRaise) {\n\t\t\t\tsetZIndex(TRIGGER_OPEN_Z_INDEX);\n\t\t\t} else if (ctx.open) {\n\t\t\t\tsetZIndex(0);\n\t\t\t}\n\t\t}, [ctx.open, shouldRaise]);\n\n\t\tconst handleLayoutAnimationComplete = useCallback(() => {\n\t\t\tif (!shouldRaise) {\n\t\t\t\tsetZIndex(0);\n\t\t\t}\n\t\t}, [shouldRaise]);\n\n\t\tconst resolved = resolvePreset(\n\t\t\t\"trigger\",\n\t\t\tmotionOverride,\n\t\t\tctx.presetName,\n\t\t\tctx.variants,\n\t\t\tctx.reduceMotion,\n\t\t);\n\t\tconst layoutId =\n\t\t\tsharedLayoutId === false\n\t\t\t\t? undefined\n\t\t\t\t: (sharedLayoutId ?? `${ctx.layoutId}-shared`);\n\n\t\treturn (\n\t\t\t<Dialog.Trigger asChild ref={ref} {...props}>\n\t\t\t\t<motion.button\n\t\t\t\t\tdata-aperto-active={shouldRaise ? \"\" : undefined}\n\t\t\t\t\tdata-slot=\"aperto-trigger\"\n\t\t\t\t\tkey={layoutId ?? \"unshared\"}\n\t\t\t\t\tlayout\n\t\t\t\t\tlayoutCrossfade={false}\n\t\t\t\t\tlayoutId={layoutId}\n\t\t\t\t\tonLayoutAnimationComplete={handleLayoutAnimationComplete}\n\t\t\t\t\tstyle={{ zIndex }}\n\t\t\t\t\ttransition={resolved.transition}\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</motion.button>\n\t\t\t</Dialog.Trigger>\n\t\t);\n\t},\n);\n\nApertoTrigger.displayName = \"ApertoTrigger\";\n\nexport { ApertoTrigger };\n","\"use client\";\n\nimport { ApertoClose } from \"../aperto-close\";\nimport { ApertoContent } from \"../aperto-content\";\nimport { ApertoDescription } from \"../aperto-description\";\nimport { ApertoOverlay } from \"../aperto-overlay\";\nimport { ApertoPortal } from \"../aperto-portal\";\nimport { ApertoRoot } from \"../aperto-root\";\nimport { ApertoTitle } from \"../aperto-title\";\nimport { ApertoTrigger } from \"../aperto-trigger\";\nimport {\n\tgetDescriptionProps,\n\tgetMediaLabel,\n\trenderExpandedMedia,\n\trenderThumbnail,\n} from \"../media-rendering\";\nimport type { ApertoProps } from \"./ApertoTypes\";\n\nexport function ApertoSingle({\n\tclassNames,\n\tdismissible,\n\tmedia,\n\trenderImage,\n\trenderVideo,\n}: ApertoProps) {\n\tconst label = getMediaLabel(media);\n\tconst title = media.title ?? label;\n\n\treturn (\n\t\t<ApertoRoot dismissible={dismissible}>\n\t\t\t<ApertoTrigger\n\t\t\t\taria-label={`Open ${label}`}\n\t\t\t\tclassName={classNames?.thumbnail}\n\t\t\t>\n\t\t\t\t{renderThumbnail(media, renderImage, renderVideo)}\n\t\t\t</ApertoTrigger>\n\t\t\t<ApertoPortal>\n\t\t\t\t<ApertoOverlay className={classNames?.overlay} />\n\t\t\t\t<ApertoContent\n\t\t\t\t\tclassName={classNames?.content}\n\t\t\t\t\t{...getDescriptionProps(media)}\n\t\t\t\t>\n\t\t\t\t\t{renderExpandedMedia(media, renderImage, renderVideo)}\n\t\t\t\t\t<ApertoTitle>{title}</ApertoTitle>\n\t\t\t\t\t{media.description ? (\n\t\t\t\t\t\t<ApertoDescription>{media.description}</ApertoDescription>\n\t\t\t\t\t) : null}\n\t\t\t\t\t<ApertoClose\n\t\t\t\t\t\taria-label=\"Close\"\n\t\t\t\t\t\tclassName={classNames?.closeButton}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t/>\n\t\t\t\t</ApertoContent>\n\t\t\t</ApertoPortal>\n\t\t</ApertoRoot>\n\t);\n}\n","\"use client\";\n\nimport { useApertoGroup } from \"../aperto-group-context\";\nimport { ApertoTrigger } from \"../aperto-trigger\";\nimport { getMediaLabel, renderThumbnail } from \"../media-rendering\";\nimport type { ApertoThumbnailProps } from \"./ApertoTypes\";\n\nexport function ApertoThumbnail({\n\tchildren,\n\tclassName,\n\tindex,\n}: ApertoThumbnailProps) {\n\tconst group = useApertoGroup();\n\tconst media = group.media[index];\n\n\tif (!media) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ApertoTrigger\n\t\t\tactive={group.index === index}\n\t\t\taria-label={`Open ${getMediaLabel(media)}`}\n\t\t\tclassName={className ?? group.classNames?.thumbnail}\n\t\t\tonClick={() => group.openAtIndex(index)}\n\t\t\tref={(node) => group.registerThumbnail(index, node)}\n\t\t\tsharedLayoutId={false}\n\t\t>\n\t\t\t{children ?? renderThumbnail(media, group.renderImage, group.renderVideo)}\n\t\t</ApertoTrigger>\n\t);\n}\n","\"use client\";\n\n/**\n * @patternmode/aperto\n *\n * Opinionated thumbnail-to-expanded media transitions.\n * Built on Radix Dialog + Motion.\n *\n * Inspired by Cambio (https://github.com/raphaelsalaja/cambio)\n * by Raphael Salaja.\n *\n * @example\n * ```tsx\n * import { Aperto } from \"@patternmode/aperto\";\n *\n * import { Aperto } from \"@patternmode/aperto\";\n * import \"@patternmode/aperto/styles.css\";\n *\n * <Aperto.Group media={media}>\n * {media.map((item, index) => (\n * <Aperto.Thumbnail key={item.id ?? item.src} index={index} />\n * ))}\n * </Aperto.Group>\n * ```\n */\n\nimport {\n\tApertoGroup,\n\ttype ApertoGroupProps,\n\ttype ApertoProps,\n\tApertoSingle,\n\tApertoThumbnail,\n\ttype ApertoThumbnailProps,\n} from \"./aperto\";\nimport { ApertoClose } from \"./aperto-close\";\nimport { ApertoContent, type ApertoContentProps } from \"./aperto-content\";\nimport { ApertoDescription } from \"./aperto-description\";\nimport { ApertoOverlay, type ApertoOverlayProps } from \"./aperto-overlay\";\nimport { ApertoPortal, type ApertoPortalProps } from \"./aperto-portal\";\nimport { ApertoRoot, type ApertoRootProps } from \"./aperto-root\";\nimport { ApertoTitle } from \"./aperto-title\";\nimport { ApertoTrigger, type ApertoTriggerProps } from \"./aperto-trigger\";\n\n/** Lower-level compound component namespace for advanced composition. */\nconst ApertoPrimitive = {\n\tClose: ApertoClose,\n\tContent: ApertoContent,\n\tDescription: ApertoDescription,\n\tOverlay: ApertoOverlay,\n\tPortal: ApertoPortal,\n\tRoot: ApertoRoot,\n\tTitle: ApertoTitle,\n\tTrigger: ApertoTrigger,\n};\n\n/** Primary media-first component namespace. */\nconst Aperto = Object.assign(ApertoSingle, {\n\tGroup: ApertoGroup,\n\tPrimitive: ApertoPrimitive,\n\tThumbnail: ApertoThumbnail,\n});\n\n// Preset system\nexport { PRESETS, resolvePreset } from \"./presets\";\n// Types\nexport type {\n\tApertoClassNames,\n\tApertoImageItem,\n\tApertoMediaItem,\n\tApertoVideoItem,\n\tDismissibleConfig,\n\tDragSpringConfig,\n\tMotionPreset,\n\tMotionPresetName,\n\tMotionProp,\n\tMotionVariants,\n\tNavigationMotionPresetName,\n\tRenderImage,\n\tRenderVideo,\n} from \"./types\";\n// Named exports for tree-shaking\nexport {\n\tAperto,\n\tApertoClose,\n\tApertoContent,\n\ttype ApertoContentProps,\n\tApertoDescription,\n\tApertoGroup,\n\ttype ApertoGroupProps,\n\tApertoOverlay,\n\ttype ApertoOverlayProps,\n\tApertoPortal,\n\ttype ApertoPortalProps,\n\tApertoPrimitive,\n\ttype ApertoProps,\n\tApertoRoot,\n\ttype ApertoRootProps,\n\tApertoThumbnail,\n\ttype ApertoThumbnailProps,\n\tApertoTitle,\n\tApertoTrigger,\n\ttype ApertoTriggerProps,\n};\n"],"mappings":";;;AAEA,SAAS,aAAa,cAAc,SAAS;AAC7C;AAAA,EAEC,eAAAA;AAAA,EACA,SAAAC;AAAA,EACA;AAAA,EACA,WAAAC;AAAA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M,aAAY,IACnC;AAAA,YACJ,gBAAAA;AAAA,cAAC;AAAA;AAAA,gBACA,cAAW;AAAA,gBACX,WAAW,YAAY;AAAA,gBACvB,MAAK;AAAA;AAAA,YACN;AAAA;AAAA;AAAA,MACD;AAAA,OACD;AAAA,KACD;AAEF;;;ACpCE,gBAAAE,aAAA;AAbK,SAAS,gBAAgB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AACD,GAAyB;AACxB,QAAM,QAAQ,eAAe;AAC7B,QAAM,QAAQ,MAAM,MAAM,KAAK;AAE/B,MAAI,CAAC,OAAO;AACX,WAAO;AAAA,EACR;AAEA,SACC,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACA,QAAQ,MAAM,UAAU;AAAA,MACxB,cAAY,QAAQ,cAAc,KAAK,CAAC;AAAA,MACxC,WAAW,aAAa,MAAM,YAAY;AAAA,MAC1C,SAAS,MAAM,MAAM,YAAY,KAAK;AAAA,MACtC,KAAK,CAAC,SAAS,MAAM,kBAAkB,OAAO,IAAI;AAAA,MAClD,gBAAgB;AAAA,MAEf,sBAAY,gBAAgB,OAAO,MAAM,aAAa,MAAM,WAAW;AAAA;AAAA,EACzE;AAEF;;;ACaA,IAAM,kBAAkB;AAAA,EACvB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,aAAa;AAAA,EACb,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AACV;AAGA,IAAM,SAAS,OAAO,OAAO,cAAc;AAAA,EAC1C,OAAO;AAAA,EACP,WAAW;AAAA,EACX,WAAW;AACZ,CAAC;","names":["useCallback","useId","useMemo","useState","Dialog","forwardRef","jsx","createContext","useContext","Dialog","motion","forwardRef","jsx","forwardRef","motion","Dialog","jsx","Dialog","useCallback","useState","jsx","useState","useCallback","Dialog","forwardRef","jsx","AnimatePresence","motion","jsx","jsx","AnimatePresence","motion","motion","jsx","motion","jsx","useId","useState","useCallback","useMemo","Dialog","X","forwardRef","jsx","Dialog","motion","forwardRef","useCallback","useEffect","useState","jsx","forwardRef","useState","useEffect","useCallback","motion","jsx","jsxs","jsx"]}
|
|
1
|
+
{"version":3,"sources":["../src/Aperto/ApertoGroup.tsx","../src/aperto-content.tsx","../src/context.ts","../src/physics.ts","../src/motion-tokens.ts","../src/presets.ts","../src/aperto-description.tsx","../src/aperto-group-context.ts","../src/aperto-overlay.tsx","../src/aperto-portal.tsx","../src/aperto-root.tsx","../src/aperto-title.tsx","../src/expanded-media-stage.tsx","../src/media-rendering.tsx","../src/media-utils.ts","../src/media-transition.tsx","../src/media-transition-utils.ts","../src/Aperto/ApertoGroupState.ts","../src/Aperto/ApertoKeyboard.ts","../src/aperto-close.tsx","../src/aperto-trigger.tsx","../src/Aperto/ApertoSingle.tsx","../src/Aperto/ApertoThumbnail.tsx","../src/index.ts"],"sourcesContent":["\"use client\";\n\nimport { ChevronLeft, ChevronRight, X } from \"lucide-react\";\nimport {\n type CSSProperties,\n type KeyboardEvent,\n useCallback,\n useId,\n useLayoutEffect,\n useMemo,\n useReducer,\n useRef,\n} from \"react\";\n\nimport { ApertoContent } from \"../aperto-content\";\nimport { ApertoDescription } from \"../aperto-description\";\nimport { ApertoGroupContext } from \"../aperto-group-context\";\nimport { ApertoOverlay } from \"../aperto-overlay\";\nimport { ApertoPortal } from \"../aperto-portal\";\nimport { ApertoRoot } from \"../aperto-root\";\nimport { ApertoTitle } from \"../aperto-title\";\nimport {\n ApertoExpandedMediaStage,\n type NavigationDirection,\n} from \"../expanded-media-stage\";\nimport { ApertoMediaTransitionClone } from \"../media-transition\";\nimport { rectFromElement } from \"../media-transition-utils\";\nimport { getDescriptionProps, getMediaLabel } from \"../media-utils\";\nimport type { ApertoClassNames } from \"../types\";\nimport { apertoGroupReducer, getInitialGroupState } from \"./ApertoGroupState\";\nimport { shouldIgnoreKeyboardNavigationTarget } from \"./ApertoKeyboard\";\nimport type { ApertoGroupProps } from \"./ApertoTypes\";\n\nexport function ApertoGroup({\n children,\n classNames,\n dismissible,\n index: controlledIndex,\n initialIndex = 0,\n media,\n motion: motionProp,\n navigationMotion = \"glide\",\n onIndexChange,\n renderImage,\n renderVideo,\n}: ApertoGroupProps) {\n const generatedId = useId();\n const [state, dispatch] = useReducer(\n apertoGroupReducer,\n initialIndex,\n getInitialGroupState,\n );\n const isControlled = controlledIndex !== undefined;\n const index = isControlled ? controlledIndex : state.internalIndex;\n const activeMedia = media[index] ?? media[0];\n const expandedMediaRef = useRef<HTMLDivElement | null>(null);\n const thumbnailRefs = useRef<Map<number, HTMLButtonElement> | null>(null);\n if (thumbnailRefs.current === null) {\n thumbnailRefs.current = new Map();\n }\n const thumbnailMap = thumbnailRefs.current;\n const sharedLayoutIdForIndex = useCallback(\n (nextIndex: number) => `aperto-group-${generatedId}-${nextIndex}-shared`,\n [generatedId],\n );\n const sharedLayoutId = sharedLayoutIdForIndex(state.layoutSourceIndex);\n const measureOpeningTarget = useCallback((node: HTMLDivElement) => {\n const targetRect = rectFromElement(node);\n if (!targetRect) {\n return;\n }\n dispatch({ rect: targetRect, type: \"complete-opening-target\" });\n }, []);\n const setExpandedMediaNode = useCallback(\n (node: HTMLDivElement | null) => {\n expandedMediaRef.current = node;\n if (node) {\n measureOpeningTarget(node);\n }\n },\n [measureOpeningTarget],\n );\n\n const registerThumbnail = useCallback(\n (thumbIndex: number, node: HTMLButtonElement | null) => {\n if (node) {\n thumbnailMap.set(thumbIndex, node);\n return;\n }\n thumbnailMap.delete(thumbIndex);\n },\n [thumbnailMap],\n );\n\n useLayoutEffect(() => {\n if (\n state.mediaTransition?.phase !== \"opening\" ||\n state.mediaTransition.to ||\n !expandedMediaRef.current\n ) {\n return;\n }\n\n measureOpeningTarget(expandedMediaRef.current);\n }, [measureOpeningTarget, state.mediaTransition]);\n\n const setIndex = useCallback(\n (nextIndex: number) => {\n if (!isControlled) {\n dispatch({ index: nextIndex, type: \"set-index\" });\n }\n onIndexChange?.(nextIndex);\n },\n [isControlled, onIndexChange],\n );\n\n const openAtIndex = useCallback(\n (thumbIndex: number) => {\n const sourceRect = rectFromElement(thumbnailMap.get(thumbIndex) ?? null);\n const item = media[thumbIndex];\n const transition =\n sourceRect && item\n ? { from: sourceRect, item, phase: \"opening\" as const }\n : null;\n\n dispatch({ index: thumbIndex, transition, type: \"open-at-index\" });\n onIndexChange?.(thumbIndex);\n },\n [media, onIndexChange, thumbnailMap],\n );\n\n const startClose = useCallback(() => {\n if (!state.open || state.closing) {\n return;\n }\n\n const sourceRect = rectFromElement(expandedMediaRef.current);\n const targetRect = rectFromElement(thumbnailMap.get(index) ?? null);\n\n if (!activeMedia || !sourceRect || !targetRect) {\n dispatch({ type: \"close-without-transition\" });\n return;\n }\n\n dispatch({\n transition: {\n from: sourceRect,\n item: activeMedia,\n phase: \"closing\",\n to: targetRect,\n },\n type: \"start-close\",\n });\n }, [activeMedia, index, state.closing, state.open, thumbnailMap]);\n\n const handleCloseAutoFocus = useCallback(\n (event: Event) => {\n event.preventDefault();\n thumbnailMap.get(index)?.focus({ preventScroll: true });\n },\n [index, thumbnailMap],\n );\n\n const handleMediaTransitionComplete = useCallback(() => {\n dispatch({ type: \"finish-transition\" });\n }, []);\n\n const handleOpenChange = useCallback(\n (nextOpen: boolean) => {\n if (nextOpen) {\n dispatch({ open: true, type: \"set-open\" });\n return;\n }\n\n startClose();\n },\n [startClose],\n );\n\n const value = useMemo(\n () => ({\n classNames,\n index,\n media,\n open: state.open,\n openAtIndex,\n registerThumbnail,\n renderImage,\n renderVideo,\n setIndex,\n sharedLayoutId,\n sharedLayoutIdForIndex,\n }),\n [\n classNames,\n index,\n media,\n state.open,\n openAtIndex,\n registerThumbnail,\n renderImage,\n renderVideo,\n setIndex,\n sharedLayoutId,\n sharedLayoutIdForIndex,\n ],\n );\n const hasNavigation = media.length > 1;\n const navigateToIndex = useCallback(\n (nextIndex: number, direction: NavigationDirection) => {\n dispatch({ direction, index: nextIndex, type: \"navigate\" });\n onIndexChange?.(nextIndex);\n },\n [onIndexChange],\n );\n const goToPrevious = useCallback(() => {\n navigateToIndex((index - 1 + media.length) % media.length, -1);\n }, [index, media.length, navigateToIndex]);\n const goToNext = useCallback(() => {\n navigateToIndex((index + 1) % media.length, 1);\n }, [index, media.length, navigateToIndex]);\n const handleContentKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (\n event.defaultPrevented ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n shouldIgnoreKeyboardNavigationTarget(event.target)\n ) {\n return;\n }\n\n if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n goToPrevious();\n }\n\n if (event.key === \"ArrowRight\") {\n event.preventDefault();\n goToNext();\n }\n },\n [goToNext, goToPrevious],\n );\n const expandedMediaStyle = useMemo((): CSSProperties | undefined => {\n if (!activeMedia?.width || !activeMedia.height) {\n return undefined;\n }\n\n return {\n \"--aperto-expanded-aspect-ratio\": `${activeMedia.width} / ${activeMedia.height}`,\n \"--aperto-expanded-aspect-ratio-height\": activeMedia.height,\n \"--aperto-expanded-aspect-ratio-width\": activeMedia.width,\n } as CSSProperties;\n }, [activeMedia?.height, activeMedia?.width]);\n\n return (\n <ApertoGroupContext.Provider value={value}>\n <ApertoRoot\n dismissible={dismissible}\n motion={motionProp}\n onOpenChange={handleOpenChange}\n open={state.open}\n >\n {children}\n {activeMedia ? (\n <ApertoPortal>\n <ApertoOverlay\n className={classNames?.overlay}\n fadeOut={state.closing}\n />\n <ApertoContent\n className={classNames?.content}\n data-aperto-transition={state.mediaTransition?.phase}\n onCloseAutoFocus={handleCloseAutoFocus}\n onKeyDown={hasNavigation ? handleContentKeyDown : undefined}\n sharedLayoutId={false}\n {...getDescriptionProps(activeMedia)}\n >\n <div\n data-slot=\"aperto-media\"\n ref={setExpandedMediaNode}\n style={expandedMediaStyle}\n >\n <ApertoExpandedMediaStage\n direction={state.navigationDirection}\n index={index}\n item={activeMedia}\n navigationMotion={navigationMotion}\n renderImage={renderImage}\n renderVideo={renderVideo}\n />\n <ApertoMediaNavigationButtons\n classNames={classNames}\n enabled={hasNavigation}\n onNext={goToNext}\n onPrevious={goToPrevious}\n />\n </div>\n <ApertoTitle>\n {activeMedia.title ?? getMediaLabel(activeMedia)}\n </ApertoTitle>\n {activeMedia.description ? (\n <ApertoDescription>{activeMedia.description}</ApertoDescription>\n ) : null}\n {hasNavigation ? (\n <div className={classNames?.counter} data-slot=\"aperto-counter\">\n {index + 1} / {media.length}\n </div>\n ) : null}\n <button\n aria-label=\"Close\"\n className={classNames?.closeButton}\n data-slot=\"aperto-close\"\n onClick={startClose}\n type=\"button\"\n >\n <X aria-hidden=\"true\" size={17} strokeWidth={2} />\n </button>\n </ApertoContent>\n <ApertoMediaTransitionClone\n onComplete={handleMediaTransitionComplete}\n renderImage={renderImage}\n renderVideo={renderVideo}\n transition={state.mediaTransition}\n />\n </ApertoPortal>\n ) : null}\n </ApertoRoot>\n </ApertoGroupContext.Provider>\n );\n}\n\nfunction ApertoMediaNavigationButtons({\n classNames,\n enabled,\n onNext,\n onPrevious,\n}: {\n classNames: ApertoClassNames | undefined;\n enabled: boolean;\n onNext: () => void;\n onPrevious: () => void;\n}) {\n if (!enabled) {\n return null;\n }\n\n return (\n <>\n <button\n aria-label=\"Previous media\"\n className={classNames?.previousButton}\n data-slot=\"aperto-previous-button\"\n onClick={onPrevious}\n type=\"button\"\n >\n <ChevronLeft aria-hidden=\"true\" size={18} strokeWidth={2} />\n </button>\n <button\n aria-label=\"Next media\"\n className={classNames?.nextButton}\n data-slot=\"aperto-next-button\"\n onClick={onNext}\n type=\"button\"\n >\n <ChevronRight aria-hidden=\"true\" size={18} strokeWidth={2} />\n </button>\n </>\n );\n}\n","\"use client\";\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport {\n type MotionStyle,\n m,\n type PanInfo,\n useMotionValue,\n useSpring,\n useTransform,\n} from \"motion/react\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n useCallback,\n useMemo,\n useState,\n} from \"react\";\n\nimport { useApertoContext } from \"./context\";\nimport {\n calculateResistance,\n DEFAULT_DISTANCE_THRESHOLD,\n DEFAULT_VELOCITY_THRESHOLD,\n OPACITY_INPUT,\n OPACITY_OUTPUT,\n SCALE_INPUT,\n SCALE_OUTPUT,\n} from \"./physics\";\nimport { getDragSpring, resolvePreset } from \"./presets\";\nimport type { DismissibleConfig, MotionPresetName } from \"./types\";\n\nexport interface ApertoContentProps\n extends Omit<\n ComponentPropsWithoutRef<typeof Dialog.Content>,\n \"asChild\" | \"forceMount\"\n > {\n /** Motion preset override for this content panel, independent of the root preset. */\n motion?: MotionPresetName;\n /** Built-in positioning strategy. Use \"none\" for custom primitive compositions. */\n placement?: \"center\" | \"none\";\n /** Internal shared layout ID override for grouped media. */\n sharedLayoutId?: string | false;\n}\n\nconst ApertoContent = forwardRef<HTMLDivElement, ApertoContentProps>(\n (\n {\n children,\n className,\n motion: motionOverride,\n placement = \"center\",\n sharedLayoutId,\n style,\n ...props\n },\n ref,\n ) => {\n const ctx = useApertoContext();\n const [isDragging, setIsDragging] = useState(false);\n const resolved = resolvePreset(\n \"content\",\n motionOverride,\n ctx.presetName,\n ctx.variants,\n ctx.reduceMotion,\n );\n\n const contentLayoutId =\n sharedLayoutId === false\n ? undefined\n : (sharedLayoutId ?? `${ctx.layoutId}-shared`);\n\n const dragSpring = getDragSpring(resolved);\n const isDismissible = ctx.dismissible !== false;\n\n const dismissConfig: DismissibleConfig =\n typeof ctx.dismissible === \"object\" ? ctx.dismissible : {};\n const distanceThreshold =\n dismissConfig.threshold ?? DEFAULT_DISTANCE_THRESHOLD;\n const velocityThreshold =\n dismissConfig.velocity ?? DEFAULT_VELOCITY_THRESHOLD;\n\n const dragX = useMotionValue(0);\n const dragY = useMotionValue(0);\n const springX = useSpring(dragX, dragSpring);\n const springY = useSpring(dragY, dragSpring);\n\n const distance = useTransform(() =>\n Math.hypot(springX.get(), springY.get()),\n );\n const scaleMotion = useTransform(distance, SCALE_INPUT, SCALE_OUTPUT);\n const opacityMotion = useTransform(distance, OPACITY_INPUT, OPACITY_OUTPUT);\n const resistance = useTransform(distance, calculateResistance);\n\n const handleDrag = useCallback(\n (_event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {\n if (!isDragging) {\n setIsDragging(true);\n }\n const r = resistance.get();\n dragX.set(info.offset.x * r);\n dragY.set(info.offset.y * r);\n },\n [dragX, dragY, isDragging, resistance],\n );\n\n const handleDragEnd = useCallback(\n (_event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {\n setIsDragging(false);\n const speed = Math.hypot(info.velocity.x, info.velocity.y);\n const dist = Math.hypot(info.offset.x, info.offset.y);\n\n if (speed > velocityThreshold || dist > distanceThreshold) {\n ctx.onOpenChange(false);\n return;\n }\n\n dragX.set(0);\n dragY.set(0);\n },\n [ctx.onOpenChange, distanceThreshold, dragX, dragY, velocityThreshold],\n );\n\n const motionStyle = useMemo(\n (): MotionStyle => ({\n cursor: isDragging ? \"grabbing\" : isDismissible ? \"grab\" : undefined,\n opacity: opacityMotion,\n scale: scaleMotion,\n x: springX,\n y: springY,\n ...(placement === \"center\"\n ? {\n left: \"50%\",\n top: \"50%\",\n translate: \"-50% -50%\",\n }\n : {}),\n ...style,\n }),\n [\n isDismissible,\n isDragging,\n opacityMotion,\n placement,\n scaleMotion,\n springX,\n springY,\n style,\n ],\n );\n\n return (\n <Dialog.Content asChild forceMount {...props}>\n <m.div\n className={className}\n data-slot=\"aperto-content\"\n drag={isDismissible}\n dragConstraints={{ bottom: 0, left: 0, right: 0, top: 0 }}\n dragElastic={0}\n dragMomentum={false}\n dragSnapToOrigin\n layout={contentLayoutId ? true : undefined}\n layoutId={contentLayoutId}\n onDrag={isDismissible ? handleDrag : undefined}\n onDragEnd={isDismissible ? handleDragEnd : undefined}\n ref={ref}\n style={motionStyle}\n transition={resolved.transition}\n >\n {children}\n </m.div>\n </Dialog.Content>\n );\n },\n);\n\nApertoContent.displayName = \"ApertoContent\";\n\nexport { ApertoContent };\n","\"use client\";\n\nimport { createContext, useContext } from \"react\";\nimport type { ApertoContextValue } from \"./types\";\n\nexport const ApertoContext = createContext<ApertoContextValue | null>(null);\n\nexport function useApertoContext(): ApertoContextValue {\n const ctx = useContext(ApertoContext);\n if (!ctx) {\n throw new Error(\"Aperto components must be used within <Aperto.Root>\");\n }\n return ctx;\n}\n","/**\n * Drag physics utilities.\n *\n * The logarithmic resistance function creates a rubber-band feel:\n * initial movement is free, but gets progressively harder the further\n * you drag. Combined with spring-smoothed motion values, this produces\n * a natural, elastic gesture.\n */\n\nconst RESISTANCE_DIVISOR = 20;\nconst RESISTANCE_SCALE = 4;\nconst RESISTANCE_MIN = 0.1;\n\n/**\n * Logarithmic resistance — decelerates drag progressively.\n * Returns a multiplier between RESISTANCE_MIN and 1.0.\n *\n * At distance 0: returns 1.0 (full movement)\n * At distance 50: returns ~0.77\n * At distance 100: returns ~0.58\n * At distance 200: returns ~0.42\n */\nexport function calculateResistance(distance: number): number {\n return Math.max(\n RESISTANCE_MIN,\n 1 - Math.log(distance / RESISTANCE_DIVISOR + 1) / RESISTANCE_SCALE,\n );\n}\n\n/** Scale mapping: distance → visual scale (1.0 → 0.95) */\nexport const SCALE_INPUT = [0, 50, 100];\nexport const SCALE_OUTPUT = [1, 0.98, 0.95];\n\n/** Opacity mapping: distance → visual opacity (1.0 → 0.96) */\nexport const OPACITY_INPUT = [0, 80];\nexport const OPACITY_OUTPUT = [1, 0.96];\n\n/** Default dismissal thresholds */\nexport const DEFAULT_DISTANCE_THRESHOLD = 100;\nexport const DEFAULT_VELOCITY_THRESHOLD = 500;\n","import type { Easing } from \"motion/react\";\n\nexport const durations = {\n snappy: 0.22,\n moderate: 0.4,\n} as const;\n\nexport const easings = {\n customGentle: [0.25, 0.1, 0.12, 1],\n snappy: [0.22, 1, 0.36, 1],\n} satisfies Record<string, Easing>;\n\nexport const springs = {\n bouncy: { stiffness: 260, damping: 12, mass: 1 },\n natural: { stiffness: 200, damping: 20, mass: 1 },\n snappy: { stiffness: 400, damping: 28, mass: 0.8 },\n stiff: { stiffness: 500, damping: 30, mass: 1 },\n} as const;\n","import { durations, easings, springs } from \"./motion-tokens\";\nimport type {\n DragSpringConfig,\n MotionPreset,\n MotionPresetName,\n MotionVariants,\n} from \"./types\";\n\n/**\n * Motion presets — each bundles transition timing AND drag physics\n * so \"snappy\" feels snappy everywhere: open, close, and drag.\n *\n * Curves and springs are local copies of the Howells motion tokens so the\n * published package has no private workspace runtime dependencies.\n */\nexport const PRESETS: Record<MotionPresetName, MotionPreset> = {\n snappy: {\n transition: { ease: easings.snappy, duration: durations.snappy },\n drag: {\n stiffness: springs.stiff.stiffness,\n damping: springs.stiff.damping,\n restDelta: 0.01,\n },\n },\n smooth: {\n transition: { ease: easings.customGentle, duration: durations.moderate },\n drag: {\n stiffness: springs.natural.stiffness,\n damping: springs.natural.damping,\n restDelta: 0.01,\n },\n },\n bouncy: {\n transition: {\n type: \"spring\",\n stiffness: springs.bouncy.stiffness,\n damping: springs.bouncy.damping,\n mass: springs.bouncy.mass,\n },\n drag: {\n stiffness: springs.snappy.stiffness,\n damping: springs.snappy.damping,\n restDelta: 0.01,\n },\n },\n reduced: {\n transition: { ease: \"linear\", duration: 0.01 },\n drag: { stiffness: 1000, damping: 50, restDelta: 0.1 },\n },\n};\n\ntype ComponentType = \"trigger\" | \"content\" | \"backdrop\";\n\n/**\n * Three-level motion resolution:\n * 1. Component-level override (highest)\n * 2. Per-component variant from Root\n * 3. Global preset from Root (lowest)\n *\n * If `prefers-reduced-motion` is active, always returns \"reduced\".\n */\nexport function resolvePreset(\n componentType: ComponentType,\n componentMotion: MotionPresetName | undefined,\n globalPreset: MotionPresetName,\n variants: MotionVariants | undefined,\n reduceMotion: boolean,\n): MotionPreset {\n if (reduceMotion) {\n return PRESETS.reduced;\n }\n\n // 1. Component-level override\n if (componentMotion) {\n return PRESETS[componentMotion];\n }\n\n // 2. Per-component variant\n if (variants?.[componentType]) {\n return PRESETS[variants[componentType]];\n }\n\n // 3. Global preset\n return PRESETS[globalPreset];\n}\n\n/** Extract the drag spring config from a preset */\nexport function getDragSpring(preset: MotionPreset): DragSpringConfig {\n return preset.drag;\n}\n","\"use client\";\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport { type ComponentPropsWithoutRef, forwardRef } from \"react\";\n\nconst ApertoDescription = forwardRef<\n HTMLParagraphElement,\n ComponentPropsWithoutRef<typeof Dialog.Description>\n>((props, ref) => {\n return (\n <Dialog.Description data-slot=\"aperto-description\" ref={ref} {...props} />\n );\n});\n\nApertoDescription.displayName = \"ApertoDescription\";\n\nexport { ApertoDescription };\n","import { createContext, useContext } from \"react\";\nimport type {\n ApertoClassNames,\n ApertoMediaItem,\n RenderImage,\n RenderVideo,\n} from \"./types\";\n\nexport interface ApertoGroupContextValue {\n classNames?: ApertoClassNames;\n index: number;\n media: ApertoMediaItem[];\n open: boolean;\n openAtIndex: (index: number) => void;\n registerThumbnail: (index: number, node: HTMLButtonElement | null) => void;\n renderImage?: RenderImage;\n renderVideo?: RenderVideo;\n setIndex: (index: number) => void;\n sharedLayoutId: string;\n sharedLayoutIdForIndex: (index: number) => string;\n}\n\nexport const ApertoGroupContext = createContext<ApertoGroupContextValue | null>(\n null,\n);\n\nexport function useApertoGroup(): ApertoGroupContextValue {\n const ctx = useContext(ApertoGroupContext);\n if (!ctx) {\n throw new Error(\"Aperto.Thumbnail must be used within <Aperto.Group>\");\n }\n return ctx;\n}\n","\"use client\";\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport { m, type Transition } from \"motion/react\";\nimport { forwardRef } from \"react\";\n\nimport { useApertoContext } from \"./context\";\nimport { easings } from \"./motion-tokens\";\n\nexport interface ApertoOverlayProps {\n className?: string;\n /** Internal flag used to fade the overlay during measured close transitions. */\n fadeOut?: boolean;\n style?: React.CSSProperties;\n}\n\n/** Overlay always fades gently regardless of the content's motion preset. */\nconst OVERLAY_TRANSITION: Transition = {\n duration: 0.3,\n ease: easings.customGentle,\n};\n\nconst OVERLAY_TRANSITION_REDUCED: Transition = {\n duration: 0.01,\n ease: \"linear\",\n};\n\nconst ApertoOverlay = forwardRef<HTMLDivElement, ApertoOverlayProps>(\n ({ className, fadeOut, style }, ref) => {\n const ctx = useApertoContext();\n const transition = ctx.reduceMotion\n ? OVERLAY_TRANSITION_REDUCED\n : OVERLAY_TRANSITION;\n\n return (\n <Dialog.Overlay asChild forceMount>\n <m.div\n animate={{ opacity: fadeOut ? 0 : 1 }}\n className={className}\n data-slot=\"aperto-overlay\"\n exit={{ opacity: 0 }}\n initial={{ opacity: 0 }}\n ref={ref}\n style={style}\n transition={transition}\n />\n </Dialog.Overlay>\n );\n },\n);\n\nApertoOverlay.displayName = \"ApertoOverlay\";\n\nexport { ApertoOverlay };\n","\"use client\";\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport { AnimatePresence } from \"motion/react\";\nimport type { ReactNode } from \"react\";\n\nimport { useApertoContext } from \"./context\";\n\nexport interface ApertoPortalProps {\n children: ReactNode;\n /** Container element for the portal (default: document.body) */\n container?: HTMLElement;\n}\n\nfunction ApertoPortal({ children, container }: ApertoPortalProps) {\n const { open } = useApertoContext();\n\n return (\n <AnimatePresence>\n {open && (\n <Dialog.Portal container={container} forceMount>\n {children}\n </Dialog.Portal>\n )}\n </AnimatePresence>\n );\n}\n\nexport { ApertoPortal };\n","\"use client\";\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport {\n domMax,\n LayoutGroup,\n LazyMotion,\n useReducedMotion,\n} from \"motion/react\";\nimport {\n type ComponentPropsWithoutRef,\n type ReactNode,\n useCallback,\n useId,\n useMemo,\n useState,\n} from \"react\";\n\nimport { ApertoContext } from \"./context\";\nimport { PRESETS } from \"./presets\";\nimport type {\n DismissibleConfig,\n MotionPresetName,\n MotionVariants,\n} from \"./types\";\n\nexport interface ApertoRootProps\n extends Omit<\n ComponentPropsWithoutRef<typeof Dialog.Root>,\n \"open\" | \"onOpenChange\"\n > {\n children: ReactNode;\n /** Whether dragging can dismiss the content (default: true) */\n dismissible?: boolean | DismissibleConfig;\n /** Layout ID for shared element transition (auto-generated if omitted) */\n layoutId?: string;\n /** Motion preset or per-component variants */\n motion?: MotionPresetName | MotionVariants;\n /** Controlled open state */\n open?: boolean;\n /** Callback when open state changes */\n onOpenChange?: (open: boolean) => void;\n /** Force reduced motion regardless of system preference */\n reduceMotion?: boolean;\n}\n\nfunction ApertoRoot({\n children,\n dismissible = true,\n layoutId: layoutIdProp,\n motion: motionProp = \"smooth\",\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n reduceMotion: reduceMotionProp,\n ...dialogProps\n}: ApertoRootProps) {\n const generatedId = useId();\n const layoutId = layoutIdProp ?? `aperto-${generatedId}`;\n const systemReducedMotion = useReducedMotion() ?? false;\n const shouldReduce = reduceMotionProp ?? systemReducedMotion;\n\n // Uncontrolled state fallback\n const [internalOpen, setInternalOpen] = useState(false);\n const isControlled = controlledOpen !== undefined;\n const open = isControlled ? controlledOpen : internalOpen;\n\n const onOpenChange = useCallback(\n (nextOpen: boolean) => {\n if (!isControlled) {\n setInternalOpen(nextOpen);\n }\n controlledOnOpenChange?.(nextOpen);\n },\n [isControlled, controlledOnOpenChange],\n );\n\n // Resolve global preset name\n const globalPresetName: MotionPresetName =\n typeof motionProp === \"string\" ? motionProp : \"smooth\";\n const variants: MotionVariants | undefined =\n typeof motionProp === \"object\" ? motionProp : undefined;\n\n const presetName: MotionPresetName = shouldReduce\n ? \"reduced\"\n : globalPresetName;\n const preset = PRESETS[presetName];\n const contextValue = useMemo(\n () => ({\n dismissible,\n layoutId,\n onOpenChange,\n open,\n preset,\n presetName,\n reduceMotion: shouldReduce,\n variants,\n }),\n [\n dismissible,\n layoutId,\n onOpenChange,\n open,\n preset,\n presetName,\n shouldReduce,\n variants,\n ],\n );\n\n return (\n <ApertoContext.Provider value={contextValue}>\n <Dialog.Root onOpenChange={onOpenChange} open={open} {...dialogProps}>\n <LazyMotion features={domMax}>\n <LayoutGroup id={layoutId}>{children}</LayoutGroup>\n </LazyMotion>\n </Dialog.Root>\n </ApertoContext.Provider>\n );\n}\n\nexport { ApertoRoot };\n","\"use client\";\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport { type ComponentPropsWithoutRef, forwardRef } from \"react\";\n\nconst ApertoTitle = forwardRef<\n HTMLHeadingElement,\n ComponentPropsWithoutRef<typeof Dialog.Title>\n>((props, ref) => {\n return <Dialog.Title data-slot=\"aperto-title\" ref={ref} {...props} />;\n});\n\nApertoTitle.displayName = \"ApertoTitle\";\n\nexport { ApertoTitle };\n","import {\n AnimatePresence,\n m,\n type TargetAndTransition,\n type Transition,\n} from \"motion/react\";\nimport { useApertoContext } from \"./context\";\nimport { ApertoExpandedMedia } from \"./media-rendering\";\nimport { getMediaKey } from \"./media-utils\";\nimport type {\n ApertoMediaItem,\n NavigationMotionPresetName,\n RenderImage,\n RenderVideo,\n} from \"./types\";\n\nexport type NavigationDirection = -1 | 0 | 1;\n\ninterface NavigationMotionPreset {\n offset: number;\n scale: number;\n transition: Transition;\n}\n\ninterface NavigationAnimationCustom {\n direction: NavigationDirection;\n offset: number;\n scale: number;\n}\n\nconst NAVIGATION_MOTION_PRESETS: Record<\n NavigationMotionPresetName,\n NavigationMotionPreset\n> = {\n float: {\n offset: 96,\n scale: 0.97,\n transition: {\n opacity: { duration: 0.34, ease: [0.45, 0, 0.2, 1] },\n scale: { damping: 26, mass: 1.15, stiffness: 80, type: \"spring\" },\n x: { damping: 26, mass: 1.15, stiffness: 80, type: \"spring\" },\n },\n },\n glide: {\n offset: 58,\n scale: 0.984,\n transition: {\n opacity: { duration: 0.24, ease: [0.4, 0, 0.2, 1] },\n scale: { damping: 28, mass: 0.95, stiffness: 150, type: \"spring\" },\n x: { damping: 28, mass: 0.95, stiffness: 150, type: \"spring\" },\n },\n },\n snap: {\n offset: 38,\n scale: 0.996,\n transition: {\n opacity: { duration: 0.12, ease: [0.2, 0, 0, 1] },\n scale: { damping: 34, mass: 0.7, stiffness: 420, type: \"spring\" },\n x: { damping: 34, mass: 0.7, stiffness: 420, type: \"spring\" },\n },\n },\n};\n\nconst REDUCED_EXPANDED_MEDIA_TRANSITION: Transition = {\n duration: 0.12,\n ease: \"linear\",\n};\n\nconst expandedMediaVariants = {\n center: {\n opacity: 1,\n scale: 1,\n x: 0,\n },\n enter: ({\n direction,\n offset,\n scale,\n }: NavigationAnimationCustom): TargetAndTransition => ({\n opacity: 0,\n scale: direction === 0 ? 1 : scale,\n x: direction * offset,\n }),\n exit: ({\n direction,\n offset,\n scale,\n }: NavigationAnimationCustom): TargetAndTransition => ({\n opacity: 0,\n scale: direction === 0 ? 1 : scale,\n x: direction * -offset,\n }),\n};\n\nconst reducedExpandedMediaVariants = {\n center: {\n opacity: 1,\n x: 0,\n },\n enter: {\n opacity: 0,\n x: 0,\n },\n exit: {\n opacity: 0,\n x: 0,\n },\n};\n\nexport function ApertoExpandedMediaStage({\n direction,\n index,\n item,\n navigationMotion,\n renderImage,\n renderVideo,\n}: {\n direction: NavigationDirection;\n index: number;\n item: ApertoMediaItem;\n navigationMotion: NavigationMotionPresetName;\n renderImage?: RenderImage;\n renderVideo?: RenderVideo;\n}) {\n const ctx = useApertoContext();\n const preset = NAVIGATION_MOTION_PRESETS[navigationMotion];\n const transition = ctx.reduceMotion\n ? REDUCED_EXPANDED_MEDIA_TRANSITION\n : preset.transition;\n const variants = ctx.reduceMotion\n ? reducedExpandedMediaVariants\n : expandedMediaVariants;\n const animationCustom: NavigationAnimationCustom = {\n direction,\n offset: preset.offset,\n scale: preset.scale,\n };\n\n return (\n <AnimatePresence custom={animationCustom} initial={false} mode=\"sync\">\n <m.div\n animate=\"center\"\n custom={animationCustom}\n data-navigation-direction={direction}\n data-navigation-motion={navigationMotion}\n data-slot=\"aperto-media-stage\"\n exit=\"exit\"\n initial=\"enter\"\n key={getMediaKey(item, index)}\n transition={transition}\n variants={variants}\n >\n <ApertoExpandedMedia\n item={item}\n renderImage={renderImage}\n renderVideo={renderVideo}\n />\n </m.div>\n </AnimatePresence>\n );\n}\n","import { createElement, type ReactNode } from \"react\";\nimport type { ApertoMediaItem, RenderImage, RenderVideo } from \"./types\";\n\nfunction renderDefaultImage(props: Parameters<RenderImage>[0]): ReactNode {\n const { item: _item, variant: _variant, ...imageProps } = props;\n return createElement(\"img\", { ...imageProps, alt: imageProps.alt ?? \"\" });\n}\n\nfunction renderDefaultVideo(props: Parameters<RenderVideo>[0]): ReactNode {\n const { item: _item, variant, ...videoProps } = props;\n if (variant === \"thumbnail\") {\n return createElement(\"img\", {\n alt: videoProps[\"aria-label\"] ?? \"\",\n src: props.item.thumbnailSrc,\n });\n }\n return (\n <video {...videoProps}>\n <track kind=\"captions\" src={props.item.captionsSrc ?? \"data:text/vtt,\"} />\n </video>\n );\n}\n\nexport function ApertoThumbnailMedia({\n item,\n renderImage,\n renderVideo,\n}: {\n item: ApertoMediaItem;\n renderImage?: RenderImage;\n renderVideo?: RenderVideo;\n}) {\n if (item.type === \"image\") {\n const imageProps: Parameters<RenderImage>[0] = {\n alt: \"\",\n height: item.height,\n item,\n src: item.thumbnailSrc ?? item.src,\n variant: \"thumbnail\",\n width: item.width,\n };\n return (renderImage ?? renderDefaultImage)(imageProps);\n }\n\n const videoProps: Parameters<RenderVideo>[0] = {\n \"aria-label\": item.alt ?? item.title ?? \"Video thumbnail\",\n height: item.height,\n item,\n poster: item.poster,\n src: item.thumbnailSrc,\n variant: \"thumbnail\",\n width: item.width,\n };\n return (renderVideo ?? renderDefaultVideo)(videoProps);\n}\n\nexport function ApertoExpandedMedia({\n item,\n renderImage,\n renderVideo,\n}: {\n item: ApertoMediaItem;\n renderImage?: RenderImage;\n renderVideo?: RenderVideo;\n}) {\n if (item.type === \"image\") {\n const imageProps: Parameters<RenderImage>[0] = {\n alt: item.alt,\n height: item.height,\n item,\n src: item.src,\n variant: \"expanded\",\n width: item.width,\n };\n return (renderImage ?? renderDefaultImage)(imageProps);\n }\n\n const videoProps: Parameters<RenderVideo>[0] = {\n \"aria-label\": item.alt ?? item.title ?? \"Video\",\n controls: true,\n height: item.height,\n item,\n poster: item.poster,\n src: item.src,\n variant: \"expanded\",\n width: item.width,\n };\n return (renderVideo ?? renderDefaultVideo)(videoProps);\n}\n\nexport function ApertoTransitionMedia({\n item,\n renderImage,\n renderVideo,\n}: {\n item: ApertoMediaItem;\n renderImage?: RenderImage;\n renderVideo?: RenderVideo;\n}) {\n if (item.type === \"image\") {\n const imageProps: Parameters<RenderImage>[0] = {\n alt: item.alt,\n height: item.height,\n item,\n src: item.src,\n variant: \"expanded\",\n width: item.width,\n };\n return (renderImage ?? renderDefaultImage)(imageProps);\n }\n\n const videoProps: Parameters<RenderVideo>[0] = {\n \"aria-label\": item.alt ?? item.title ?? \"Video\",\n height: item.height,\n item,\n poster: item.poster,\n src: item.src,\n variant: \"expanded\",\n width: item.width,\n };\n return (renderVideo ?? renderDefaultVideo)(videoProps);\n}\n","import type { ApertoMediaItem } from \"./types\";\n\nexport function getMediaLabel(item: ApertoMediaItem): string {\n return item.title ?? item.alt ?? \"media\";\n}\n\nexport function getMediaKey(item: ApertoMediaItem, index: number): string {\n return item.id ?? `${item.type}:${item.src}:${index}`;\n}\n\nexport function getDescriptionProps(item: ApertoMediaItem): {\n \"aria-describedby\"?: undefined;\n} {\n return item.description ? {} : { \"aria-describedby\": undefined };\n}\n","import { m } from \"motion/react\";\nimport { useEffect } from \"react\";\nimport { useApertoContext } from \"./context\";\nimport { ApertoTransitionMedia } from \"./media-rendering\";\nimport {\n type ApertoMediaTransition,\n rectTarget,\n transitionDurationMs,\n} from \"./media-transition-utils\";\nimport type { RenderImage, RenderVideo } from \"./types\";\n\nexport function ApertoMediaTransitionClone({\n onComplete,\n renderImage,\n renderVideo,\n transition,\n}: {\n onComplete: () => void;\n renderImage?: RenderImage;\n renderVideo?: RenderVideo;\n transition: ApertoMediaTransition | null;\n}) {\n const ctx = useApertoContext();\n\n useEffect(() => {\n if (!transition?.to) {\n return;\n }\n\n const timer = setTimeout(\n onComplete,\n transitionDurationMs(ctx.preset.transition),\n );\n return () => clearTimeout(timer);\n }, [ctx.preset.transition, onComplete, transition]);\n\n if (!transition?.to) {\n return null;\n }\n\n return (\n <m.div\n animate={rectTarget(transition.to)}\n aria-hidden=\"true\"\n data-slot=\"aperto-transition-media\"\n initial={rectTarget(transition.from)}\n style={{\n borderRadius: \"var(--aperto-radius, 0.5rem)\",\n overflow: \"hidden\",\n pointerEvents: \"none\",\n position: \"fixed\",\n zIndex: 30,\n }}\n transition={ctx.preset.transition}\n >\n <ApertoTransitionMedia\n item={transition.item}\n renderImage={renderImage}\n renderVideo={renderVideo}\n />\n </m.div>\n );\n}\n","import type { TargetAndTransition, Transition } from \"motion/react\";\n\nexport interface ApertoRect {\n height: number;\n left: number;\n top: number;\n width: number;\n}\n\nexport interface ApertoMediaTransition {\n from: ApertoRect;\n item: import(\"./types\").ApertoMediaItem;\n phase: \"opening\" | \"closing\";\n to?: ApertoRect;\n}\n\nexport function rectFromElement(element: Element | null): ApertoRect | null {\n if (!element) {\n return null;\n }\n\n const rect = element.getBoundingClientRect();\n return {\n height: rect.height,\n left: rect.left,\n top: rect.top,\n width: rect.width,\n };\n}\n\nexport function rectTarget(rect: ApertoRect): TargetAndTransition {\n return {\n height: rect.height,\n left: rect.left,\n top: rect.top,\n width: rect.width,\n };\n}\n\nexport function transitionDurationMs(transition: Transition): number {\n return typeof transition.duration === \"number\"\n ? transition.duration * 1000\n : 450;\n}\n","import type { NavigationDirection } from \"../expanded-media-stage\";\nimport type {\n ApertoMediaTransition,\n ApertoRect,\n} from \"../media-transition-utils\";\n\nexport interface ApertoGroupState {\n closing: boolean;\n internalIndex: number;\n layoutSourceIndex: number;\n mediaTransition: ApertoMediaTransition | null;\n navigationDirection: NavigationDirection;\n open: boolean;\n}\n\nexport type ApertoGroupAction =\n | { type: \"close-without-transition\" }\n | { type: \"complete-opening-target\"; rect: ApertoRect }\n | { type: \"finish-transition\" }\n | { type: \"navigate\"; direction: NavigationDirection; index: number }\n | {\n type: \"open-at-index\";\n index: number;\n transition: ApertoMediaTransition | null;\n }\n | { type: \"set-index\"; index: number }\n | { type: \"set-open\"; open: boolean }\n | { type: \"start-close\"; transition: ApertoMediaTransition };\n\nexport function getInitialGroupState(initialIndex: number): ApertoGroupState {\n return {\n closing: false,\n internalIndex: initialIndex,\n layoutSourceIndex: initialIndex,\n mediaTransition: null,\n navigationDirection: 0,\n open: false,\n };\n}\n\nexport function apertoGroupReducer(\n state: ApertoGroupState,\n action: ApertoGroupAction,\n): ApertoGroupState {\n switch (action.type) {\n case \"close-without-transition\":\n return { ...state, closing: false, mediaTransition: null, open: false };\n case \"complete-opening-target\":\n if (\n state.mediaTransition?.phase !== \"opening\" ||\n state.mediaTransition.to\n ) {\n return state;\n }\n return {\n ...state,\n mediaTransition: { ...state.mediaTransition, to: action.rect },\n };\n case \"finish-transition\":\n return {\n ...state,\n closing: false,\n mediaTransition: null,\n open: state.mediaTransition?.phase === \"closing\" ? false : state.open,\n };\n case \"navigate\":\n return {\n ...state,\n internalIndex: action.index,\n layoutSourceIndex: action.index,\n navigationDirection: action.direction,\n };\n case \"open-at-index\":\n return {\n ...state,\n closing: false,\n internalIndex: action.index,\n layoutSourceIndex: action.index,\n mediaTransition: action.transition,\n navigationDirection: 0,\n open: true,\n };\n case \"set-index\":\n return { ...state, internalIndex: action.index };\n case \"set-open\":\n return action.open\n ? { ...state, closing: false, open: true }\n : { ...state, open: false };\n case \"start-close\":\n return {\n ...state,\n closing: true,\n mediaTransition: action.transition,\n };\n }\n}\n","export function shouldIgnoreKeyboardNavigationTarget(\n target: EventTarget | null,\n): boolean {\n if (!(target instanceof Element)) {\n return false;\n }\n\n return (\n (target as HTMLElement).isContentEditable ||\n Boolean(\n target.closest(\n 'input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"textbox\"], audio, video',\n ),\n )\n );\n}\n","\"use client\";\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport { X } from \"lucide-react\";\nimport { type ComponentPropsWithoutRef, forwardRef } from \"react\";\n\nconst ApertoClose = forwardRef<\n HTMLButtonElement,\n ComponentPropsWithoutRef<typeof Dialog.Close>\n>(({ children, ...props }, ref) => {\n return (\n <Dialog.Close data-slot=\"aperto-close\" ref={ref} {...props}>\n {children ?? <X aria-hidden=\"true\" size={17} strokeWidth={2} />}\n </Dialog.Close>\n );\n});\n\nApertoClose.displayName = \"ApertoClose\";\n\nexport { ApertoClose };\n","\"use client\";\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport { m } from \"motion/react\";\nimport { type ComponentPropsWithoutRef, forwardRef } from \"react\";\n\nimport { useApertoContext } from \"./context\";\nimport { resolvePreset } from \"./presets\";\nimport type { MotionPresetName } from \"./types\";\n\nconst TRIGGER_OPEN_Z_INDEX = 1000;\n\nexport interface ApertoTriggerProps\n extends ComponentPropsWithoutRef<typeof Dialog.Trigger> {\n /** Internal flag used by grouped thumbnails to raise only the active trigger. */\n active?: boolean;\n /** Override motion preset for this trigger */\n motion?: MotionPresetName;\n /** Internal shared layout ID override for grouped thumbnails. */\n sharedLayoutId?: string | false;\n}\n\nconst ApertoTrigger = forwardRef<HTMLButtonElement, ApertoTriggerProps>(\n (\n { active, children, motion: motionOverride, sharedLayoutId, ...props },\n ref,\n ) => {\n const ctx = useApertoContext();\n const shouldRaise = ctx.open && (active ?? true);\n const zIndex = shouldRaise ? TRIGGER_OPEN_Z_INDEX : 0;\n\n const resolved = resolvePreset(\n \"trigger\",\n motionOverride,\n ctx.presetName,\n ctx.variants,\n ctx.reduceMotion,\n );\n const layoutId =\n sharedLayoutId === false\n ? undefined\n : (sharedLayoutId ?? `${ctx.layoutId}-shared`);\n\n return (\n <Dialog.Trigger asChild ref={ref} {...props}>\n <m.button\n data-aperto-active={shouldRaise ? \"\" : undefined}\n data-slot=\"aperto-trigger\"\n key={layoutId ?? \"unshared\"}\n layout\n layoutCrossfade={false}\n layoutId={layoutId}\n style={{ zIndex }}\n transition={resolved.transition}\n type=\"button\"\n >\n {children}\n </m.button>\n </Dialog.Trigger>\n );\n },\n);\n\nApertoTrigger.displayName = \"ApertoTrigger\";\n\nexport { ApertoTrigger };\n","\"use client\";\n\nimport { ApertoClose } from \"../aperto-close\";\nimport { ApertoContent } from \"../aperto-content\";\nimport { ApertoDescription } from \"../aperto-description\";\nimport { ApertoOverlay } from \"../aperto-overlay\";\nimport { ApertoPortal } from \"../aperto-portal\";\nimport { ApertoRoot } from \"../aperto-root\";\nimport { ApertoTitle } from \"../aperto-title\";\nimport { ApertoTrigger } from \"../aperto-trigger\";\nimport { ApertoExpandedMedia, ApertoThumbnailMedia } from \"../media-rendering\";\nimport { getDescriptionProps, getMediaLabel } from \"../media-utils\";\nimport type { ApertoProps } from \"./ApertoTypes\";\n\nexport function ApertoSingle({\n classNames,\n dismissible,\n media,\n renderImage,\n renderVideo,\n}: ApertoProps) {\n const label = getMediaLabel(media);\n const title = media.title ?? label;\n\n return (\n <ApertoRoot dismissible={dismissible}>\n <ApertoTrigger\n aria-label={`Open ${label}`}\n className={classNames?.thumbnail}\n >\n <ApertoThumbnailMedia\n item={media}\n renderImage={renderImage}\n renderVideo={renderVideo}\n />\n </ApertoTrigger>\n <ApertoPortal>\n <ApertoOverlay className={classNames?.overlay} />\n <ApertoContent\n className={classNames?.content}\n {...getDescriptionProps(media)}\n >\n <ApertoExpandedMedia\n item={media}\n renderImage={renderImage}\n renderVideo={renderVideo}\n />\n <ApertoTitle>{title}</ApertoTitle>\n {media.description ? (\n <ApertoDescription>{media.description}</ApertoDescription>\n ) : null}\n <ApertoClose\n aria-label=\"Close\"\n className={classNames?.closeButton}\n type=\"button\"\n />\n </ApertoContent>\n </ApertoPortal>\n </ApertoRoot>\n );\n}\n","\"use client\";\n\nimport { useApertoGroup } from \"../aperto-group-context\";\nimport { ApertoTrigger } from \"../aperto-trigger\";\nimport { ApertoThumbnailMedia } from \"../media-rendering\";\nimport { getMediaLabel } from \"../media-utils\";\nimport type { ApertoThumbnailProps } from \"./ApertoTypes\";\n\nexport function ApertoThumbnail({\n children,\n className,\n index,\n}: ApertoThumbnailProps) {\n const group = useApertoGroup();\n const media = group.media[index];\n\n if (!media) {\n return null;\n }\n\n return (\n <ApertoTrigger\n active={group.index === index}\n aria-label={`Open ${getMediaLabel(media)}`}\n className={className ?? group.classNames?.thumbnail}\n onClick={() => group.openAtIndex(index)}\n ref={(node) => group.registerThumbnail(index, node)}\n sharedLayoutId={false}\n >\n {children ?? (\n <ApertoThumbnailMedia\n item={media}\n renderImage={group.renderImage}\n renderVideo={group.renderVideo}\n />\n )}\n </ApertoTrigger>\n );\n}\n","\"use client\";\n\n/**\n * @patternmode/aperto\n *\n * Opinionated thumbnail-to-expanded media transitions.\n * Built on Radix Dialog + Motion.\n *\n * Inspired by Cambio (https://github.com/raphaelsalaja/cambio)\n * by Raphael Salaja.\n *\n * @example\n * ```tsx\n * import { Aperto } from \"@patternmode/aperto\";\n *\n * import { Aperto } from \"@patternmode/aperto\";\n * import \"@patternmode/aperto/styles.css\";\n *\n * <Aperto.Group media={media}>\n * {media.map((item, index) => (\n * <Aperto.Thumbnail key={item.id ?? item.src} index={index} />\n * ))}\n * </Aperto.Group>\n * ```\n */\n\nimport {\n ApertoGroup,\n type ApertoGroupProps,\n type ApertoProps,\n ApertoSingle,\n ApertoThumbnail,\n type ApertoThumbnailProps,\n} from \"./aperto\";\nimport { ApertoClose } from \"./aperto-close\";\nimport { ApertoContent, type ApertoContentProps } from \"./aperto-content\";\nimport { ApertoDescription } from \"./aperto-description\";\nimport { ApertoOverlay, type ApertoOverlayProps } from \"./aperto-overlay\";\nimport { ApertoPortal, type ApertoPortalProps } from \"./aperto-portal\";\nimport { ApertoRoot, type ApertoRootProps } from \"./aperto-root\";\nimport { ApertoTitle } from \"./aperto-title\";\nimport { ApertoTrigger, type ApertoTriggerProps } from \"./aperto-trigger\";\n\n/** Lower-level compound component namespace for advanced composition. */\nconst ApertoPrimitive = {\n Close: ApertoClose,\n Content: ApertoContent,\n Description: ApertoDescription,\n Overlay: ApertoOverlay,\n Portal: ApertoPortal,\n Root: ApertoRoot,\n Title: ApertoTitle,\n Trigger: ApertoTrigger,\n};\n\n/** Primary media-first component namespace. */\nconst Aperto = Object.assign(ApertoSingle, {\n Group: ApertoGroup,\n Primitive: ApertoPrimitive,\n Thumbnail: ApertoThumbnail,\n});\n\n// Preset system\nexport { PRESETS, resolvePreset } from \"./presets\";\n// Types\nexport type {\n ApertoClassNames,\n ApertoImageItem,\n ApertoMediaItem,\n ApertoVideoItem,\n DismissibleConfig,\n DragSpringConfig,\n MotionPreset,\n MotionPresetName,\n MotionProp,\n MotionVariants,\n NavigationMotionPresetName,\n RenderImage,\n RenderVideo,\n} from \"./types\";\n// Named exports for tree-shaking\nexport {\n Aperto,\n ApertoClose,\n ApertoContent,\n type ApertoContentProps,\n ApertoDescription,\n ApertoGroup,\n type ApertoGroupProps,\n ApertoOverlay,\n type ApertoOverlayProps,\n ApertoPortal,\n type ApertoPortalProps,\n ApertoPrimitive,\n type ApertoProps,\n ApertoRoot,\n type ApertoRootProps,\n ApertoThumbnail,\n type ApertoThumbnailProps,\n ApertoTitle,\n ApertoTrigger,\n type ApertoTriggerProps,\n};\n"],"mappings":";;;AAEA,SAAS,aAAa,cAAc,SAAS;AAC7C;AAAA,EAGE,eAAAA;AAAA,EACA,SAAAC;AAAA,EACA;AAAA,EACA,WAAAC;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACVP,YAAY,YAAY;AACxB;AAAA,EAEE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACfP,SAAS,eAAe,kBAAkB;AAGnC,IAAM,gBAAgB,cAAyC,IAAI;AAEnE,SAAS,mBAAuC;AACrD,QAAM,MAAM,WAAW,aAAa;AACpC,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,qDAAqD;AAAA,EACvE;AACA,SAAO;AACT;;;ACJA,IAAM,qBAAqB;AAC3B,IA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gBAAgB;AAAA,MAEf,sBACC,gBAAAA;AAAA,QAAC;AAAA;AAAA,UACC,MAAM;AAAA,UACN,aAAa,MAAM;AAAA,UACnB,aAAa,MAAM;AAAA;AAAA,MACrB;AAAA;AAAA,EAEJ;AAEJ;;;ACMA,IAAM,kBAAkB;AAAA,EACtB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,aAAa;AAAA,EACb,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AACX;AAGA,IAAM,SAAS,OAAO,OAAO,cAAc;AAAA,EACzC,OAAO;AAAA,EACP,WAAW;AAAA,EACX,WAAW;AACb,CAAC;","names":["useCallback","useId","useMemo","Dialog","forwardRef","jsx","createContext","useContext","Dialog","m","forwardRef","jsx","forwardRef","m","Dialog","jsx","Dialog","useCallback","useMemo","useState","jsx","useState","useCallback","useMemo","Dialog","forwardRef","jsx","AnimatePresence","m","jsx","jsx","AnimatePresence","m","m","jsx","m","jsx","useId","useCallback","useMemo","Dialog","X","forwardRef","jsx","Dialog","m","forwardRef","jsx","forwardRef","m","jsx","jsxs","jsx"]}
|
package/dist/styles.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
|
2
|
-
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial;--tw-ease:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-leading:initial;--tw-font-weight:initial;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0}}}[data-slot=aperto-trigger]{border-radius:var(--aperto-radius,.5rem);border-style:var(--tw-border-style);padding:calc(var(--spacing,.25rem) * 0);text-align:left;--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);--tw-outline-style:none;cursor:zoom-in;transition-property:filter,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function,cubic-bezier(.4, 0, .2, 1)));transition-duration:var(--tw-duration,var(--default-transition-duration,.15s));--tw-duration:.2s;--tw-ease:var(--ease-out,cubic-bezier(0, 0, .2, 1));transition-duration:.2s;transition-timing-function:var(--ease-out,cubic-bezier(0, 0, .2, 1));background-color:#0000;border-width:0;outline-style:none;display:block;position:relative;overflow:hidden}[data-slot=aperto-trigger]:hover{--tw-brightness:brightness(.96);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}[data-slot=aperto-trigger]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);--tw-ring-color:#fffc}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-trigger]:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-white,#fff) 80%, transparent)}}[data-slot=aperto-trigger]:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-offset-color:var(--color-black,#000)}[data-slot=aperto-trigger]>img,[data-slot=aperto-trigger]>video{object-fit:cover;width:100%;height:100%;display:block}[data-slot=aperto-trigger][data-aperto-active]>img,[data-slot=aperto-trigger][data-aperto-active]>video{visibility:hidden}[data-slot=aperto-overlay]{inset:calc(var(--spacing,.25rem) * 0);z-index:1000;background-color:#000c;position:fixed}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-overlay]{background-color:color-mix(in oklab, var(--color-black,#000) 80%, transparent)}}[data-slot=aperto-content]{z-index:1001;justify-content:center;align-items:center;gap:calc(var(--spacing,.25rem) * 3);border-radius:var(--aperto-radius,.5rem);width:fit-content;max-width:min(92vw,1200px);height:fit-content;max-height:min(90vh,920px);padding:calc(var(--spacing,.25rem) * 0);color:var(--color-white,#fff);--tw-outline-style:none;overscroll-behavior:contain;outline-style:none;flex-direction:column;display:flex;position:fixed;overflow:visible}[data-slot=aperto-content]>img,[data-slot=aperto-content]>video,[data-slot=aperto-content]>[data-slot=aperto-media]{border-radius:var(--aperto-radius,.5rem);object-fit:cover;aspect-ratio:var(--aperto-expanded-aspect-ratio,3 / 2);max-width:90vw;height:auto;max-height:calc(100dvh - 8rem);width:min(var(--aperto-expanded-width,76vw), calc((100dvh - 8rem) * 1.5), 1000px, 90vw);display:block}[data-slot=aperto-media]{position:relative;overflow:hidden}[data-slot=aperto-media]>img,[data-slot=aperto-media]>video,[data-slot=aperto-media-stage]>img,[data-slot=aperto-media-stage]>video,[data-slot=aperto-transition-media]>img,[data-slot=aperto-transition-media]>video{object-fit:cover;width:100%;height:100%;display:block}[data-slot=aperto-media-stage]{inset:calc(var(--spacing,.25rem) * 0);position:absolute}[data-slot=aperto-content][data-aperto-transition] [data-slot=aperto-media-stage],[data-slot=aperto-transition-media]{will-change:opacity, transform}[data-slot=aperto-content][data-aperto-transition]>*{opacity:0}@keyframes aperto-control-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}[data-slot=aperto-content]:not([data-aperto-transition])>[data-slot=aperto-close],[data-slot=aperto-content]:not([data-aperto-transition])>[data-slot=aperto-media]>[data-slot=aperto-previous-button],[data-slot=aperto-content]:not([data-aperto-transition])>[data-slot=aperto-media]>[data-slot=aperto-next-button]{animation:.35s cubic-bezier(.25,.1,.12,1) 80ms both aperto-control-in}[data-slot=aperto-content]:not([data-aperto-transition])>[data-slot=aperto-title],[data-slot=aperto-content]:not([data-aperto-transition])>[data-slot=aperto-description],[data-slot=aperto-content]:not([data-aperto-transition])>[data-slot=aperto-counter]{animation:.4s cubic-bezier(.25,.1,.12,1) .18s both aperto-control-in}[data-slot=aperto-title]{text-align:center;--tw-leading:var(--leading-snug,1.375);max-width:60ch;font-size:13px;line-height:var(--leading-snug,1.375);--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500);color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-title]{color:color-mix(in oklab, var(--color-white,#fff) 90%, transparent)}}[data-slot=aperto-description]{margin-top:calc(var(--spacing,.25rem) * -1.5);text-align:center;--tw-leading:var(--leading-snug,1.375);max-width:60ch;font-size:13px;line-height:var(--leading-snug,1.375);color:#fff9}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-description]{color:color-mix(in oklab, var(--color-white,#fff) 60%, transparent)}}[data-slot=aperto-close],[data-slot=aperto-previous-button],[data-slot=aperto-next-button]{z-index:10;width:calc(var(--spacing,.25rem) * 8);height:calc(var(--spacing,.25rem) * 8);border-style:var(--tw-border-style);background-color:#ffffff1a;border-width:0;border-radius:3.40282e38px;place-items:center;display:grid;position:absolute}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-close],[data-slot=aperto-previous-button],[data-slot=aperto-next-button]{background-color:color-mix(in oklab, var(--color-white,#fff) 10%, transparent)}}[data-slot=aperto-close],[data-slot=aperto-previous-button],[data-slot=aperto-next-button]{color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-close],[data-slot=aperto-previous-button],[data-slot=aperto-next-button]{color:color-mix(in oklab, var(--color-white,#fff) 70%, transparent)}}[data-slot=aperto-close],[data-slot=aperto-previous-button],[data-slot=aperto-next-button]{transition-property:background,color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function,cubic-bezier(.4, 0, .2, 1)));transition-duration:var(--tw-duration,var(--default-transition-duration,.15s));--tw-duration:.15s;--tw-ease:var(--ease-out,cubic-bezier(0, 0, .2, 1));transition-duration:.15s;transition-timing-function:var(--ease-out,cubic-bezier(0, 0, .2, 1))}@media (hover:hover) and (pointer:fine){[data-slot=aperto-close]:hover,[data-slot=aperto-previous-button]:hover,[data-slot=aperto-next-button]:hover{background-color:#fff3}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-close]:hover,[data-slot=aperto-previous-button]:hover,[data-slot=aperto-next-button]:hover{background-color:color-mix(in oklab, var(--color-white,#fff) 20%, transparent)}}[data-slot=aperto-close]:hover,[data-slot=aperto-previous-button]:hover,[data-slot=aperto-next-button]:hover{color:var(--color-white,#fff)}}[data-slot=aperto-close]:focus-visible,[data-slot=aperto-previous-button]:focus-visible,[data-slot=aperto-next-button]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);--tw-ring-color:#fff9}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-close]:focus-visible,[data-slot=aperto-previous-button]:focus-visible,[data-slot=aperto-next-button]:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-white,#fff) 60%, transparent)}}[data-slot=aperto-close]:focus-visible,[data-slot=aperto-previous-button]:focus-visible,[data-slot=aperto-next-button]:focus-visible{--tw-outline-style:none;outline-style:none}[data-slot=aperto-close]{top:calc(var(--spacing,.25rem) * 3);right:calc(var(--spacing,.25rem) * 3)}[data-slot=aperto-previous-button]{top:50%;left:calc(var(--spacing,.25rem) * 3);--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}[data-slot=aperto-next-button]{top:50%;right:calc(var(--spacing,.25rem) * 3);--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}[data-slot=aperto-close]>svg,[data-slot=aperto-previous-button]>svg,[data-slot=aperto-next-button]>svg{pointer-events:none;width:calc(var(--spacing,.25rem) * 4);height:calc(var(--spacing,.25rem) * 4)}[data-slot=aperto-counter]{background-color:#ffffff1a;border-radius:3.40282e38px}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-counter]{background-color:color-mix(in oklab, var(--color-white,#fff) 10%, transparent)}}[data-slot=aperto-counter]{padding-inline:calc(var(--spacing,.25rem) * 2.5);padding-block:calc(var(--spacing,.25rem) * .5);--tw-font-weight:var(--font-weight-medium,500);font-size:11px;font-weight:var(--font-weight-medium,500);color:#ffffff80}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-counter]{color:color-mix(in oklab, var(--color-white,#fff) 50%, transparent)}}@media (max-width:560px){[data-slot=aperto-content]{gap:calc(var(--spacing,.25rem) * 2);max-width:calc(100vw - 1rem)}[data-slot=aperto-content]>img,[data-slot=aperto-content]>video,[data-slot=aperto-content]>[data-slot=aperto-media]{width:min(100vw - 2rem,150dvh - 18rem);max-width:calc(100vw - 2rem);max-height:calc(100dvh - 12rem)}[data-slot=aperto-title],[data-slot=aperto-description]{max-width:calc(100vw - 2rem)}[data-slot=aperto-close],[data-slot=aperto-previous-button],[data-slot=aperto-next-button]{width:calc(var(--spacing,.25rem) * 11);height:calc(var(--spacing,.25rem) * 11);touch-action:manipulation}[data-slot=aperto-close]{top:calc(var(--spacing,.25rem) * 2);right:calc(var(--spacing,.25rem) * 2)}[data-slot=aperto-previous-button]{left:calc(var(--spacing,.25rem) * 2)}[data-slot=aperto-next-button]{right:calc(var(--spacing,.25rem) * 2)}}@media (prefers-reduced-motion:reduce){[data-slot=aperto-content]:not([data-aperto-transition])>*{animation:none!important}}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}
|
|
2
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial;--tw-ease:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-leading:initial;--tw-font-weight:initial;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0}}}[data-slot=aperto-trigger]{border-radius:var(--aperto-radius,.5rem);border-style:var(--tw-border-style);padding:calc(var(--spacing,.25rem) * 0);text-align:left;--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);--tw-outline-style:none;cursor:zoom-in;transition-property:filter,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function,cubic-bezier(.4, 0, .2, 1)));transition-duration:var(--tw-duration,var(--default-transition-duration,.15s));--tw-duration:.2s;--tw-ease:var(--ease-out,cubic-bezier(0, 0, .2, 1));transition-duration:.2s;transition-timing-function:var(--ease-out,cubic-bezier(0, 0, .2, 1));background-color:#0000;border-width:0;outline-style:none;display:block;position:relative;overflow:hidden}[data-slot=aperto-trigger]:hover{--tw-brightness:brightness(.96);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}[data-slot=aperto-trigger]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);--tw-ring-color:#fffc}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-trigger]:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-white,#fff) 80%, transparent)}}[data-slot=aperto-trigger]:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-offset-color:var(--color-black,#000)}[data-slot=aperto-trigger]>img,[data-slot=aperto-trigger]>video{object-fit:cover;width:100%;height:100%;display:block}[data-slot=aperto-trigger][data-aperto-active]>img,[data-slot=aperto-trigger][data-aperto-active]>video{visibility:hidden}[data-slot=aperto-overlay]{inset:calc(var(--spacing,.25rem) * 0);z-index:1000;background-color:#000c;position:fixed}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-overlay]{background-color:color-mix(in oklab, var(--color-black,#000) 80%, transparent)}}[data-slot=aperto-content]{z-index:1001;justify-content:center;align-items:center;gap:calc(var(--spacing,.25rem) * 3);border-radius:var(--aperto-radius,.5rem);width:fit-content;max-width:min(92vw,1200px);height:fit-content;max-height:min(90vh,920px);padding:calc(var(--spacing,.25rem) * 0);color:var(--color-white,#fff);--tw-outline-style:none;overscroll-behavior:contain;outline-style:none;flex-direction:column;display:flex;position:fixed;overflow:visible}[data-slot=aperto-content]>img,[data-slot=aperto-content]>video,[data-slot=aperto-content]>[data-slot=aperto-media]{border-radius:var(--aperto-radius,.5rem);aspect-ratio:var(--aperto-expanded-aspect-ratio,3 / 2);max-width:90vw;height:auto;max-height:calc(100dvh - 8rem);width:min(var(--aperto-expanded-width,76vw), calc((100dvh - 8rem) * ( var(--aperto-expanded-aspect-ratio-width,3) / var(--aperto-expanded-aspect-ratio-height,2) )), 1000px, 90vw);display:block}[data-slot=aperto-media]{position:relative;overflow:hidden}[data-slot=aperto-media]>img,[data-slot=aperto-media]>video,[data-slot=aperto-media-stage]>img,[data-slot=aperto-media-stage]>video,[data-slot=aperto-transition-media]>img,[data-slot=aperto-transition-media]>video{width:100%;height:100%;display:block}[data-slot=aperto-media-stage]{inset:calc(var(--spacing,.25rem) * 0);position:absolute}[data-slot=aperto-content][data-aperto-transition] [data-slot=aperto-media-stage],[data-slot=aperto-transition-media]{will-change:opacity, transform}[data-slot=aperto-content][data-aperto-transition]>*{opacity:0}@keyframes aperto-control-in{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}[data-slot=aperto-content]:not([data-aperto-transition])>[data-slot=aperto-close],[data-slot=aperto-content]:not([data-aperto-transition])>[data-slot=aperto-media]>[data-slot=aperto-previous-button],[data-slot=aperto-content]:not([data-aperto-transition])>[data-slot=aperto-media]>[data-slot=aperto-next-button]{animation:.35s cubic-bezier(.25,.1,.12,1) 80ms both aperto-control-in}[data-slot=aperto-content]:not([data-aperto-transition])>[data-slot=aperto-title],[data-slot=aperto-content]:not([data-aperto-transition])>[data-slot=aperto-description],[data-slot=aperto-content]:not([data-aperto-transition])>[data-slot=aperto-counter]{animation:.4s cubic-bezier(.25,.1,.12,1) .18s both aperto-control-in}[data-slot=aperto-title]{text-align:center;--tw-leading:var(--leading-snug,1.375);max-width:60ch;font-size:13px;line-height:var(--leading-snug,1.375);--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500);color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-title]{color:color-mix(in oklab, var(--color-white,#fff) 90%, transparent)}}[data-slot=aperto-description]{margin-top:calc(var(--spacing,.25rem) * -1.5);text-align:center;--tw-leading:var(--leading-snug,1.375);max-width:60ch;font-size:13px;line-height:var(--leading-snug,1.375);color:#fff9}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-description]{color:color-mix(in oklab, var(--color-white,#fff) 60%, transparent)}}[data-slot=aperto-close],[data-slot=aperto-previous-button],[data-slot=aperto-next-button]{z-index:10;width:calc(var(--spacing,.25rem) * 8);height:calc(var(--spacing,.25rem) * 8);border-style:var(--tw-border-style);background-color:#ffffff1a;border-width:0;border-radius:3.40282e38px;place-items:center;display:grid;position:absolute}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-close],[data-slot=aperto-previous-button],[data-slot=aperto-next-button]{background-color:color-mix(in oklab, var(--color-white,#fff) 10%, transparent)}}[data-slot=aperto-close],[data-slot=aperto-previous-button],[data-slot=aperto-next-button]{color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-close],[data-slot=aperto-previous-button],[data-slot=aperto-next-button]{color:color-mix(in oklab, var(--color-white,#fff) 70%, transparent)}}[data-slot=aperto-close],[data-slot=aperto-previous-button],[data-slot=aperto-next-button]{transition-property:background,color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function,cubic-bezier(.4, 0, .2, 1)));transition-duration:var(--tw-duration,var(--default-transition-duration,.15s));--tw-duration:.15s;--tw-ease:var(--ease-out,cubic-bezier(0, 0, .2, 1));transition-duration:.15s;transition-timing-function:var(--ease-out,cubic-bezier(0, 0, .2, 1))}@media (hover:hover) and (pointer:fine){[data-slot=aperto-close]:hover,[data-slot=aperto-previous-button]:hover,[data-slot=aperto-next-button]:hover{background-color:#fff3}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-close]:hover,[data-slot=aperto-previous-button]:hover,[data-slot=aperto-next-button]:hover{background-color:color-mix(in oklab, var(--color-white,#fff) 20%, transparent)}}[data-slot=aperto-close]:hover,[data-slot=aperto-previous-button]:hover,[data-slot=aperto-next-button]:hover{color:var(--color-white,#fff)}}[data-slot=aperto-close]:focus-visible,[data-slot=aperto-previous-button]:focus-visible,[data-slot=aperto-next-button]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);--tw-ring-color:#fff9}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-close]:focus-visible,[data-slot=aperto-previous-button]:focus-visible,[data-slot=aperto-next-button]:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-white,#fff) 60%, transparent)}}[data-slot=aperto-close]:focus-visible,[data-slot=aperto-previous-button]:focus-visible,[data-slot=aperto-next-button]:focus-visible{--tw-outline-style:none;outline-style:none}[data-slot=aperto-close]{top:calc(var(--spacing,.25rem) * 3);right:calc(var(--spacing,.25rem) * 3)}[data-slot=aperto-previous-button]{top:50%;left:calc(var(--spacing,.25rem) * 3);--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}[data-slot=aperto-next-button]{top:50%;right:calc(var(--spacing,.25rem) * 3);--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}[data-slot=aperto-close]>svg,[data-slot=aperto-previous-button]>svg,[data-slot=aperto-next-button]>svg{pointer-events:none;width:calc(var(--spacing,.25rem) * 4);height:calc(var(--spacing,.25rem) * 4)}[data-slot=aperto-counter]{background-color:#ffffff1a;border-radius:3.40282e38px}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-counter]{background-color:color-mix(in oklab, var(--color-white,#fff) 10%, transparent)}}[data-slot=aperto-counter]{padding-inline:calc(var(--spacing,.25rem) * 2.5);padding-block:calc(var(--spacing,.25rem) * .5);--tw-font-weight:var(--font-weight-medium,500);font-size:11px;font-weight:var(--font-weight-medium,500);color:#ffffff80}@supports (color:color-mix(in lab, red, red)){[data-slot=aperto-counter]{color:color-mix(in oklab, var(--color-white,#fff) 50%, transparent)}}@media (max-width:560px){[data-slot=aperto-content]{gap:calc(var(--spacing,.25rem) * 2);max-width:calc(100vw - 1rem)}[data-slot=aperto-content]>img,[data-slot=aperto-content]>video,[data-slot=aperto-content]>[data-slot=aperto-media]{width:min(100vw - 2rem,150dvh - 18rem);max-width:calc(100vw - 2rem);max-height:calc(100dvh - 12rem)}[data-slot=aperto-title],[data-slot=aperto-description]{max-width:calc(100vw - 2rem)}[data-slot=aperto-close],[data-slot=aperto-previous-button],[data-slot=aperto-next-button]{width:calc(var(--spacing,.25rem) * 11);height:calc(var(--spacing,.25rem) * 11);touch-action:manipulation}[data-slot=aperto-close]{top:calc(var(--spacing,.25rem) * 2);right:calc(var(--spacing,.25rem) * 2)}[data-slot=aperto-previous-button]{left:calc(var(--spacing,.25rem) * 2)}[data-slot=aperto-next-button]{right:calc(var(--spacing,.25rem) * 2)}}@media (prefers-reduced-motion:reduce){[data-slot=aperto-content]:not([data-aperto-transition])>*{animation:none!important}}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternmode/aperto",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Opinionated, styled thumbnail-to-expanded media transitions for React.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -38,19 +38,22 @@
|
|
|
38
38
|
"motion": "^12.38.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
+
"@howells/lint": "^0.1.8",
|
|
41
42
|
"@howells/typescript-config": "^0.1.2",
|
|
42
43
|
"@tailwindcss/cli": "^4.3.0",
|
|
43
44
|
"@testing-library/jest-dom": "^6.9.1",
|
|
44
45
|
"@testing-library/react": "^16.3.2",
|
|
45
46
|
"@testing-library/user-event": "^14.6.1",
|
|
46
|
-
"@types/react": "^19.2.
|
|
47
|
-
"@types/react-dom": "^19.2.
|
|
47
|
+
"@types/react": "^19.2.14",
|
|
48
|
+
"@types/react-dom": "^19.2.3",
|
|
48
49
|
"concurrently": "^9.2.1",
|
|
49
50
|
"jsdom": "^29.1.1",
|
|
51
|
+
"react": "^19.2.3",
|
|
52
|
+
"react-dom": "^19.2.3",
|
|
50
53
|
"tailwindcss": "^4.3.0",
|
|
51
54
|
"tsup": "^8.5.1",
|
|
52
55
|
"typescript": "^6.0.3",
|
|
53
|
-
"vitest": "^4.
|
|
56
|
+
"vitest": "^4.1.6"
|
|
54
57
|
},
|
|
55
58
|
"peerDependencies": {
|
|
56
59
|
"react": ">=18.2.0 <20",
|
|
@@ -62,8 +65,9 @@
|
|
|
62
65
|
"dev": "concurrently \"pnpm dev:js\" \"pnpm dev:styles\"",
|
|
63
66
|
"dev:js": "tsup --watch",
|
|
64
67
|
"dev:styles": "tailwindcss -i styles.css -o dist/styles.css --watch",
|
|
65
|
-
"lint": "howells-
|
|
66
|
-
"lint:
|
|
68
|
+
"lint": "howells-lint .",
|
|
69
|
+
"lint:fix": "howells-format .",
|
|
70
|
+
"lint:strict": "howells-lint-strict .",
|
|
67
71
|
"test": "vitest run --passWithNoTests",
|
|
68
72
|
"typecheck": "tsc --noEmit"
|
|
69
73
|
}
|