lightgallery 3.0.0-beta.2 → 3.0.0-beta.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/lightgallery.es5.js +5 -56
- package/dist/lightgallery.es5.js.map +1 -1
- package/dist/lightgallery.min.js +1 -1
- package/dist/lightgallery.umd.js +5 -56
- package/dist/lightgallery.umd.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/plugins/autoplay/lg-autoplay.es5.js +1 -1
- package/dist/plugins/autoplay/lg-autoplay.umd.js +1 -1
- package/dist/plugins/comment/lg-comment.es5.js +1 -1
- package/dist/plugins/comment/lg-comment.umd.js +1 -1
- package/dist/plugins/fullscreen/lg-fullscreen.es5.js +1 -1
- package/dist/plugins/fullscreen/lg-fullscreen.umd.js +1 -1
- package/dist/plugins/hash/lg-hash.es5.js +1 -1
- package/dist/plugins/hash/lg-hash.umd.js +1 -1
- package/dist/plugins/justified/lg-justified.es5.js +1 -1
- package/dist/plugins/justified/lg-justified.umd.js +1 -1
- package/dist/plugins/mediumZoom/lg-medium-zoom.es5.js +1 -1
- package/dist/plugins/mediumZoom/lg-medium-zoom.umd.js +1 -1
- package/dist/plugins/originCrop/lg-origin-crop.es5.js +1 -1
- package/dist/plugins/originCrop/lg-origin-crop.umd.js +1 -1
- package/dist/plugins/pager/lg-pager.es5.js +1 -1
- package/dist/plugins/pager/lg-pager.umd.js +1 -1
- package/dist/plugins/relativeCaption/lg-relative-caption.es5.js +1 -1
- package/dist/plugins/relativeCaption/lg-relative-caption.umd.js +1 -1
- package/dist/plugins/rotate/lg-rotate.es5.js +1 -1
- package/dist/plugins/rotate/lg-rotate.umd.js +1 -1
- package/dist/plugins/share/lg-share.es5.js +1 -1
- package/dist/plugins/share/lg-share.umd.js +1 -1
- package/dist/plugins/thumbnail/lg-thumbnail.es5.js +1 -1
- package/dist/plugins/thumbnail/lg-thumbnail.umd.js +1 -1
- package/dist/plugins/video/lg-video.es5.js +1 -1
- package/dist/plugins/video/lg-video.umd.js +1 -1
- package/dist/plugins/vimeoThumbnail/lg-vimeo-thumbnail.es5.js +1 -1
- package/dist/plugins/vimeoThumbnail/lg-vimeo-thumbnail.umd.js +1 -1
- package/dist/plugins/zoom/lg-zoom.es5.js +1 -1
- package/dist/plugins/zoom/lg-zoom.umd.js +1 -1
- package/dist/types/headless/announce.d.ts +22 -0
- package/dist/types/headless/emitter.d.ts +14 -0
- package/dist/types/headless/gestures.d.ts +128 -0
- package/dist/types/headless/hash-driver.d.ts +77 -0
- package/dist/types/headless/icons.d.ts +56 -0
- package/dist/types/headless/index.d.ts +34 -0
- package/dist/types/headless/items.d.ts +92 -0
- package/dist/types/headless/justified-layout.d.ts +71 -0
- package/dist/types/headless/license.d.ts +35 -0
- package/dist/types/headless/origin-crop.d.ts +135 -0
- package/dist/types/headless/origin.d.ts +65 -0
- package/dist/types/headless/plugin-slices.d.ts +64 -0
- package/dist/types/headless/preload.d.ts +36 -0
- package/dist/types/headless/responsive.d.ts +90 -0
- package/dist/types/headless/settings.d.ts +268 -0
- package/dist/types/headless/share-urls.d.ts +60 -0
- package/dist/types/headless/spring.d.ts +42 -0
- package/dist/types/headless/state.d.ts +63 -0
- package/dist/types/headless/thumb-math.d.ts +85 -0
- package/dist/types/headless/toolbar-overflow.d.ts +61 -0
- package/dist/types/headless/transition.d.ts +33 -0
- package/dist/types/headless/velocity.d.ts +31 -0
- package/dist/types/headless/video-urls.d.ts +64 -0
- package/dist/types/headless/zoom-math.d.ts +89 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/lg-icons.d.ts +1 -1
- package/dist/types/lg-settings.d.ts +1 -7
- package/dist/types/lg-spring-runner.d.ts +1 -1
- package/dist/types/lightgallery.d.ts +0 -1
- package/dist/types/plugins/hash/lg-hash-settings.d.ts +1 -1
- package/dist/types/plugins/video/lg-video-settings.d.ts +1 -1
- package/dist/types/plugins/zoom/lg-zoom.d.ts +1 -1
- package/package.json +56 -71
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-free core logic for lightGallery. Nothing in this package may
|
|
3
|
+
* import a framework or the DOM — the tsconfig excludes the DOM lib so
|
|
4
|
+
* `window`/`document` do not typecheck here by construction.
|
|
5
|
+
*/
|
|
6
|
+
export { createGalleryState, galleryReducer, type CreateGalleryStateOptions, type GalleryAction, type GalleryState, type SlideDirection, } from './state';
|
|
7
|
+
export { getSlideType, type GalleryItem, type ImageSources, type SlideType, } from './items';
|
|
8
|
+
export { createEmitter, type TypedEmitter } from './emitter';
|
|
9
|
+
export { checkLicenseKey, LICENSE_KEY_PREFIX, resolveLicenseKey, setLicenseKey, takeLicenseNotice, TESTING_LICENSE_KEY, type LicenseNotice, } from './license';
|
|
10
|
+
export { formatSlideAnnouncement, type SlideAnnouncementOptions, } from './announce';
|
|
11
|
+
export { createHashDriver, createHistoryHashDriver, createNavigationHashDriver, type HashDriver, type HashDriverPreference, type HashHistoryWindow, type HashNavigationWindow, type NavigationLike, } from './hash-driver';
|
|
12
|
+
export { coreSettingsDefaults, resolveSettings, type CaptionPosition, type GalleryDirection, type ResolvedGalleryDirection, type CoreSettings, type GalleryCoreStrings, type GalleryMode, type MobileSettings, type ResolveSettingsOptions, type UserSettings, type VirtualizationSettings, } from './settings';
|
|
13
|
+
export { getPreloadIndexes, getSlideIndexesInDom, getSlidePoolIndexes, } from './preload';
|
|
14
|
+
export { FLICK_MIN_DISTANCE, FLICK_VELOCITY, SLIDE_EDGE_FRICTION, SWIPE_AXIS_THRESHOLD, VERTICAL_CLOSE_MIN_DRAG, VERTICAL_CLOSE_RATIO, VERTICAL_CLOSE_THRESHOLD, getEdgeFrictionedDelta, getHorizontalDragTransforms, getSwipeAxis, getSwipeReleaseVerdict, getVerticalDragEffects, removePointer, resolveSwipeTarget, shouldCloseOnVerticalDrag, upsertPointer, type HorizontalDragTransforms, type PointerRecord, type SwipeAxis, type SwipeReleaseInput, type SwipeReleaseVerdict, type VerticalDragEffects, } from './gestures';
|
|
15
|
+
export { CENTER_CLOSE_SCALE, fitImageSize, getCenterCloseTransform, getOriginTransform, isUsableOriginRect, parseImageSize, type ImageSize, type OriginTransformInput, type RectLike, } from './origin';
|
|
16
|
+
export { CSS_POSITION_CENTER, WHOLE_IMAGE, getOriginCropFlight, getOriginWindow, isWholeImage, parseBackgroundFit, parseCssPosition, parseCssUrl, parseObjectFit, type CssPosition, type CssPositionAxis, type FractionRect, type OriginCropFlight, type OriginCropFlightInput, type OriginWindow, type OriginWindowInput, type ThumbFit, } from './origin-crop';
|
|
17
|
+
export { autoplayDefaultIcons, type LgIconName, commentDefaultIcons, coreDefaultIcons, fullscreenDefaultIcons, rotateDefaultIcons, shareDefaultIcons, thumbnailDefaultIcons, zoomDefaultIcons, } from './icons';
|
|
18
|
+
export { VIMEO_PLAYER_SCRIPT_URL, WISTIA_PLAYER_SCRIPT_URL, getFacadePoster, getVideoInfo, getVimeoEmbedUrl, getWistiaEmbedUrl, getYouTubeEmbedUrl, getYouTubePosterUrl, isYouTubeNoCookie, param, paramsToObject, type PlayerParams, type VideoInfo, } from './video-urls';
|
|
19
|
+
export { PINCH_OVER_FRICTION, PINCH_UNDER_FRICTION, clampPan, clampPanToStage, clampScale, getActualSizeScale, getPanBounds, getPinchPan, getPinchScale, getPointZoomPan, getPointerDistance, shouldCloseOnPinch, type PanBounds, type ZoomPan, } from './zoom-math';
|
|
20
|
+
export { clampThumbTranslate, getActiveThumbTranslate, getElasticThumbTranslate, getScrubThumbIndex, getScrubThumbTranslate, getThumbCorridorWindow, getThumbTotalWidth, getThumbWindow, type ThumbPagerPosition, type ThumbWindow, } from './thumb-math';
|
|
21
|
+
export { TOOLBAR_DEFAULT_PRIORITY, TOOLBAR_PINNED, consumeBackdropPress, getToolbarItemPriority, getToolbarOverflow, isToolbarEventPath, type MenuDismissEvent, type ToolbarOverflowInput, type ToolbarOverflowItem, } from './toolbar-overflow';
|
|
22
|
+
export { getJustifiedLayout, getJustifiedRows, getRevealableItems, type JustifiedBox, type JustifiedLayout, type JustifiedLayoutOptions, type JustifiedReveal, } from './justified-layout';
|
|
23
|
+
export { onTransitionSettle, type TransitionSettleEvent, type TransitionSettleTarget, } from './transition';
|
|
24
|
+
export { DECODE_TIMEOUT_MS, awaitDecode, getActualSizeWidth, matchesMedia, parseSrcset, resolveImageSource, resolveSizes, type ResolvedImageSource, type SrcsetCandidate, type Viewport, } from './responsive';
|
|
25
|
+
export { DECELERATION_RATE, SPRING_BOUNCE_DAMPING, SPRING_NATURAL_FREQUENCY, SPRING_SETTLE_DAMPING, isSpringSettled, project, stepSpring, type SpringConfig, type SpringState, } from './spring';
|
|
26
|
+
export { VELOCITY_WINDOW_MS, getWindowedVelocity, pushVelocitySample, type Velocity, type VelocitySample, } from './velocity';
|
|
27
|
+
export { applyZoom, flipHorizontal, flipVertical, getRotateFitScale, getRotateTransform, getRotatedVisualSize, isOrientationSwapped, initialAutoplaySlice, initialRotateSlice, initialZoomSlice, rotateLeft, rotateRight, type AutoplaySlice, type RotateSlice, type ZoomSlice, } from './plugin-slices';
|
|
28
|
+
export { canNativeShare, getFacebookShareLink, getPinterestShareLink, getSharePayload, getTwitterShareLink, getXShareLink, type NativeShareNavigator, type ShareItemFields, type SharePayload, } from './share-urls';
|
|
29
|
+
/**
|
|
30
|
+
* Clamp a slide index into the valid range for a gallery of `length` slides.
|
|
31
|
+
* With `loop`, out-of-range indexes wrap around; without it they clamp to the
|
|
32
|
+
* nearest bound. An empty gallery always resolves to 0.
|
|
33
|
+
*/
|
|
34
|
+
export declare function clampIndex(index: number, length: number, loop: boolean): number;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-free gallery item data model, ported from the 2.x `GalleryItem`
|
|
3
|
+
* shape (`src/lg-utils.ts`) minus the DOM-scraping era fields. Data always
|
|
4
|
+
* arrives typed — there is no selector/attribute scraping in 3.x.
|
|
5
|
+
*
|
|
6
|
+
* The caption is generic so each framework can narrow it to its own node type
|
|
7
|
+
* (React narrows `TCaption` to `ReactNode`). Raw-HTML captions go through the
|
|
8
|
+
* deliberately loud `captionHtml` field instead.
|
|
9
|
+
*/
|
|
10
|
+
export interface ImageSources {
|
|
11
|
+
media?: string;
|
|
12
|
+
srcset: string;
|
|
13
|
+
sizes?: string;
|
|
14
|
+
type?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface GalleryItem<TCaption = unknown> {
|
|
17
|
+
/** URL of the media. */
|
|
18
|
+
src?: string;
|
|
19
|
+
/** srcset attribute values for the main image. */
|
|
20
|
+
srcset?: string;
|
|
21
|
+
/** srcset sizes attribute for the main image. */
|
|
22
|
+
sizes?: string;
|
|
23
|
+
/** `<source>` attributes for rendering the image inside a `<picture>`. */
|
|
24
|
+
sources?: ImageSources[];
|
|
25
|
+
/** Thumbnail URL (used by thumbnail plugin and gallery triggers). */
|
|
26
|
+
thumb?: string;
|
|
27
|
+
/** alt attribute for the image. */
|
|
28
|
+
alt?: string;
|
|
29
|
+
/** Title attribute (videos). */
|
|
30
|
+
title?: string;
|
|
31
|
+
/** Caption for the slide, rendered by the framework layer. */
|
|
32
|
+
caption?: TCaption;
|
|
33
|
+
/**
|
|
34
|
+
* Raw-HTML caption opt-in — the explicit analog of 2.x `subHtml` strings.
|
|
35
|
+
* Rendered with the framework's raw-HTML escape hatch
|
|
36
|
+
* (`dangerouslySetInnerHTML` in React); prefer `caption`.
|
|
37
|
+
*/
|
|
38
|
+
captionHtml?: string;
|
|
39
|
+
/** Render the src inside an iframe instead of an image. */
|
|
40
|
+
iframe?: boolean;
|
|
41
|
+
/** Title for the iframe. */
|
|
42
|
+
iframeTitle?: string;
|
|
43
|
+
/**
|
|
44
|
+
* HTML5 video sources (video plugin). Kept loosely typed until
|
|
45
|
+
* the video plugin lands.
|
|
46
|
+
*/
|
|
47
|
+
video?: unknown;
|
|
48
|
+
/** Poster URL for video slides. */
|
|
49
|
+
poster?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Download URL for the media. Pass `false` to hide the download button
|
|
52
|
+
* for this slide.
|
|
53
|
+
*/
|
|
54
|
+
downloadUrl?: string | false;
|
|
55
|
+
/** Filename for the download attribute. */
|
|
56
|
+
download?: string | boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Natural size of the full image as `"width-height"` (2.x
|
|
59
|
+
* `data-lg-size`), optionally a comma separated responsive list
|
|
60
|
+
* `"240-160-375, 1600-1067"`. Required for the zoom-from-origin open
|
|
61
|
+
* animation.
|
|
62
|
+
*/
|
|
63
|
+
lgSize?: string;
|
|
64
|
+
/** Actual image width in px (zoom plugin actual-size math). */
|
|
65
|
+
width?: string;
|
|
66
|
+
/** Custom slide name for the hash plugin. */
|
|
67
|
+
slideName?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Share plugin: canonical per-item URL for the native share sheet
|
|
70
|
+
* (defaults to the network-specific share URLs, then the page URL).
|
|
71
|
+
*/
|
|
72
|
+
shareUrl?: string;
|
|
73
|
+
/** Share plugin: per-item Facebook share URL (defaults to the page URL). */
|
|
74
|
+
facebookShareUrl?: string;
|
|
75
|
+
/** Share plugin: tweet text. */
|
|
76
|
+
tweetText?: string;
|
|
77
|
+
/** Share plugin: per-item Twitter share URL. */
|
|
78
|
+
twitterShareUrl?: string;
|
|
79
|
+
/** Share plugin: per-item Pinterest share URL (must be absolute). */
|
|
80
|
+
pinterestShareUrl?: string;
|
|
81
|
+
/** Share plugin: Pinterest post description. */
|
|
82
|
+
pinterestText?: string;
|
|
83
|
+
/** mediumZoom plugin: per-item backdrop color. */
|
|
84
|
+
lgBackgroundColor?: string;
|
|
85
|
+
}
|
|
86
|
+
export type SlideType = 'image' | 'video' | 'iframe';
|
|
87
|
+
/**
|
|
88
|
+
* Classify a gallery item: html5 `video` sources, a `poster`, or a
|
|
89
|
+
* YouTube/Vimeo/Wistia src URL make it a video (2.x `getSlideType` +
|
|
90
|
+
* `__slideVideoInfo` combined).
|
|
91
|
+
*/
|
|
92
|
+
export declare function getSlideType(item: GalleryItem<unknown>): SlideType;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Justified grid layout for the trigger thumbnails: rows of equal
|
|
3
|
+
* height and varying widths that fill the container edge to edge, the
|
|
4
|
+
* row height staying as close as possible to a target. Pure math —
|
|
5
|
+
* runtimes measure the container, hand in aspect ratios, and position
|
|
6
|
+
* elements from the returned boxes.
|
|
7
|
+
*/
|
|
8
|
+
export interface JustifiedLayoutOptions {
|
|
9
|
+
/** Aspect ratios (width / height) in item order. */
|
|
10
|
+
ratios: readonly number[];
|
|
11
|
+
/** Content-box width available for rows (px). */
|
|
12
|
+
containerWidth: number;
|
|
13
|
+
/** Row height (px) the algorithm aims for. */
|
|
14
|
+
targetRowHeight?: number;
|
|
15
|
+
/** Gap between items and between rows (px). */
|
|
16
|
+
gap?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Last-row policy: `'justify'` scales the leftover row to fill the
|
|
19
|
+
* width like every other row (clamped by `maxScale`), `'start'`
|
|
20
|
+
* keeps the target height aligned to the reading start, `'hide'`
|
|
21
|
+
* drops the leftover items (their boxes come back zero-sized).
|
|
22
|
+
*/
|
|
23
|
+
lastRow?: 'justify' | 'start' | 'hide';
|
|
24
|
+
/**
|
|
25
|
+
* Row-height clamp as a multiple of `targetRowHeight` — a sparse
|
|
26
|
+
* row (single portrait, justified leftovers) never renders taller
|
|
27
|
+
* than `maxScale * targetRowHeight`. Clamped rows align to the
|
|
28
|
+
* reading start instead of filling the width.
|
|
29
|
+
*/
|
|
30
|
+
maxScale?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface JustifiedBox {
|
|
33
|
+
top: number;
|
|
34
|
+
/**
|
|
35
|
+
* Offset from the reading-start edge (logical): the runtime maps
|
|
36
|
+
* it to `left` in LTR and `right` in RTL, the same convention as
|
|
37
|
+
* the thumbnail strip math.
|
|
38
|
+
*/
|
|
39
|
+
start: number;
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
}
|
|
43
|
+
export interface JustifiedLayout {
|
|
44
|
+
/**
|
|
45
|
+
* One box per input ratio, in item order — items hidden by
|
|
46
|
+
* `lastRow: 'hide'` come back zero-sized (runtimes hide them).
|
|
47
|
+
*/
|
|
48
|
+
boxes: JustifiedBox[];
|
|
49
|
+
/** Total content height including the final row (px). */
|
|
50
|
+
containerHeight: number;
|
|
51
|
+
}
|
|
52
|
+
export declare function getJustifiedLayout(options: JustifiedLayoutOptions): JustifiedLayout;
|
|
53
|
+
/**
|
|
54
|
+
* Reveal policy for laid-out thumbnails: 'image' shows each one as it
|
|
55
|
+
* loads, 'row' shows whole rows top to bottom, a row only once every
|
|
56
|
+
* thumbnail in it (and every row above it) has loaded.
|
|
57
|
+
*/
|
|
58
|
+
export type JustifiedReveal = 'row' | 'image';
|
|
59
|
+
/**
|
|
60
|
+
* Group laid-out boxes into rows by their top offset, in layout order.
|
|
61
|
+
* Hidden boxes (0×0, the 'hide' last-row policy) belong to no row.
|
|
62
|
+
* Returns item indexes per row.
|
|
63
|
+
*/
|
|
64
|
+
export declare function getJustifiedRows(boxes: JustifiedBox[]): number[][];
|
|
65
|
+
/**
|
|
66
|
+
* Which laid-out items may show now, given which have loaded: per
|
|
67
|
+
* image, or per row in reading order (see JustifiedReveal). The result
|
|
68
|
+
* is cumulative — callers reveal every returned item that is not
|
|
69
|
+
* already showing.
|
|
70
|
+
*/
|
|
71
|
+
export declare function getRevealableItems<T>(rows: T[][], isLoaded: (item: T) => boolean, reveal: JustifiedReveal): T[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* License key check shared by every package. The key never limits a
|
|
3
|
+
* feature; it only decides which console message, if any, the gallery
|
|
4
|
+
* logs. `checkLicenseKey` is pure; the page-wide key and the once-per-page
|
|
5
|
+
* bookkeeping are module state, and the runtime does the logging.
|
|
6
|
+
*/
|
|
7
|
+
/** The temporary key; also the default `licenseKey`. */
|
|
8
|
+
export declare const TESTING_LICENSE_KEY = "0000-0000-000-0000";
|
|
9
|
+
/** Every lightGallery 3 key starts with this; v1 and v2 keys don't. */
|
|
10
|
+
export declare const LICENSE_KEY_PREFIX = "LIG";
|
|
11
|
+
export interface LicenseNotice {
|
|
12
|
+
level: 'error' | 'warn';
|
|
13
|
+
message: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The console notice for a license key, or `null` for a lightGallery 3
|
|
17
|
+
* key. An empty key is an error; the testing key and keys from v1 or v2
|
|
18
|
+
* (no `LIG` prefix) are warnings.
|
|
19
|
+
*/
|
|
20
|
+
export declare function checkLicenseKey(licenseKey: string | undefined): LicenseNotice | null;
|
|
21
|
+
/**
|
|
22
|
+
* Set the license key once for every gallery on the page. Call it before
|
|
23
|
+
* creating galleries; a gallery's own `licenseKey` still wins.
|
|
24
|
+
*/
|
|
25
|
+
export declare function setLicenseKey(licenseKey: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* The key a gallery runs with: its own `licenseKey`, or the page-wide key
|
|
28
|
+
* when it has none (or only the testing default).
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveLicenseKey(instanceKey: string | undefined): string;
|
|
31
|
+
/**
|
|
32
|
+
* The notice a new gallery should log, or `null`. Each message is logged
|
|
33
|
+
* once per page, however many galleries share the key.
|
|
34
|
+
*/
|
|
35
|
+
export declare function takeLicenseNotice(instanceKey: string | undefined): LicenseNotice | null;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Math for the origin crop plugin: zoom-from-origin flights from cropped
|
|
3
|
+
* thumbnails. A grid tile cropped with `object-fit: cover` (or
|
|
4
|
+
* `background-size: cover`) shows only a window of the image. The plugin
|
|
5
|
+
* grows that window from the tile at a uniform scale while two boxes
|
|
6
|
+
* around the slides crop the rest of the image, revealed as the flight
|
|
7
|
+
* lands. Pure rect arithmetic: the plugin measures the DOM and passes
|
|
8
|
+
* plain numbers in. The core flight (`origin.ts`) never imports this.
|
|
9
|
+
*/
|
|
10
|
+
import { type ImageSize, type RectLike } from './origin';
|
|
11
|
+
/** A region of an image as fractions of its width and height (0..1). */
|
|
12
|
+
export interface FractionRect {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
}
|
|
18
|
+
/** The whole image: the window of an uncropped thumbnail. */
|
|
19
|
+
export declare const WHOLE_IMAGE: FractionRect;
|
|
20
|
+
/** Whether a region covers the whole image (within rounding). */
|
|
21
|
+
export declare function isWholeImage(rect: FractionRect): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* How a trigger paints its thumbnail file into its box: the CSS
|
|
24
|
+
* `object-fit` of an `<img>`, or the `background-size` keyword of an
|
|
25
|
+
* element with a background image.
|
|
26
|
+
*/
|
|
27
|
+
export type ThumbFit = 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
|
|
28
|
+
/**
|
|
29
|
+
* One axis of a CSS `object-position`/`background-position`: a share of
|
|
30
|
+
* the free space (the box minus the painted image) plus a px offset.
|
|
31
|
+
*/
|
|
32
|
+
export interface CssPositionAxis {
|
|
33
|
+
percent: number;
|
|
34
|
+
px: number;
|
|
35
|
+
}
|
|
36
|
+
export interface CssPosition {
|
|
37
|
+
x: CssPositionAxis;
|
|
38
|
+
y: CssPositionAxis;
|
|
39
|
+
}
|
|
40
|
+
/** The CSS default, `50% 50%`. */
|
|
41
|
+
export declare const CSS_POSITION_CENTER: CssPosition;
|
|
42
|
+
/**
|
|
43
|
+
* Parse a computed `object-position` or `background-position` value
|
|
44
|
+
* (`"50% 50%"`, `"10px 20px"`, `"calc(100% - 10px) 0%"`, keywords).
|
|
45
|
+
* Unparseable values fall back to the centre. Only the first layer of a
|
|
46
|
+
* multi-layer background is read.
|
|
47
|
+
*/
|
|
48
|
+
export declare function parseCssPosition(value: string | undefined): CssPosition;
|
|
49
|
+
/** Parse a computed `object-fit` value; the CSS default is `fill`. */
|
|
50
|
+
export declare function parseObjectFit(value: string | undefined): ThumbFit;
|
|
51
|
+
/**
|
|
52
|
+
* Parse a computed `background-size` value into the fit it paints like:
|
|
53
|
+
* `cover` and `contain` as themselves, `auto` as `none` (natural size),
|
|
54
|
+
* `100% 100%` as `fill`. Explicit lengths cannot be modelled and return
|
|
55
|
+
* undefined. Only the first layer of a multi-layer background is read.
|
|
56
|
+
*/
|
|
57
|
+
export declare function parseBackgroundFit(value: string | undefined): ThumbFit | undefined;
|
|
58
|
+
/** The first URL of a computed `background-image` value, if any. */
|
|
59
|
+
export declare function parseCssUrl(value: string | undefined): string | undefined;
|
|
60
|
+
export interface OriginWindowInput {
|
|
61
|
+
/** Rendered box of the trigger (thumbnail img or background element), viewport px. */
|
|
62
|
+
box: RectLike;
|
|
63
|
+
/** The full image; only its aspect ratio matters. */
|
|
64
|
+
imageSize: ImageSize;
|
|
65
|
+
/**
|
|
66
|
+
* Natural size of the thumbnail file when known (an `<img>`'s
|
|
67
|
+
* `naturalWidth`/`naturalHeight`). A file with a different aspect ratio
|
|
68
|
+
* than the image is taken as a centred crop of it. Unknown (a background
|
|
69
|
+
* image, an unloaded img) assumes the image's own aspect ratio.
|
|
70
|
+
*/
|
|
71
|
+
thumbSize?: ImageSize;
|
|
72
|
+
/** How the file is painted into the box. Defaults to `fill`. */
|
|
73
|
+
fit?: ThumbFit;
|
|
74
|
+
/** Where the painted file sits in the box. Defaults to the centre. */
|
|
75
|
+
position?: CssPosition;
|
|
76
|
+
}
|
|
77
|
+
export interface OriginWindow {
|
|
78
|
+
/**
|
|
79
|
+
* The part of the trigger box that shows thumbnail pixels, viewport px:
|
|
80
|
+
* the box itself unless the file is letterboxed inside it.
|
|
81
|
+
*/
|
|
82
|
+
rect: RectLike;
|
|
83
|
+
/** The part of the image visible in `rect`, as fractions of the image. */
|
|
84
|
+
window: FractionRect;
|
|
85
|
+
/**
|
|
86
|
+
* The part of the image the thumbnail file covers, as fractions: the
|
|
87
|
+
* whole image unless the file is pre-cropped. Sizes the flight's
|
|
88
|
+
* dummy, which shows the file, so its pixels land where they belong.
|
|
89
|
+
*/
|
|
90
|
+
region: FractionRect;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Where a thumbnail's visible pixels sit in the full image. Models the CSS
|
|
94
|
+
* fit and position of the file inside its box, and a pre-cropped file as a
|
|
95
|
+
* centred crop of the image.
|
|
96
|
+
*/
|
|
97
|
+
export declare function getOriginWindow(input: OriginWindowInput): OriginWindow;
|
|
98
|
+
export interface OriginCropFlightInput {
|
|
99
|
+
/**
|
|
100
|
+
* The part of the trigger showing thumbnail pixels
|
|
101
|
+
* ({@link OriginWindow.rect}), viewport px.
|
|
102
|
+
*/
|
|
103
|
+
triggerRect: RectLike;
|
|
104
|
+
/** Bounding rect of the gallery outer element, viewport coordinates. */
|
|
105
|
+
containerRect: RectLike;
|
|
106
|
+
/** Media container top offset (toolbar height), px. */
|
|
107
|
+
top: number;
|
|
108
|
+
/** Media container bottom offset (caption + thumb strip height), px. */
|
|
109
|
+
bottom: number;
|
|
110
|
+
/** Final displayed image size (see `fitImageSize`). */
|
|
111
|
+
imageSize: ImageSize;
|
|
112
|
+
/** The part of the image the trigger shows ({@link OriginWindow.window}). */
|
|
113
|
+
window: FractionRect;
|
|
114
|
+
}
|
|
115
|
+
export interface OriginCropFlight {
|
|
116
|
+
/**
|
|
117
|
+
* The slide's transform: the window lands on the trigger, at a uniform
|
|
118
|
+
* scale, inside the translated stage boxes.
|
|
119
|
+
*/
|
|
120
|
+
transform: string;
|
|
121
|
+
/** The outer stage box: its bottom-right corner on the trigger's. */
|
|
122
|
+
outer: string;
|
|
123
|
+
/** The inner stage box: its top-left corner on the trigger's. */
|
|
124
|
+
inner: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The start of a flight from a cropped thumbnail (and the end of the flight
|
|
128
|
+
* back to it). Two stage-sized, overflow-hidden boxes wrap the slides: the
|
|
129
|
+
* outer one translates so that its bottom-right corner sits on the
|
|
130
|
+
* trigger's, the inner one so that its top-left corner sits on the
|
|
131
|
+
* trigger's, and their intersection is exactly the trigger's box. As both
|
|
132
|
+
* transition back to rest with the slide, the crop's edges move linearly on
|
|
133
|
+
* screen out to the whole stage, and only transforms animate.
|
|
134
|
+
*/
|
|
135
|
+
export declare function getOriginCropFlight(input: OriginCropFlightInput): OriginCropFlight;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zoom-from-origin math, ported from 2.x `utils.getSize`/`utils.getTransform`
|
|
3
|
+
* (`src/lg-utils.ts`) as pure rect arithmetic. The framework layer measures
|
|
4
|
+
* the DOM (trigger/container bounding rects) and passes plain numbers in.
|
|
5
|
+
*
|
|
6
|
+
* Note: this module is an addition to the ADR 0001 §1 table — it
|
|
7
|
+
* follows the standing rule that pure functions needed by React live in
|
|
8
|
+
* headless. It is distinct from `zoom-math.ts` (zoom plugin).
|
|
9
|
+
*/
|
|
10
|
+
export interface ImageSize {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}
|
|
14
|
+
export interface RectLike {
|
|
15
|
+
left: number;
|
|
16
|
+
top: number;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Parse an item's `lgSize` value (`"1920-1280"`, or a responsive list like
|
|
22
|
+
* `"240-160-375, 1600-1067"` where the third number is the max viewport
|
|
23
|
+
* width the entry applies to).
|
|
24
|
+
*/
|
|
25
|
+
export declare function parseImageSize(lgSize: string | undefined, viewportWidth: number): ImageSize | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Fit a natural image size into the available container box, preserving
|
|
28
|
+
* aspect ratio and never scaling up (2.x `utils.getSize` math).
|
|
29
|
+
*/
|
|
30
|
+
export declare function fitImageSize(size: ImageSize, containerWidth: number, containerHeight: number): ImageSize;
|
|
31
|
+
/**
|
|
32
|
+
* Whether a measured trigger rect can anchor the zoom-from-origin flight.
|
|
33
|
+
* A trigger that is hidden (`display: none`, the `hidden` attribute),
|
|
34
|
+
* detached or collapsed measures 0×0 at the viewport origin; a flight
|
|
35
|
+
* aimed at it would shrink the slide into the top-left corner.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isUsableOriginRect(rect: RectLike | null | undefined): rect is RectLike;
|
|
38
|
+
/** Scale the closing slide shrinks to when it has no trigger to return to. */
|
|
39
|
+
export declare const CENTER_CLOSE_SCALE = 0.5;
|
|
40
|
+
/**
|
|
41
|
+
* Close transform for a slide without a usable origin (hidden or
|
|
42
|
+
* collapsed trigger, no `lgSize`): shrink in place about the stage centre,
|
|
43
|
+
* the mirror of the `lg-start-zoom` open. The runtime pairs it with the
|
|
44
|
+
* `lg-close-to-center` class, which fades the slide out over the same
|
|
45
|
+
* duration.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getCenterCloseTransform(scale?: number): string;
|
|
48
|
+
export interface OriginTransformInput {
|
|
49
|
+
/** Bounding rect of the trigger thumbnail image, viewport coordinates. */
|
|
50
|
+
triggerRect: RectLike;
|
|
51
|
+
/** Bounding rect of the gallery outer element, viewport coordinates. */
|
|
52
|
+
containerRect: RectLike;
|
|
53
|
+
/** Media container top offset (toolbar height), px. */
|
|
54
|
+
top: number;
|
|
55
|
+
/** Media container bottom offset (caption + thumb strip height), px. */
|
|
56
|
+
bottom: number;
|
|
57
|
+
/** Final displayed image size (see {@link fitImageSize}). */
|
|
58
|
+
imageSize: ImageSize;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* CSS transform that places the (centered, final-size) slide image exactly
|
|
62
|
+
* over the trigger thumbnail — the starting point of the zoom-from-origin
|
|
63
|
+
* open animation and the end point of the close animation.
|
|
64
|
+
*/
|
|
65
|
+
export declare function getOriginTransform(input: OriginTransformInput): string;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed per-plugin state slices (ADR 0001 §5). Framework layers hold these
|
|
3
|
+
* in their own reactivity; the shapes and transitions live here so plugin
|
|
4
|
+
* behavior matches across frameworks.
|
|
5
|
+
*/
|
|
6
|
+
import { type ZoomPan } from './zoom-math';
|
|
7
|
+
export interface ZoomSlice {
|
|
8
|
+
scale: number;
|
|
9
|
+
pan: ZoomPan;
|
|
10
|
+
zoomed: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const initialZoomSlice: ZoomSlice;
|
|
13
|
+
/** Per-slide rotate/flip state (rotate plugin). */
|
|
14
|
+
export interface RotateSlice {
|
|
15
|
+
/** Rotation in degrees (multiples of 90, may run negative). */
|
|
16
|
+
rotate: number;
|
|
17
|
+
/** 1 or -1. */
|
|
18
|
+
flipHorizontal: number;
|
|
19
|
+
/** 1 or -1. */
|
|
20
|
+
flipVertical: number;
|
|
21
|
+
}
|
|
22
|
+
export declare const initialRotateSlice: RotateSlice;
|
|
23
|
+
export declare function rotateLeft(slice: RotateSlice): RotateSlice;
|
|
24
|
+
export declare function rotateRight(slice: RotateSlice): RotateSlice;
|
|
25
|
+
export declare function flipHorizontal(slice: RotateSlice): RotateSlice;
|
|
26
|
+
export declare function flipVertical(slice: RotateSlice): RotateSlice;
|
|
27
|
+
/** Whether the slice's rotation swaps the image's visual axes (90°/270°). */
|
|
28
|
+
export declare function isOrientationSwapped(slice: RotateSlice): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Scale that refits a rotated image into its stage. At 90°/270° the
|
|
31
|
+
* image's rendered width runs vertically (and vice versa), so the fit is
|
|
32
|
+
* computed against the swapped axes; capped at 1 — rotation never
|
|
33
|
+
* upscales. At 0°/180° (and with degenerate dimensions) the image already
|
|
34
|
+
* fits the way it was laid out: scale 1.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getRotateFitScale(imageWidth: number, imageHeight: number, stageWidth: number, stageHeight: number, slice: RotateSlice): number;
|
|
37
|
+
/**
|
|
38
|
+
* CSS transform for a rotate slice (2.x `applyStyles`), with the fit
|
|
39
|
+
* scale folded into the same transform so rotate + refit animate as one
|
|
40
|
+
* motion. `fitScale` defaults to 1 (the 2.x output, byte-identical).
|
|
41
|
+
*/
|
|
42
|
+
export declare function getRotateTransform(slice: RotateSlice, fitScale?: number): string;
|
|
43
|
+
/**
|
|
44
|
+
* Visual footprint of an image sitting inside the rotate wrapper.
|
|
45
|
+
* Layout offsets ignore CSS transforms, so pan-bounds math fed by
|
|
46
|
+
* them sees the unrotated box: at 90°/270° the rendered width runs
|
|
47
|
+
* along the layout height (and vice versa), and the folded-in fit
|
|
48
|
+
* scale shrinks both axes. `transform` is the wrapper's inline style
|
|
49
|
+
* (`getRotateTransform` output); absent or unparseable input reads
|
|
50
|
+
* as unrotated.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getRotatedVisualSize(width: number, height: number, transform: string | null | undefined): {
|
|
53
|
+
width: number;
|
|
54
|
+
height: number;
|
|
55
|
+
};
|
|
56
|
+
/** Autoplay run-state (autoplay plugin). */
|
|
57
|
+
export interface AutoplaySlice {
|
|
58
|
+
running: boolean;
|
|
59
|
+
pausedOnDrag: boolean;
|
|
60
|
+
pausedOnSlideChange: boolean;
|
|
61
|
+
}
|
|
62
|
+
export declare const initialAutoplaySlice: AutoplaySlice;
|
|
63
|
+
/** Commit a zoom change; scale 1 always recenters (2.x behavior). */
|
|
64
|
+
export declare function applyZoom(_slice: ZoomSlice, scale: number, pan: ZoomPan, maxScale: number, infiniteZoom: boolean): ZoomSlice;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slide windowing and preload math, ported from 2.x
|
|
3
|
+
* `getItemsToBeInsertedToDom` / `preload` (`src/lightgallery.ts`). Pure
|
|
4
|
+
* index arithmetic — the framework layer maps the returned indexes to
|
|
5
|
+
* mounted slide components.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Which slide indexes should be mounted for a given current/previous index.
|
|
9
|
+
*
|
|
10
|
+
* Mirrors 2.x behavior: at least 3 items (capped at the gallery length),
|
|
11
|
+
* the window centered around `index` biased by which half of the gallery it
|
|
12
|
+
* falls in, plus the far-end slide at the edges when `loop` is on, plus the
|
|
13
|
+
* previous slide so an outgoing transition can finish.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getSlideIndexesInDom(index: number, prevIndex: number, slidesCount: number, numberOfItems?: number, loop?: boolean): number[];
|
|
16
|
+
/**
|
|
17
|
+
* Slide-pool policy (plan 010 virtualization): the mounted-slide window
|
|
18
|
+
* from `getSlideIndexesInDom`, plus any protected indexes that must never
|
|
19
|
+
* be recycled while they hold live state — a zoomed slide keeps its
|
|
20
|
+
* transform/gesture session, so recycling it would drop the user's zoom.
|
|
21
|
+
* Protected indexes outside the gallery bounds are ignored.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getSlidePoolIndexes(options: {
|
|
24
|
+
index: number;
|
|
25
|
+
prevIndex: number;
|
|
26
|
+
slidesCount: number;
|
|
27
|
+
poolSize?: number;
|
|
28
|
+
loop?: boolean;
|
|
29
|
+
protectedIndexes?: readonly number[];
|
|
30
|
+
}): number[];
|
|
31
|
+
/**
|
|
32
|
+
* Indexes to preload around `index` once the current slide has finished
|
|
33
|
+
* loading: up to `preload` slides forward and backward, clamped at the
|
|
34
|
+
* gallery bounds (no wrap-around — 2.x parity).
|
|
35
|
+
*/
|
|
36
|
+
export declare function getPreloadIndexes(index: number, preload: number, slidesCount: number): number[];
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Responsive image selection + decode gating (plan: responsive loading).
|
|
3
|
+
*
|
|
4
|
+
* The browser already picks a candidate natively when the runtimes render
|
|
5
|
+
* `<picture>`/`srcset` — these helpers exist for the places that need the
|
|
6
|
+
* DECISION as data: preload warming at the right resolution, tooling, and
|
|
7
|
+
* the framework image-component recipes. The algorithm mirrors the HTML
|
|
8
|
+
* spec's srcset selection closely enough to be deterministic and
|
|
9
|
+
* unit-testable: parse candidates, derive the slot width from `sizes`,
|
|
10
|
+
* scale by DPR, pick the smallest candidate that covers the target
|
|
11
|
+
* (falling back to the largest available).
|
|
12
|
+
*/
|
|
13
|
+
import type { GalleryItem, ImageSources } from './items';
|
|
14
|
+
export interface SrcsetCandidate {
|
|
15
|
+
url: string;
|
|
16
|
+
/** Width descriptor (`640w`) in px, if given. */
|
|
17
|
+
width?: number;
|
|
18
|
+
/** Density descriptor (`2x`), if given; bare candidates read as 1x. */
|
|
19
|
+
density?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface Viewport {
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
/** devicePixelRatio; defaults to 1. */
|
|
25
|
+
dpr?: number;
|
|
26
|
+
}
|
|
27
|
+
/** Parse a `srcset` attribute string into candidates. Malformed entries
|
|
28
|
+
* are skipped rather than thrown — item data is author-provided. */
|
|
29
|
+
export declare function parseSrcset(srcset: string | undefined): SrcsetCandidate[];
|
|
30
|
+
/**
|
|
31
|
+
* Effective slot width (px) from a `sizes` attribute for a viewport.
|
|
32
|
+
* Supports the common authored forms deterministically: comma-separated
|
|
33
|
+
* `(min-width: Npx) <len>` / `(max-width: Npx) <len>` clauses with a
|
|
34
|
+
* bare `<len>` default, where `<len>` is `px` or `vw`. The first
|
|
35
|
+
* matching clause wins (spec order). Unsupported conditions are skipped;
|
|
36
|
+
* no match falls back to the full viewport width (`100vw`, the spec
|
|
37
|
+
* default).
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveSizes(sizes: string | undefined, viewportWidth: number): number;
|
|
40
|
+
/** Whether a `<source media>` condition matches the viewport. Same
|
|
41
|
+
* deterministic subset as {@link resolveSizes}: min/max-width in px;
|
|
42
|
+
* unsupported conditions read as NOT matching. Absent media matches. */
|
|
43
|
+
export declare function matchesMedia(media: string | undefined, viewport: Viewport): boolean;
|
|
44
|
+
export interface ResolvedImageSource {
|
|
45
|
+
src: string;
|
|
46
|
+
/** Intrinsic width (px) when the winning candidate declared one. */
|
|
47
|
+
width?: number;
|
|
48
|
+
/** The `<source>` entry that won, when selection went through
|
|
49
|
+
* `sources` (picture semantics) rather than the item srcset. */
|
|
50
|
+
source?: ImageSources;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Deterministically resolve which image URL a viewport displays for an
|
|
54
|
+
* item, mirroring picture/srcset semantics: the first matching
|
|
55
|
+
* `sources[]` entry wins (spec order), then the item-level
|
|
56
|
+
* `srcset`/`sizes`, then plain `src`. Returns null for items with no
|
|
57
|
+
* image source at all.
|
|
58
|
+
*/
|
|
59
|
+
export declare function resolveImageSource(item: Pick<GalleryItem, 'src' | 'srcset' | 'sizes' | 'sources'>, viewport: Viewport): ResolvedImageSource | null;
|
|
60
|
+
/**
|
|
61
|
+
* The width "actual size" zoom refers to. `img.naturalWidth` LIES under
|
|
62
|
+
* `srcset`/`sizes`: w-descriptor selection density-corrects the
|
|
63
|
+
* intrinsic size to roughly the layout slot — on phones that collapses
|
|
64
|
+
* the actual-size scale to ~1 and kills double-tap/pinch zoom. The
|
|
65
|
+
* resolution order mirrors what the item DECLARES before trusting the
|
|
66
|
+
* element: explicit `width` (2.x `data-width`), the largest candidate
|
|
67
|
+
* the srcset ladder can serve (first matching `sources[]` entry per
|
|
68
|
+
* picture semantics, else the item srcset), the `lgSize` natural dims,
|
|
69
|
+
* and only then the reported natural width. The declared tiers are what
|
|
70
|
+
* make optimizer components (next/image, NuxtImg, NgOptimizedImage) —
|
|
71
|
+
* which manage their own srcset — zoomable to full resolution.
|
|
72
|
+
*/
|
|
73
|
+
export declare function getActualSizeWidth(item: Pick<GalleryItem, 'width' | 'srcset' | 'sources' | 'lgSize'>, viewport: Viewport, naturalWidth: number): number;
|
|
74
|
+
/**
|
|
75
|
+
* How long a slide waits on `img.decode()` before completing anyway —
|
|
76
|
+
* the gate must never strand a slide on a browser that rejects or
|
|
77
|
+
* stalls decode (huge images evict decoded data; some UAs reject on
|
|
78
|
+
* detached nodes).
|
|
79
|
+
*/
|
|
80
|
+
export declare const DECODE_TIMEOUT_MS = 500;
|
|
81
|
+
/**
|
|
82
|
+
* Decode gate: resolve when the image is safe to paint — after
|
|
83
|
+
* `decode()` settles (success OR rejection; rejection still means the
|
|
84
|
+
* data arrived) or after the timeout, whichever is first. Browsers
|
|
85
|
+
* without `decode()` resolve immediately (the load event already
|
|
86
|
+
* fired). Never rejects.
|
|
87
|
+
*/
|
|
88
|
+
export declare function awaitDecode(img: {
|
|
89
|
+
decode?: () => Promise<void>;
|
|
90
|
+
}, timeoutMs?: number): Promise<void>;
|