@astryxdesign/core 0.7.16-canary.ge95b87c → 0.7.16

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.
Files changed (183) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
  3. package/dist/BottomSheet/BottomSheet.js +38 -88
  4. package/dist/BottomSheet/BottomSheetPanel.d.ts +14 -6
  5. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
  6. package/dist/BottomSheet/BottomSheetPanel.js +26 -14
  7. package/dist/Button/Button.d.ts.map +1 -1
  8. package/dist/Button/Button.js +78 -3
  9. package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
  10. package/dist/Chat/ChatComposerInput.js +1 -1
  11. package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
  12. package/dist/ContextMenu/ContextMenu.js +3 -0
  13. package/dist/DateInput/DateInput.d.ts +24 -0
  14. package/dist/DateInput/DateInput.d.ts.map +1 -1
  15. package/dist/DateInput/DateInput.js +12 -5
  16. package/dist/DateInput/index.d.ts +1 -1
  17. package/dist/DateInput/index.d.ts.map +1 -1
  18. package/dist/DateInput/useTypedDate.d.ts +12 -5
  19. package/dist/DateInput/useTypedDate.d.ts.map +1 -1
  20. package/dist/DateInput/useTypedDate.js +18 -16
  21. package/dist/DateTimeInput/DateTimeInput.d.ts +25 -0
  22. package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
  23. package/dist/DateTimeInput/DateTimeInput.js +10 -3
  24. package/dist/DateTimeInput/NativeTimeSegment.d.ts +3 -1
  25. package/dist/DateTimeInput/NativeTimeSegment.d.ts.map +1 -1
  26. package/dist/DateTimeInput/NativeTimeSegment.js +10 -1
  27. package/dist/DateTimeInput/index.d.ts +1 -1
  28. package/dist/DateTimeInput/index.d.ts.map +1 -1
  29. package/dist/Dialog/Dialog.d.ts.map +1 -1
  30. package/dist/Dialog/Dialog.js +3 -2
  31. package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
  32. package/dist/DropdownMenu/DropdownMenuSubMenu.js +3 -0
  33. package/dist/Field/useEntryErrorBehavior.d.ts +8 -0
  34. package/dist/Field/useEntryErrorBehavior.d.ts.map +1 -0
  35. package/dist/Field/useEntryErrorBehavior.js +30 -0
  36. package/dist/FormLayout/FormLayout.d.ts +21 -2
  37. package/dist/FormLayout/FormLayout.d.ts.map +1 -1
  38. package/dist/FormLayout/FormLayout.js +5 -2
  39. package/dist/FormLayout/FormLayoutContext.d.ts +18 -2
  40. package/dist/FormLayout/FormLayoutContext.d.ts.map +1 -1
  41. package/dist/FormLayout/FormLayoutContext.js +22 -4
  42. package/dist/FormLayout/index.d.ts +1 -1
  43. package/dist/FormLayout/index.d.ts.map +1 -1
  44. package/dist/Layer/inputHold.d.ts +11 -1
  45. package/dist/Layer/inputHold.d.ts.map +1 -1
  46. package/dist/Layer/inputHold.js +114 -2
  47. package/dist/Layer/layerEntranceSide.d.ts.map +1 -1
  48. package/dist/Layer/layerEntranceSide.js +2 -1
  49. package/dist/Lightbox/Lightbox.d.ts.map +1 -1
  50. package/dist/Lightbox/Lightbox.js +63 -148
  51. package/dist/Lightbox/useZoomCore.d.ts +2 -13
  52. package/dist/Lightbox/useZoomCore.d.ts.map +1 -1
  53. package/dist/Lightbox/useZoomCore.js +7 -33
  54. package/dist/Lightbox/useZoomStage.d.ts.map +1 -1
  55. package/dist/Lightbox/useZoomStage.js +3 -9
  56. package/dist/Markdown/Markdown.d.ts.map +1 -1
  57. package/dist/Markdown/Markdown.js +7 -0
  58. package/dist/MetadataList/MetadataList.d.ts +2 -1
  59. package/dist/MetadataList/MetadataList.d.ts.map +1 -1
  60. package/dist/MetadataList/MetadataList.js +1 -1
  61. package/dist/NumberInput/NumberInput.d.ts +20 -2
  62. package/dist/NumberInput/NumberInput.d.ts.map +1 -1
  63. package/dist/NumberInput/NumberInput.js +4 -1
  64. package/dist/NumberInput/index.d.ts +1 -1
  65. package/dist/NumberInput/index.d.ts.map +1 -1
  66. package/dist/Outline/useOutlineFromDOM.d.ts.map +1 -1
  67. package/dist/Outline/useOutlineFromDOM.js +1 -0
  68. package/dist/Pagination/Pagination.d.ts.map +1 -1
  69. package/dist/Pagination/Pagination.js +1 -0
  70. package/dist/Popover/popoverSurfaceFrame.d.ts +4 -16
  71. package/dist/Popover/popoverSurfaceFrame.d.ts.map +1 -1
  72. package/dist/Popover/popoverSurfaceFrame.js +16 -31
  73. package/dist/Popover/usePopover.d.ts.map +1 -1
  74. package/dist/Popover/usePopover.js +3 -0
  75. package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
  76. package/dist/PowerSearch/PowerSearchValueEditor.js +4 -0
  77. package/dist/SegmentedControl/useSegmentedTouchTracking.d.ts.map +1 -1
  78. package/dist/SegmentedControl/useSegmentedTouchTracking.js +18 -0
  79. package/dist/Selector/Selector.d.ts.map +1 -1
  80. package/dist/Selector/Selector.js +0 -2
  81. package/dist/Table/plugins/filtering/useTableFiltering.d.ts.map +1 -1
  82. package/dist/Table/plugins/filtering/useTableFiltering.js +2 -0
  83. package/dist/Thumbnail/Thumbnail.d.ts +2 -2
  84. package/dist/TimeInput/TimeInput.d.ts +24 -4
  85. package/dist/TimeInput/TimeInput.d.ts.map +1 -1
  86. package/dist/TimeInput/TimeInput.js +10 -4
  87. package/dist/TimeInput/index.d.ts +1 -1
  88. package/dist/TimeInput/index.d.ts.map +1 -1
  89. package/dist/TimeInput/useTypedTime.d.ts +17 -6
  90. package/dist/TimeInput/useTypedTime.d.ts.map +1 -1
  91. package/dist/TimeInput/useTypedTime.js +41 -18
  92. package/dist/Toast/Toast.d.ts +6 -1
  93. package/dist/Toast/Toast.d.ts.map +1 -1
  94. package/dist/Toast/Toast.js +17 -1
  95. package/dist/Toast/ToastViewport.d.ts.map +1 -1
  96. package/dist/Toast/ToastViewport.js +10 -9
  97. package/dist/astryx.css +36 -6
  98. package/dist/hooks/containerReveal.stylex.d.ts.map +1 -1
  99. package/dist/hooks/containerReveal.stylex.js +18 -15
  100. package/dist/hooks/useAnnounceRenderedText.d.ts +9 -3
  101. package/dist/hooks/useAnnounceRenderedText.d.ts.map +1 -1
  102. package/dist/hooks/useAnnounceRenderedText.js +9 -7
  103. package/dist/hooks/useContainerReveal.d.ts +8 -5
  104. package/dist/hooks/useContainerReveal.d.ts.map +1 -1
  105. package/dist/hooks/useContainerReveal.js +2 -1
  106. package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
  107. package/dist/i18n/generated-locales/en.generated.js +1 -0
  108. package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
  109. package/dist/i18n/generated-locales/pseudo.generated.js +1 -0
  110. package/dist/internal/shared-context.d.ts +15 -0
  111. package/dist/internal/shared-context.d.ts.map +1 -0
  112. package/dist/internal/shared-context.js +15 -0
  113. package/dist/motion/animatedLayout.d.ts.map +1 -1
  114. package/dist/motion/animatedLayout.js +2 -17
  115. package/dist/motion/linearEasing.d.ts +9 -0
  116. package/dist/motion/linearEasing.d.ts.map +1 -0
  117. package/dist/motion/linearEasing.js +32 -0
  118. package/dist/motion/resolveMotion.d.ts +16 -0
  119. package/dist/motion/resolveMotion.d.ts.map +1 -1
  120. package/dist/motion/resolveMotion.js +40 -1
  121. package/locales/en.json +15 -11
  122. package/locales/pseudo.json +3 -0
  123. package/package.json +10 -5
  124. package/src/BottomSheet/BottomSheet.tsx +43 -101
  125. package/src/BottomSheet/BottomSheetPanel.tsx +46 -23
  126. package/src/Button/Button.tsx +132 -5
  127. package/src/Chat/ChatComposerInput.tsx +4 -0
  128. package/src/ContextMenu/ContextMenu.tsx +13 -0
  129. package/src/DateInput/DateInput.doc.mjs +18 -0
  130. package/src/DateInput/DateInput.tsx +35 -3
  131. package/src/DateInput/index.ts +1 -0
  132. package/src/DateInput/useTypedDate.ts +50 -12
  133. package/src/DateTimeInput/DateTimeInput.doc.mjs +18 -0
  134. package/src/DateTimeInput/DateTimeInput.tsx +38 -2
  135. package/src/DateTimeInput/NativeTimeSegment.tsx +16 -1
  136. package/src/DateTimeInput/index.ts +1 -0
  137. package/src/Dialog/Dialog.tsx +13 -2
  138. package/src/DropdownMenu/DropdownMenuSubMenu.tsx +13 -0
  139. package/src/Field/useEntryErrorBehavior.ts +34 -0
  140. package/src/FormLayout/FormLayout.doc.mjs +14 -0
  141. package/src/FormLayout/FormLayout.tsx +24 -2
  142. package/src/FormLayout/FormLayoutContext.ts +24 -4
  143. package/src/FormLayout/index.ts +5 -1
  144. package/src/Layer/inputHold.ts +137 -2
  145. package/src/Layer/layerEntranceSide.ts +2 -1
  146. package/src/Lightbox/Lightbox.doc.mjs +1 -1
  147. package/src/Lightbox/Lightbox.tsx +226 -357
  148. package/src/Lightbox/useZoomCore.ts +6 -49
  149. package/src/Lightbox/useZoomStage.ts +7 -17
  150. package/src/Markdown/Markdown.tsx +6 -0
  151. package/src/MetadataList/MetadataList.doc.mjs +16 -0
  152. package/src/MetadataList/MetadataList.tsx +3 -2
  153. package/src/NumberInput/NumberInput.doc.mjs +18 -0
  154. package/src/NumberInput/NumberInput.tsx +22 -1
  155. package/src/NumberInput/index.ts +1 -0
  156. package/src/Outline/useOutlineFromDOM.doc.mjs +99 -0
  157. package/src/Outline/useOutlineFromDOM.ts +1 -0
  158. package/src/Pagination/Pagination.tsx +1 -0
  159. package/src/Popover/popoverSurfaceFrame.ts +18 -41
  160. package/src/Popover/usePopover.tsx +13 -0
  161. package/src/PowerSearch/PowerSearchValueEditor.tsx +4 -0
  162. package/src/SegmentedControl/useSegmentedTouchTracking.ts +15 -0
  163. package/src/Selector/Selector.tsx +0 -1
  164. package/src/Table/plugins/filtering/useTableFiltering.tsx +2 -0
  165. package/src/Thumbnail/Thumbnail.doc.mjs +2 -2
  166. package/src/Thumbnail/Thumbnail.tsx +2 -2
  167. package/src/TimeInput/TimeInput.doc.mjs +21 -3
  168. package/src/TimeInput/TimeInput.tsx +38 -8
  169. package/src/TimeInput/index.ts +1 -0
  170. package/src/TimeInput/useTypedTime.ts +60 -18
  171. package/src/Toast/Toast.tsx +33 -2
  172. package/src/Toast/ToastViewport.tsx +14 -9
  173. package/src/hooks/containerReveal.stylex.ts +17 -15
  174. package/src/hooks/useAnnounceRenderedText.ts +18 -6
  175. package/src/hooks/useContainerReveal.doc.mjs +3 -3
  176. package/src/hooks/useContainerReveal.ts +8 -5
  177. package/src/i18n/generated-locales/en.generated.ts +1 -0
  178. package/src/i18n/generated-locales/pseudo.generated.ts +1 -0
  179. package/src/internal/shared-context.ts +15 -0
  180. package/src/motion/README.md +1 -0
  181. package/src/motion/animatedLayout.ts +6 -21
  182. package/src/motion/linearEasing.ts +35 -0
  183. package/src/motion/resolveMotion.ts +42 -1
@@ -34,7 +34,7 @@ import { announceInModal } from "../hooks/useAnnounce.js";
34
34
  import { useScrollLock } from "../hooks/useScrollLock.js";
35
35
  import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
36
36
  import { useAttachment } from "../hooks/useAttachment.js";
37
- import { observeResize, observeResizeAfterLayout } from "../utils/sharedResizeObserver.js";
37
+ import { observeResizeAfterLayout } from "../utils/sharedResizeObserver.js";
38
38
  import { useTouchHitArea } from "../utils/touchHitArea.js";
39
39
  import { touchHitAreaStyles } from "../internal/touchHitArea.stylex.js";
40
40
  import { usePressTracker } from "../gestures/usePressTracker.js";
@@ -123,49 +123,15 @@ const styles = {
123
123
  kba3nw: "x1yso5bx",
124
124
  $$css: true
125
125
  },
126
- imageWrapperFill: {
127
- kSGwAc: "xkh2ocl",
128
- kzQI83: "x1iyjqo2",
129
- kmuXW: "xs83m0k",
130
- kCS8Yb: "x1r8uery",
131
- $$css: true
132
- },
133
126
  zoomButtonFocusInset: {
134
127
  kInvED: "x1wfwxd8 x1nw7mhf",
135
128
  $$css: true
136
129
  },
137
- imageWrapper: {
138
- k1xSpc: "x78zum5",
139
- kGNEyG: "x6s0dn4",
140
- kjj79g: "xl56j7k",
141
- kVQacm: "xb3r6kr x1odnnbo x7l34b8",
142
- kY2c9j: "x1c34a00",
143
- kkrTdU: "xt0e3qv",
144
- kfSwDN: "x87ps6o",
145
- kAzted: "x2lwn1j",
146
- $$css: true
147
- },
148
- imageWrapperZoomTarget: {
149
- kFalU9: "x5ve5x3",
150
- $$css: true
151
- },
152
130
  pageMediaZoomTarget: {
153
131
  kFalU9: "x5ve5x3",
154
132
  kkrTdU: "xmper1u x16khyan",
155
133
  $$css: true
156
134
  },
157
- imageWrapperDismissTarget: {
158
- kFalU9: "x1j4r261",
159
- $$css: true
160
- },
161
- imageWrapperGallery: {
162
- kSGwAc: "xkh2ocl",
163
- kzQI83: "x1iyjqo2",
164
- kmuXW: "xs83m0k",
165
- kCS8Yb: "x1r8uery",
166
- kVAEAm: "x1n2onr6",
167
- $$css: true
168
- },
169
135
  page: {
170
136
  kVAEAm: "x1n2onr6",
171
137
  kBCFzs: "xgkxs2y",
@@ -229,14 +195,6 @@ const styles = {
229
195
  kFalU9: "xge0x1e",
230
196
  $$css: true
231
197
  },
232
- imageWrapperZoomable: {
233
- kkrTdU: "xt0e3qv x1kjnscg x16khyan",
234
- $$css: true
235
- },
236
- imageWrapperZoomed: {
237
- kkrTdU: "x1jm3nie x5qf8wv x16khyan",
238
- $$css: true
239
- },
240
198
  caption: {
241
199
  kLKAdn: "x1xye8es",
242
200
  kGO01o: "x18d9i69",
@@ -400,6 +358,7 @@ export function Lightbox({
400
358
  const containerRef = useRef(null);
401
359
  const imageWrapperRef = useRef(null);
402
360
  const trackRef = useRef(null);
361
+ const noPagerTrackRef = useRef(null);
403
362
  // A gallery's zoom stage: the current page's photo box.
404
363
  const pageMediaRef = useRef(null);
405
364
  const triggerElementRef = useRef(null);
@@ -422,6 +381,8 @@ export function Lightbox({
422
381
 
423
382
  // Resolve current media item
424
383
  const mediaArray = useMemo(() => Array.isArray(media) ? media : [media], [media]);
384
+ // Every item is a page of the track, a single photo too, so its photo and
385
+ // caption sit as a gallery page's do. Only paging needs more than one item.
425
386
  const isGallery = mediaArray.length > 1;
426
387
  // The item shown is current in every respect: its page, the counter, the
427
388
  // pager and the announcement.
@@ -627,16 +588,13 @@ export function Lightbox({
627
588
  const pointerTypeRef = useRef('');
628
589
  // Where the last press on the media started, which a click does not carry.
629
590
  const pressPointRef = useRef(null);
630
- // Without zoom, a click on the dark area lands on the container or the
631
- // dialog, and both close. A finger's tap on a gallery's stage, or on the
632
- // zoom stage beside the photo, closes on the stage's own tap. So does its
633
- // tap on the media group's strip below a single photo's stage. A mouse's or
634
- // a pen's click closes only outside the media (`isClickOutsideMedia`). A
635
- // zoomed drag sets `didDragRef`, so its click is ignored. The next press
636
- // clears the flag, and a finger's only on the stage.
591
+ // The stage fills the viewer. A finger's tap on it beside the media closes
592
+ // on a tap of its own: the zoom stage's, or the backdrop tap without zoom.
593
+ // A mouse's or a pen's click closes only outside the media
594
+ // (`isClickOutsideMedia`). A zoomed drag sets `didDragRef`, so its click is
595
+ // ignored. The next press clears the flag, and a finger's only on the stage.
637
596
  const didDragRef = useRef(false);
638
597
  const mediaGroupRef = useRef(null);
639
- const captionRef = useRef(null);
640
598
  // The current item's caption, which is the viewer's accessible description.
641
599
  const captionId = useId();
642
600
  const fullCaptionId = useId();
@@ -829,16 +787,14 @@ export function Lightbox({
829
787
  return stop;
830
788
  }, null);
831
789
  // Whether a mouse's or a pen's click on the media closes the viewer. It
832
- // does when its press or its release lands outside the media: a single
833
- // item's, or a gallery's current page's. The media runs from the fitted
834
- // photo's top to the caption's bottom. It is as wide as the photo's
835
- // natural width or the caption, up to the viewer's. While zoomed, the
836
- // photo's shown box is media too.
790
+ // does when its press or its release lands outside the current page's
791
+ // media. That is the fitted photo's laid-out box, the caption's band and
792
+ // the caption's own box. While zoomed, the photo's shown box is media too.
837
793
  const isClickOutsideMedia = useCallback(e => {
838
794
  const viewer = imageWrapperRef.current;
839
- const page = viewer?.querySelector('[data-current]') ?? viewer;
795
+ const page = viewer?.querySelector('[data-current]');
840
796
  const media = page?.querySelector('img') ?? page?.querySelector('video');
841
- // The photo's own box, which centres it: the stage, or a page's.
797
+ // The page's photo box, which centres the photo.
842
798
  const box = media?.parentElement;
843
799
  const group = mediaGroupRef.current;
844
800
  if (e.detail === 0 || pointerTypeRef.current === 'touch' || viewer == null || page == null || media == null || box == null || group == null || !(e.target instanceof Node) || !group.contains(e.target)) {
@@ -847,23 +803,17 @@ export function Lightbox({
847
803
  const space = (box.clientHeight - media.offsetHeight) / 2;
848
804
  const boxRect = box.getBoundingClientRect();
849
805
  const top = boxRect.top + space;
850
- let bottom = top + media.offsetHeight;
851
- const caption = page === viewer ? captionRef.current : page.querySelector('[data-lightbox-caption]');
852
- if (caption != null) {
853
- // The caption's place under the fitted photo, also while zoomed.
854
- const lift = caption.style.translate === '' ? space : 0;
855
- bottom = Math.max(bottom, caption.getBoundingClientRect().bottom - lift);
856
- }
857
- const natural = media instanceof HTMLImageElement ? media.naturalWidth : media.videoWidth;
858
- const width = Math.min(viewer.clientWidth, Math.max(natural, caption?.offsetWidth ?? 0));
806
+ const bottom = top + media.offsetHeight;
807
+ const caption = page.querySelector('[data-lightbox-caption]');
808
+ const width = media.offsetWidth;
859
809
  const middle = boxRect.left + box.clientWidth / 2;
860
810
  const shown = media.getBoundingClientRect();
861
- // A gallery's caption band can sit apart from the photo. There the media
862
- // is the photo's rows, the band and the caption's own box, which an open
863
- // caption lifts over the photo. So the space between the photo and the
864
- // band is outside it.
865
- const captionBox = page === viewer ? null : caption?.getBoundingClientRect();
866
- const bandBox = page === viewer ? null : caption?.parentElement?.getBoundingClientRect();
811
+ // The caption band can sit apart from the photo. There the media is the
812
+ // photo's rows, the band and the caption's own box, which an open caption
813
+ // lifts over the photo. So the space between the photo and the band is
814
+ // outside it.
815
+ const captionBox = caption?.getBoundingClientRect();
816
+ const bandBox = caption?.parentElement?.getBoundingClientRect();
867
817
  const isOutside = ({
868
818
  x,
869
819
  y
@@ -891,11 +841,11 @@ export function Lightbox({
891
841
  didDragRef.current = false;
892
842
  return;
893
843
  }
894
- const isMediaClose = pointerTypeRef.current === 'touch' ? hasZoom && !isVideo && e.target === mediaGroupRef.current : (isGallery || hasZoom && !isVideo) && isClickOutsideMedia(e);
844
+ const isMediaClose = pointerTypeRef.current !== 'touch' && isClickOutsideMedia(e);
895
845
  if (e.target === e.currentTarget || e.target === containerRef.current || isMediaClose) {
896
846
  handleClose();
897
847
  }
898
- }, [handleClose, hasZoom, isVideo, isGallery, isClickOutsideMedia]);
848
+ }, [handleClose, isClickOutsideMedia]);
899
849
  const isZoomTarget = hasZoom && !isVideo;
900
850
 
901
851
  // The current page's caption band. The drag to close fades it with the
@@ -928,35 +878,11 @@ export function Lightbox({
928
878
  const onDragStart = () => {
929
879
  didDragRef.current = true;
930
880
  };
931
- // With zoom the stage fills the viewer, so a caption would sit at the
932
- // viewer's bottom. It moves up by the stage's space below the fitted
933
- // photo, so it sits under the photo as it does without zoom. The stage
934
- // already leaves the caption its height. A photo shown larger than it fits
935
- // fills the stage, from a gesture's first move until a settle back lands.
936
- // Meanwhile the caption goes back to its own place below the stage.
937
- const isShownAtFitRef = useRef(true);
938
- const placeCaption = useCallback(() => {
939
- const caption = captionRef.current;
940
- if (caption == null) {
941
- return;
942
- }
943
- const stageElement = imageWrapperRef.current;
944
- const photo = stageElement?.querySelector('img');
945
- // The photo's laid-out height, not its zoomed box.
946
- const below = isZoomTarget && isShownAtFitRef.current && stageElement != null && photo != null ? (stageElement.clientHeight - photo.offsetHeight) / 2 : 0;
947
- caption.style.translate = below > 0 ? `0 ${-below}px` : '';
948
- }, [isZoomTarget]);
949
- useAttachment(imageWrapperRef, element => observeResize(element, placeCaption), placeCaption);
950
- // Places the caption for the new item's layout before it paints.
951
- useIsomorphicLayoutEffect(() => {
952
- placeCaption();
953
- }, [placeCaption, viewedItem]);
954
-
955
881
  // The zoom stage takes the keyboard's zoom and pan and every pointer's
956
882
  // gestures. Past a limit, a pinch or a pan gives way and returns.
957
883
  const zoom = useZoomCore({
958
- stageRef: isGallery ? pageMediaRef : imageWrapperRef,
959
- surfaceRef: isGallery ? trackRef : imageWrapperRef,
884
+ stageRef: pageMediaRef,
885
+ surfaceRef: trackRef,
960
886
  isEnabled: isOpen && isZoomTarget,
961
887
  itemKey: viewedItem,
962
888
  // Zoom changes are silent to assistive tech, since only the transform
@@ -964,10 +890,6 @@ export function Lightbox({
964
890
  onZoomedChange: next => {
965
891
  setIsZoomed(next);
966
892
  announce(next ? t('@astryx.lightbox.zoomedIn') : t('@astryx.lightbox.zoomedOut'));
967
- },
968
- onFitChange: isAtFit => {
969
- isShownAtFitRef.current = isAtFit;
970
- placeCaption();
971
893
  }
972
894
  });
973
895
  const {
@@ -978,12 +900,12 @@ export function Lightbox({
978
900
  return target instanceof Element && target.closest('[data-lightbox-caption]') != null;
979
901
  };
980
902
  const stage = useZoomStage(zoom, {
981
- stageRef: isGallery ? pageMediaRef : imageWrapperRef,
982
- surfaceRef: isGallery ? trackRef : imageWrapperRef,
903
+ stageRef: pageMediaRef,
904
+ surfaceRef: trackRef,
983
905
  isEnabled: isOpen && isZoomTarget,
984
906
  itemKey: viewedItem,
985
- // A gallery's stage shares its surface with the page around it. A tap
986
- // there closes, as on the backdrop, unless it lands on the caption.
907
+ // The stage shares its surface with the page around it. A tap there
908
+ // closes, as on the backdrop, unless it lands on the caption.
987
909
  onTapOutside: ({
988
910
  x,
989
911
  y
@@ -998,7 +920,7 @@ export function Lightbox({
998
920
  isTouchPresentation: isTouch,
999
921
  // Only a gallery's touch pager takes a drag past a zoomed photo's edge.
1000
922
  hasOuterPager: isGallery && isTouch,
1001
- // A pinch whose first finger lands on a gallery's caption is the page's.
923
+ // A pinch whose first finger lands on a caption is the page's.
1002
924
  shouldBeginPinch: recognizer => !startsOnCaption(recognizer.trackedTouches[0]),
1003
925
  dismiss: {
1004
926
  // Part of the touch presentation, which applies under a coarse primary
@@ -1031,7 +953,7 @@ export function Lightbox({
1031
953
  fadedRef.current = backdrop == null ? chrome : [backdrop, ...chrome];
1032
954
  // They keep pace with the photo: the dismissal's measured spring, or
1033
955
  // on a cancel the shared settle spring, read where the stage is.
1034
- const spring = dismisses ? zoomMedia.dismiss.dismissSizeSpring : resolveMotion((isGallery ? pageMediaRef : imageWrapperRef).current, springs.settle);
956
+ const spring = dismisses ? zoomMedia.dismiss.dismissSizeSpring : resolveMotion(pageMediaRef.current, springs.settle);
1035
957
  const opacity = dismisses ? 0 : 1;
1036
958
  const move = backdropMovesRef.current += 1;
1037
959
  setBackdropMoving(true);
@@ -1146,7 +1068,9 @@ export function Lightbox({
1146
1068
  }, [index, isZoomTarget]);
1147
1069
  usePager({
1148
1070
  viewportRef: imageWrapperRef,
1149
- trackRef,
1071
+ // A single photo has no pager, since it has nothing to page to. Its track
1072
+ // still holds its one page and takes the zoom's gestures.
1073
+ trackRef: isGallery ? trackRef : noPagerTrackRef,
1150
1074
  count: mediaArray.length,
1151
1075
  gap: zoomMedia.viewer.pageGap,
1152
1076
  index,
@@ -1202,7 +1126,7 @@ export function Lightbox({
1202
1126
  const inRows = r => r != null && y >= r.top && y <= r.bottom;
1203
1127
  return inRows(caption) && caption != null && x >= caption.left && x <= caption.right || inRows(media) && x >= Math.min(...boxes.map(r => r.left)) && x <= Math.max(...boxes.map(r => r.right));
1204
1128
  };
1205
- // Without zoom, a gallery's stage fills the viewer. So a finger's tap on it
1129
+ // Without zoom, the stage fills the viewer. So a finger's tap on it
1206
1130
  // beside the media closes the viewer, as a click on the backdrop does. A
1207
1131
  // press that moves past the tap's movement limit is no tap. A mouse's or a
1208
1132
  // pen's click closes it only outside the media (`isClickOutsideMedia`).
@@ -1222,7 +1146,7 @@ export function Lightbox({
1222
1146
  handleClose();
1223
1147
  }
1224
1148
  }, {
1225
- isEnabled: isOpen && isGallery && !isZoomTarget,
1149
+ isEnabled: isOpen && !isZoomTarget,
1226
1150
  manageStyle: false
1227
1151
  });
1228
1152
 
@@ -1348,7 +1272,6 @@ export function Lightbox({
1348
1272
  }
1349
1273
  }) : /*#__PURE__*/_jsx("img", {
1350
1274
  ref: isCurrent ? stage.contentRef : undefined,
1351
- onLoad: isCurrent ? placeCaption : undefined,
1352
1275
  src: src,
1353
1276
  alt: isCurrent ? alt : '',
1354
1277
  "aria-hidden": isCurrent ? undefined : true,
@@ -1358,13 +1281,12 @@ export function Lightbox({
1358
1281
  }
1359
1282
  });
1360
1283
  // The current item and its neighbours; the pager shows one at rest.
1361
- const pageIndexes = isGallery ? [index - 1, index, index + 1].filter(i => i >= 0 && i < mediaArray.length) : [];
1362
- const hasCaptionBand = isGallery && mediaArray.some(item => isRenderable(item.caption));
1284
+ const pageIndexes = [index - 1, index, index + 1].filter(i => i >= 0 && i < mediaArray.length);
1285
+ const hasCaptionBand = mediaArray.some(item => isRenderable(item.caption));
1363
1286
  // Its place ends the caption's last line, unless the open caption scrolls.
1364
1287
  const hasCaptionTogglePlace = hasCaptionToggle && !isCaptionScrolling;
1365
- // The keyboard's zoom button is the photo's wrapper. In a gallery it is the
1366
- // current page's photo box, so the caption band stays outside it.
1367
- const isWrapperZoomButton = isZoomTarget && !isGallery;
1288
+ // The keyboard's zoom button is the current page's photo box, so the
1289
+ // caption band stays outside it.
1368
1290
  const zoomButtonProps = {
1369
1291
  role: 'button',
1370
1292
  tabIndex: 0,
@@ -1433,27 +1355,28 @@ export function Lightbox({
1433
1355
  onClick: goToPrev,
1434
1356
  isMirrored: true
1435
1357
  })]
1436
- }), /*#__PURE__*/_jsxs("div", {
1358
+ }), /*#__PURE__*/_jsx("div", {
1437
1359
  ref: mediaGroupRef,
1438
1360
  "data-lightbox-media": "",
1439
1361
  ...{
1440
- 0: {
1441
- className: "x78zum5 xdt5ytf x6s0dn4 x193iq5w xmz0i5r xb3r6kr x7l34b8"
1442
- },
1443
- 2: {
1444
- className: "x78zum5 xdt5ytf x6s0dn4 x193iq5w xmz0i5r xb3r6kr x7l34b8 xkh2ocl x1iyjqo2 x2lwn1j"
1445
- },
1446
- 1: {
1447
- className: "x78zum5 xdt5ytf x6s0dn4 x193iq5w xmz0i5r xb3r6kr x7l34b8 xkh2ocl x1iyjqo2 x2lwn1j"
1448
- },
1449
- 3: {
1450
- className: "x78zum5 xdt5ytf x6s0dn4 x193iq5w xmz0i5r xb3r6kr x7l34b8 xkh2ocl x1iyjqo2 x2lwn1j"
1451
- }
1452
- }[!!(isZoomTarget && !isGallery) << 1 | !!isGallery << 0],
1453
- children: [/*#__PURE__*/_jsx("div", {
1362
+ className: "x78zum5 xdt5ytf x6s0dn4 xkh2ocl x1iyjqo2 x2lwn1j x193iq5w xmz0i5r xb3r6kr x7l34b8"
1363
+ },
1364
+ children: /*#__PURE__*/_jsx("div", {
1454
1365
  ref: imageWrapperRef,
1455
- ...(isWrapperZoomButton ? zoomButtonProps : undefined),
1456
- ...stylex.props(styles.imageWrapper, isGallery && styles.imageWrapperGallery, isZoomTarget && !isGallery && styles.imageWrapperZoomTarget, isZoomTarget && !isGallery && styles.imageWrapperFill, isTouch && !isZoomTarget && !isVideo && !isGallery && styles.imageWrapperDismissTarget, isWrapperZoomButton && focusOutlineStyles.focusVisible, isWrapperZoomButton && styles.zoomButtonFocusInset, isZoomTarget && !isZoomed && styles.imageWrapperZoomable, isZoomTarget && isZoomed && styles.imageWrapperZoomed),
1366
+ ...{
1367
+ 0: {
1368
+ className: "x78zum5 x6s0dn4 xl56j7k xkh2ocl x1iyjqo2 xs83m0k x1r8uery x1n2onr6 xb3r6kr x7l34b8 xt0e3qv x87ps6o x2lwn1j"
1369
+ },
1370
+ 2: {
1371
+ className: "x78zum5 x6s0dn4 xl56j7k xkh2ocl x1iyjqo2 xs83m0k x1r8uery x1n2onr6 xb3r6kr x7l34b8 x87ps6o x2lwn1j xt0e3qv x1kjnscg x16khyan"
1372
+ },
1373
+ 1: {
1374
+ className: "x78zum5 x6s0dn4 xl56j7k xkh2ocl x1iyjqo2 xs83m0k x1r8uery x1n2onr6 xb3r6kr x7l34b8 x87ps6o x2lwn1j x1jm3nie x5qf8wv x16khyan"
1375
+ },
1376
+ 3: {
1377
+ className: "x78zum5 x6s0dn4 xl56j7k xkh2ocl x1iyjqo2 xs83m0k x1r8uery x1n2onr6 xb3r6kr x7l34b8 x87ps6o x2lwn1j x1jm3nie x5qf8wv x16khyan"
1378
+ }
1379
+ }[!!(isZoomTarget && !isZoomed) << 1 | !!(isZoomTarget && isZoomed) << 0],
1457
1380
  onPointerMove: isZoomTarget ? markPointerOverPhoto : undefined,
1458
1381
  onPointerLeave: isZoomTarget ? e => e.currentTarget.removeAttribute(OVER_PHOTO_ATTRIBUTE) : undefined,
1459
1382
  onDoubleClick: isZoomTarget ? e => {
@@ -1462,7 +1385,7 @@ export function Lightbox({
1462
1385
  stage.doubleClickAt(e.clientX, e.clientY);
1463
1386
  }
1464
1387
  } : undefined,
1465
- children: isGallery ? /*#__PURE__*/_jsx("div", {
1388
+ children: /*#__PURE__*/_jsx("div", {
1466
1389
  ref: trackRef,
1467
1390
  ...{
1468
1391
  0: {
@@ -1586,16 +1509,8 @@ export function Lightbox({
1586
1509
  })
1587
1510
  })]
1588
1511
  }, i))
1589
- }) : renderMedia(currentItem, true)
1590
- }), !isGallery && isRenderable(currentItem.caption) && /*#__PURE__*/_jsx(Text, {
1591
- ref: captionRef,
1592
- id: captionId,
1593
- "data-lightbox-caption": "",
1594
- as: "div",
1595
- type: "body",
1596
- xstyle: styles.caption,
1597
- children: currentItem.caption
1598
- })]
1512
+ })
1513
+ })
1599
1514
  }), /*#__PURE__*/_jsxs("div", {
1600
1515
  "data-lightbox-chrome": "",
1601
1516
  ...{
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @file useZoomCore.ts
3
3
  * @input A stage element ref, which clips and centres the photo, and the
4
- * element the gestures attach to: the stage, or a gallery's track. Also
5
- * whether zoom is on, the current item's key and the zoom and fit callbacks
4
+ * element the gestures attach to, the viewer's track of pages. Also whether
5
+ * zoom is on, the current item's key and the zoom callback
6
6
  * @output Exports `useZoomCore`: Lightbox's zoom stage for every pointer. It
7
7
  * writes the photo's transform through the compositor animator and settles
8
8
  * every zoom, the keyboard's zoom and pan included, on `springs.settle`. Its
@@ -37,12 +37,6 @@ export interface UseZoomCoreOptions {
37
37
  itemKey: unknown;
38
38
  /** The photo became zoomed or returned to the fitted size. */
39
39
  onZoomedChange: (isZoomed: boolean) => void;
40
- /**
41
- * The photo left or came back to its fitted size on screen. It reads false
42
- * from a gesture's first move or a settle's start, and true once a settle
43
- * back lands.
44
- */
45
- onFitChange?: (isAtFit: boolean) => void;
46
40
  }
47
41
  /** What Lightbox calls: the photo's ref and the keyboard's zoom and pan. */
48
42
  export interface ZoomStage {
@@ -99,11 +93,6 @@ export interface ZoomCore {
99
93
  /** Where the photo is going, when an animation the core did not start ends there. */
100
94
  setTarget(transform: ZoomTransform): void;
101
95
  setZoomed(next: boolean): void;
102
- /**
103
- * Reports that the photo shows at its fitted size again, when an animation
104
- * the core did not start lands there (`onFitChange`).
105
- */
106
- setAtFit(next: boolean): void;
107
96
  /** Whether the photo is moving (shown away from where it is going). */
108
97
  isMoving(): boolean;
109
98
  /** Whether a zoomed photo's edge toward `direction` is at the stage's. */
@@ -1 +1 @@
1
- {"version":3,"file":"useZoomCore.d.ts","sourceRoot":"","sources":["../../src/Lightbox/useZoomCore.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAyC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC7E,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAAqB,KAAK,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AAKrE,OAAO,EAWL,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAErB,yEAAyE;AACzE,eAAO,MAAM,uBAAuB,uBAAuB,CAAC;AAE5D,4CAA4C;AAC5C,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5C,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,QAAQ,EAAE,SAAS,CAA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C,OAAO,EAAE,kBAAkB,GAAG,QAAQ,CA8UjE"}
@@ -5,8 +5,8 @@
5
5
  /**
6
6
  * @file useZoomCore.ts
7
7
  * @input A stage element ref, which clips and centres the photo, and the
8
- * element the gestures attach to: the stage, or a gallery's track. Also
9
- * whether zoom is on, the current item's key and the zoom and fit callbacks
8
+ * element the gestures attach to, the viewer's track of pages. Also whether
9
+ * zoom is on, the current item's key and the zoom callback
10
10
  * @output Exports `useZoomCore`: Lightbox's zoom stage for every pointer. It
11
11
  * writes the photo's transform through the compositor animator and settles
12
12
  * every zoom, the keyboard's zoom and pan included, on `springs.settle`. Its
@@ -32,11 +32,6 @@ export const ZOOM_DRAGGING_ATTRIBUTE = 'data-zoom-dragging';
32
32
 
33
33
  /** A drag's initial direction on screen. */
34
34
 
35
- /** Whether a shown transform is the fitted size, to within a pixel. */
36
- function isAtFit(transform) {
37
- return Math.abs(transform.scale - 1) < 1e-3 && Math.abs(transform.x) < 0.5 && Math.abs(transform.y) < 0.5;
38
- }
39
-
40
35
  /** What Lightbox calls: the photo's ref and the keyboard's zoom and pan. */
41
36
 
42
37
  /** The core as the gestures (useZoomStage.ts) drive it. */
@@ -123,13 +118,6 @@ export function useZoomCore(options) {
123
118
  y: animator.get('y'),
124
119
  scale: animator.get('scale')
125
120
  }), [animator]);
126
- const atFitRef = useRef(true);
127
- const setAtFit = useCallback(next => {
128
- if (atFitRef.current !== next) {
129
- atFitRef.current = next;
130
- optionsRef.current.onFitChange?.(next);
131
- }
132
- }, []);
133
121
  const write = useCallback(transform => {
134
122
  targetRef.current = transform;
135
123
  animator.set({
@@ -137,8 +125,7 @@ export function useZoomCore(options) {
137
125
  y: transform.y,
138
126
  scale: transform.scale
139
127
  });
140
- setAtFit(isAtFit(transform));
141
- }, [animator, setAtFit]);
128
+ }, [animator]);
142
129
  const setTarget = useCallback(transform => {
143
130
  targetRef.current = transform;
144
131
  }, []);
@@ -178,12 +165,8 @@ export function useZoomCore(options) {
178
165
  targetRef.current = target;
179
166
  setZoomed(isZoomed(geometry, target));
180
167
  if (from.x === target.x && from.y === target.y && from.scale === target.scale) {
181
- setAtFit(isAtFit(target));
182
168
  return;
183
169
  }
184
- // The photo is off its fitted size while it moves, back at it only
185
- // once a settle there lands.
186
- setAtFit(false);
187
170
  // Registers the reduced-motion cross-fade once; later calls do nothing.
188
171
  registerReducedMotionCrossFade();
189
172
  // Every zoom settles on `springs.settle`, read where the stage is. A
@@ -193,7 +176,7 @@ export function useZoomCore(options) {
193
176
  const stageElement = optionsRef.current.stageRef.current;
194
177
  const span = target.scale - from.scale;
195
178
  const rate = Number.isFinite(scaleVelocity) && span !== 0 ? scaleVelocity / span : 0;
196
- const handle = animator.animate({
179
+ animator.animate({
197
180
  x: target.x,
198
181
  y: target.y,
199
182
  scale: target.scale
@@ -207,14 +190,7 @@ export function useZoomCore(options) {
207
190
  }, {
208
191
  touchRelease
209
192
  });
210
- if (isAtFit(target)) {
211
- void handle.finished.then(landed => {
212
- if (landed && targetRef.current === target) {
213
- setAtFit(true);
214
- }
215
- });
216
- }
217
- }, [animator, current, setAtFit, setZoomed]);
193
+ }, [animator, current, setZoomed]);
218
194
 
219
195
  // Another item: back to the fitted size before it paints. Lightbox resets
220
196
  // its own zoomed state during that render.
@@ -229,8 +205,7 @@ export function useZoomCore(options) {
229
205
  targetRef.current = IDENTITY;
230
206
  zoomedRef.current = false;
231
207
  geometryRef.current = null;
232
- setAtFit(true);
233
- }, [animator, options.itemKey, setAtFit]);
208
+ }, [animator, options.itemKey]);
234
209
 
235
210
  // A rotation or resize keeps the same photo point centred at the same
236
211
  // on-screen size (the shared resize observer). It watches the surface: in
@@ -328,9 +303,8 @@ export function useZoomCore(options) {
328
303
  write,
329
304
  setTarget,
330
305
  setZoomed,
331
- setAtFit,
332
306
  isMoving,
333
307
  isAtEdgeOf,
334
308
  settleTo
335
- }), [api, animator, measure, toStage, current, write, setTarget, setZoomed, setAtFit, isMoving, isAtEdgeOf, settleTo]);
309
+ }), [api, animator, measure, toStage, current, write, setTarget, setZoomed, isMoving, isAtEdgeOf, settleTo]);
336
310
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useZoomStage.d.ts","sourceRoot":"","sources":["../../src/Lightbox/useZoomStage.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAA4B,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAChE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AAKrE,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AA2B7C,OAAO,EACL,uBAAuB,EACvB,KAAK,QAAQ,EACb,KAAK,SAAS,EACf,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,uBAAuB,EAAE,KAAK,SAAS,EAAC,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,yBAAyB,CAAC;AAEhE,MAAM,WAAW,mBAAmB;IAClC,0EAA0E;IAC1E,QAAQ,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACxC,2EAA2E;IAC3E,UAAU,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC3C,2DAA2D;IAC3D,SAAS,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;IACzC,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,iBAAiB,KAAK,OAAO,CAAC;IAC9D;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,uDAAuD;IACvD,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;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AAW,GAAG,IAAI,CAAC,CAAC;IAC3C,2DAA2D;IAC3D,SAAS,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,KAAK,IAAI,CAAC;IACzC,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,iBAAiB,KAAK,OAAO,CAAC;IAC9D;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,uDAAuD;IACvD,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,SAAS,EAAE,OAAO,CAAC;IACnB,sDAAsD;IACtD,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC;;;;;OAKG;IACH,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,8CAA8C;IAC9C,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,qDAAqD;AACrD,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,kFAAkF;IAClF,KAAK,IAAI,IAAI,CAAC;CACf;AA0BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,mBAAmB,GAC3B,kBAAkB,CA2hBpB"}
@@ -121,7 +121,6 @@ export function useZoomStage(core, options) {
121
121
  write,
122
122
  setTarget,
123
123
  setZoomed,
124
- setAtFit,
125
124
  settleTo,
126
125
  isMoving,
127
126
  isAtEdgeOf
@@ -592,14 +591,10 @@ export function useZoomStage(core, options) {
592
591
  }, {
593
592
  touchRelease: fingerRef.current.dismiss
594
593
  });
595
- // Back in its box: the stage clips again, unless another drag began,
596
- // and the photo is at its fitted size again once both springs land.
597
- void Promise.all([position.finished, size.finished]).then(([moved, sized]) => {
594
+ // Back in its box: the stage clips again, unless another drag began.
595
+ void Promise.all([position.finished, size.finished]).then(() => {
598
596
  if (dismissRef.current == null && !leavingRef.current) {
599
597
  options.stageRef.current?.removeAttribute(ZOOM_DISMISSING_ATTRIBUTE);
600
- if (moved && sized) {
601
- setAtFit(true);
602
- }
603
598
  }
604
599
  });
605
600
  }, {
@@ -634,8 +629,7 @@ export function useZoomStage(core, options) {
634
629
  opacity: 1
635
630
  });
636
631
  setTarget(IDENTITY);
637
- setAtFit(true);
638
632
  stageRef.current?.removeAttribute(ZOOM_DISMISSING_ATTRIBUTE);
639
633
  }
640
- }), [animator, api, setAtFit, setTarget, stageRef]);
634
+ }), [animator, api, setTarget, stageRef]);
641
635
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../../src/Markdown/Markdown.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAIhD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAC;AAiBvD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAoCzD,OAAO,KAAK,EAEV,mBAAmB,EAEpB,MAAM,oBAAoB,CAAC;AA2C5B;;;;;;;;;GASG;AACH,MAAM,WAAW,oBAAoB;IACnC,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAA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,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACzC;;;;;OAKG;IACH,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACvC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CAC7C;AAm1DD;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CACtB,KAAK,CAAC,OAAO,SAAS,aAAa,CAAC,mBAAmB,CAAC,GAAG,SAAS,EAAE,EACtE,EACA,GAAG,EACH,QAAQ,EACR,OAAiB,EACjB,OAAmB,EACnB,iBAAqB,EACrB,WAAmB,EACnB,WAAW,EACX,OAAO,EACP,aAAuB,EACvB,YAAkB,EAClB,YAAsB,EACtB,UAAU,EACV,OAAO,EACP,aAAa,EACb,QAAQ,EACR,aAAa,EAAE,iBAAiB,EAChC,MAAM,EACN,SAAS,EACT,KAAK,EACL,EAAE,EAAE,MAAM,EACV,aAAa,EAAE,MAAM,EACrB,GAAG,KAAK,EACT,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,YAAY,CA+X7C;yBAxZe,QAAQ"}
@@ -639,6 +639,8 @@ function applyInlinePlugins(text, plugins) {
639
639
  }
640
640
  function useStableMarkdownSyntaxEntries(plugins) {
641
641
  const identity = plugins?.syntaxIdentity ?? '';
642
+ // A discarded render can leave an entry here. The hook uses an entry only
643
+ // while its identity matches, so it replaces that entry.
642
644
  const syntaxEntriesRef = useRef(undefined);
643
645
  if (syntaxEntriesRef.current == null || syntaxEntriesRef.current.identity !== identity) {
644
646
  syntaxEntriesRef.current = {
@@ -1472,6 +1474,11 @@ export function Markdown({
1472
1474
  // Smooth bursty streamed chunks into a steady character-by-character reveal.
1473
1475
  // When not streaming, the hook returns children unchanged (no-op).
1474
1476
  const smoothedText = useStreamingText(children, isStreaming);
1477
+
1478
+ // A discarded render can change this cache, as it can change the option
1479
+ // flags below. The parser reuses settled blocks only while the input starts
1480
+ // with their text. So the output never shows text that only a discarded
1481
+ // render had (Markdown.test.tsx: "a streamed render that React discards").
1475
1482
  const incrementalStateRef = useRef(createIncrementalState());
1476
1483
  // Reset incremental cache when parser-affecting component options toggle —
1477
1484
  // cached settled blocks were parsed with the previous setting.
@@ -32,7 +32,8 @@ export interface MetadataListProps extends Omit<BaseProps<HTMLDivElement>, 'titl
32
32
  columns?: MetadataListColumns;
33
33
  /**
34
34
  * Label display configuration.
35
- * - position: 'start' places labels to the left, 'top' stacks labels above content
35
+ * - position: 'start' places each label at the inline start of its value,
36
+ * 'top' stacks labels above content
36
37
  * - width: Custom label width (number in px or CSS string)
37
38
  *
38
39
  * Defaults to `{ position: 'top' }` for multi-column layouts and
@@ -1 +1 @@
1
- {"version":3,"file":"MetadataList.d.ts","sourceRoot":"","sources":["../../src/MetadataList/MetadataList.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAqC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAQzE,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAgB5C,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE9D,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAC7C,SAAS,CAAC,cAAc,CAAC,EACzB,OAAO,CACR;IACC,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,uBAAuB,CAAC;I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