@oxyhq/bloom 0.32.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/button/Button.web.js +6 -29
- package/lib/commonjs/button/Button.web.js.map +1 -1
- package/lib/commonjs/fab/Fab.web.js +11 -2
- package/lib/commonjs/fab/Fab.web.js.map +1 -1
- package/lib/commonjs/hooks/index.js +13 -0
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useImagePreload.js +52 -0
- package/lib/commonjs/hooks/useImagePreload.js.map +1 -0
- package/lib/commonjs/image-aspect-ratio-cache/imageAspectRatioCache.js +65 -0
- package/lib/commonjs/image-aspect-ratio-cache/imageAspectRatioCache.js.map +1 -0
- package/lib/commonjs/image-aspect-ratio-cache/index.js +37 -0
- package/lib/commonjs/image-aspect-ratio-cache/index.js.map +1 -0
- package/lib/commonjs/index.js +15 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +15 -0
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/styles/flatten-web-style.js +49 -0
- package/lib/commonjs/styles/flatten-web-style.js.map +1 -0
- package/lib/commonjs/zoomable-image-gallery/ZoomableImageGallery.js +664 -0
- package/lib/commonjs/zoomable-image-gallery/ZoomableImageGallery.js.map +1 -0
- package/lib/commonjs/zoomable-image-gallery/constants.js +41 -0
- package/lib/commonjs/zoomable-image-gallery/constants.js.map +1 -0
- package/lib/commonjs/zoomable-image-gallery/index.js +19 -0
- package/lib/commonjs/zoomable-image-gallery/index.js.map +1 -0
- package/lib/commonjs/zoomable-image-gallery/types.js +2 -0
- package/lib/commonjs/zoomable-image-gallery/types.js.map +1 -0
- package/lib/module/button/Button.web.js +6 -29
- package/lib/module/button/Button.web.js.map +1 -1
- package/lib/module/fab/Fab.web.js +11 -2
- package/lib/module/fab/Fab.web.js.map +1 -1
- package/lib/module/hooks/index.js +1 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useImagePreload.js +48 -0
- package/lib/module/hooks/useImagePreload.js.map +1 -0
- package/lib/module/image-aspect-ratio-cache/imageAspectRatioCache.js +57 -0
- package/lib/module/image-aspect-ratio-cache/imageAspectRatioCache.js.map +1 -0
- package/lib/module/image-aspect-ratio-cache/index.js +4 -0
- package/lib/module/image-aspect-ratio-cache/index.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +2 -0
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/styles/flatten-web-style.js +45 -0
- package/lib/module/styles/flatten-web-style.js.map +1 -0
- package/lib/module/zoomable-image-gallery/ZoomableImageGallery.js +659 -0
- package/lib/module/zoomable-image-gallery/ZoomableImageGallery.js.map +1 -0
- package/lib/module/zoomable-image-gallery/constants.js +38 -0
- package/lib/module/zoomable-image-gallery/constants.js.map +1 -0
- package/lib/module/zoomable-image-gallery/index.js +4 -0
- package/lib/module/zoomable-image-gallery/index.js.map +1 -0
- package/lib/module/zoomable-image-gallery/types.js +2 -0
- package/lib/module/zoomable-image-gallery/types.js.map +1 -0
- package/lib/typescript/commonjs/button/Button.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/fab/Fab.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/index.d.ts +1 -0
- package/lib/typescript/commonjs/hooks/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/useImagePreload.d.ts +10 -0
- package/lib/typescript/commonjs/hooks/useImagePreload.d.ts.map +1 -0
- package/lib/typescript/commonjs/image-aspect-ratio-cache/imageAspectRatioCache.d.ts +14 -0
- package/lib/typescript/commonjs/image-aspect-ratio-cache/imageAspectRatioCache.d.ts.map +1 -0
- package/lib/typescript/commonjs/image-aspect-ratio-cache/index.d.ts +2 -0
- package/lib/typescript/commonjs/image-aspect-ratio-cache/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +1 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +1 -0
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/styles/flatten-web-style.d.ts +6 -0
- package/lib/typescript/commonjs/styles/flatten-web-style.d.ts.map +1 -0
- package/lib/typescript/commonjs/zoomable-image-gallery/ZoomableImageGallery.d.ts +5 -0
- package/lib/typescript/commonjs/zoomable-image-gallery/ZoomableImageGallery.d.ts.map +1 -0
- package/lib/typescript/commonjs/zoomable-image-gallery/constants.d.ts +33 -0
- package/lib/typescript/commonjs/zoomable-image-gallery/constants.d.ts.map +1 -0
- package/lib/typescript/commonjs/zoomable-image-gallery/index.d.ts +3 -0
- package/lib/typescript/commonjs/zoomable-image-gallery/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/zoomable-image-gallery/types.d.ts +46 -0
- package/lib/typescript/commonjs/zoomable-image-gallery/types.d.ts.map +1 -0
- package/lib/typescript/module/button/Button.web.d.ts.map +1 -1
- package/lib/typescript/module/fab/Fab.web.d.ts.map +1 -1
- package/lib/typescript/module/hooks/index.d.ts +1 -0
- package/lib/typescript/module/hooks/index.d.ts.map +1 -1
- package/lib/typescript/module/hooks/useImagePreload.d.ts +10 -0
- package/lib/typescript/module/hooks/useImagePreload.d.ts.map +1 -0
- package/lib/typescript/module/image-aspect-ratio-cache/imageAspectRatioCache.d.ts +14 -0
- package/lib/typescript/module/image-aspect-ratio-cache/imageAspectRatioCache.d.ts.map +1 -0
- package/lib/typescript/module/image-aspect-ratio-cache/index.d.ts +2 -0
- package/lib/typescript/module/image-aspect-ratio-cache/index.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +1 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +1 -0
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/styles/flatten-web-style.d.ts +6 -0
- package/lib/typescript/module/styles/flatten-web-style.d.ts.map +1 -0
- package/lib/typescript/module/zoomable-image-gallery/ZoomableImageGallery.d.ts +5 -0
- package/lib/typescript/module/zoomable-image-gallery/ZoomableImageGallery.d.ts.map +1 -0
- package/lib/typescript/module/zoomable-image-gallery/constants.d.ts +33 -0
- package/lib/typescript/module/zoomable-image-gallery/constants.d.ts.map +1 -0
- package/lib/typescript/module/zoomable-image-gallery/index.d.ts +3 -0
- package/lib/typescript/module/zoomable-image-gallery/index.d.ts.map +1 -0
- package/lib/typescript/module/zoomable-image-gallery/types.d.ts +46 -0
- package/lib/typescript/module/zoomable-image-gallery/types.d.ts.map +1 -0
- package/package.json +27 -1
- package/src/__tests__/Fab.web.test.tsx +62 -0
- package/src/button/Button.web.tsx +6 -36
- package/src/fab/Fab.web.tsx +11 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useImagePreload.ts +51 -0
- package/src/image-aspect-ratio-cache/imageAspectRatioCache.ts +62 -0
- package/src/image-aspect-ratio-cache/index.ts +7 -0
- package/src/index.ts +1 -0
- package/src/index.web.ts +1 -0
- package/src/styles/flatten-web-style.ts +58 -0
- package/src/zoomable-image-gallery/ZoomableImageGallery.tsx +695 -0
- package/src/zoomable-image-gallery/constants.ts +25 -0
- package/src/zoomable-image-gallery/index.ts +8 -0
- package/src/zoomable-image-gallery/types.ts +49 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RADIUS } from '../design-tokens';
|
|
2
|
+
|
|
3
|
+
/** Fraction of the screen the fitted "big" image is allowed to occupy. */
|
|
4
|
+
export const FIT_FRACTION = 0.9;
|
|
5
|
+
/** Drag distance (as a fraction of screen height) that fully fades the backdrop. */
|
|
6
|
+
export const MAX_DRAG_FRACTION = 0.3;
|
|
7
|
+
/** Drag distance (as a fraction of screen height) over which scale floors out. */
|
|
8
|
+
export const SCALE_DRAG_FRACTION = 0.5;
|
|
9
|
+
/** Minimum scale reached while dragging to dismiss. */
|
|
10
|
+
export const MIN_DRAG_SCALE = 0.5;
|
|
11
|
+
/** Drag distance (as a fraction of screen height) past which a drag dismisses. */
|
|
12
|
+
export const DISMISS_FRACTION = 0.15;
|
|
13
|
+
/** Axis-decision threshold (px): the vertical dismiss pan only claims drags past this. */
|
|
14
|
+
export const AXIS_DECISION_OFFSET = 12;
|
|
15
|
+
|
|
16
|
+
export const OPEN_DURATION_WEB = 300;
|
|
17
|
+
export const CLOSE_DURATION_WEB = 280;
|
|
18
|
+
export const OPACITY_DURATION = 200;
|
|
19
|
+
|
|
20
|
+
export const OPEN_SPRING = { damping: 18, stiffness: 400, mass: 0.4 } as const;
|
|
21
|
+
export const CLOSE_SPRING = { damping: 22, stiffness: 450, mass: 0.35 } as const;
|
|
22
|
+
export const SNAP_BACK_SPRING = { damping: 20, stiffness: 400, mass: 0.4 } as const;
|
|
23
|
+
|
|
24
|
+
/** Default corner radius for the zoomed images — Bloom's `radius-12` token. */
|
|
25
|
+
export const DEFAULT_CORNER_RADIUS = RADIUS['radius-12'];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface GalleryImage {
|
|
2
|
+
/** Source URI rendered both as the thumbnail and the zoomed image. */
|
|
3
|
+
uri: string;
|
|
4
|
+
/**
|
|
5
|
+
* Author-authored accessibility description (Bluesky-style "ALT"). When present,
|
|
6
|
+
* shown as a caption at the bottom of the fullscreen viewer for the active image.
|
|
7
|
+
*/
|
|
8
|
+
alt?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Optional intrinsic aspect ratio (width / height) supplied by the consumer.
|
|
11
|
+
* When known ahead of time it avoids a first-frame `Image.getSize` round-trip.
|
|
12
|
+
*/
|
|
13
|
+
aspectRatio?: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* On-screen rectangle of a thumbnail, used to fly the zoom transition to/from
|
|
18
|
+
* the tapped image. Bloom-owned so consumers don't depend on an app-local shape.
|
|
19
|
+
*/
|
|
20
|
+
export interface MeasuredRect {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Resolve the on-screen rect of the thumbnail at `index` within the SAME
|
|
29
|
+
* images-only subset the gallery opens/pages in, so the close animation can fly
|
|
30
|
+
* back to the image currently being viewed. Resolves `null` when the thumbnail
|
|
31
|
+
* ref is missing (unmounted/virtualized), in which case the gallery falls back
|
|
32
|
+
* to a plain center fade-out.
|
|
33
|
+
*/
|
|
34
|
+
export type MeasureThumb = (index: number) => Promise<MeasuredRect | null>;
|
|
35
|
+
|
|
36
|
+
export interface ZoomableImageGalleryHandle {
|
|
37
|
+
/**
|
|
38
|
+
* Open the gallery at `index` within `images`, animating the zoom from the
|
|
39
|
+
* tapped thumbnail's measured screen rect (when provided).
|
|
40
|
+
*/
|
|
41
|
+
open: (images: GalleryImage[], index: number, rect?: MeasuredRect) => void;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface ZoomableImageGalleryProps {
|
|
45
|
+
/** Measures any thumbnail by its images-only subset index, used on dismiss. */
|
|
46
|
+
measureThumb?: MeasureThumb;
|
|
47
|
+
/** Corner radius applied to the zoomed images. Defaults to `DEFAULT_CORNER_RADIUS`. */
|
|
48
|
+
cornerRadius?: number;
|
|
49
|
+
}
|