@imagekit/javascript 5.1.0-beta.1 → 5.2.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.
@@ -1,56 +1,4 @@
1
- import type { SrcOptions } from './interfaces';
2
- export interface GetImageAttributesOptions extends SrcOptions {
3
- /**
4
- * The intended display width of the image in pixels,
5
- * used **only when the `sizes` attribute is not provided**.
6
- *
7
- * Triggers a DPR-based strategy (1x and 2x variants) and generates `x` descriptors in `srcSet`.
8
- *
9
- * Ignored if `sizes` is present.
10
- */
11
- width?: number;
12
- /**
13
- * The value for the HTML `sizes` attribute
14
- * (e.g., `"100vw"` or `"(min-width:768px) 50vw, 100vw"`).
15
- *
16
- * - If it includes one or more `vw` units, breakpoints smaller than the corresponding percentage of the smallest device width are excluded.
17
- * - If it contains no `vw` units, the full breakpoint list is used.
18
- *
19
- * Enables a width-based strategy and generates `w` descriptors in `srcSet`.
20
- */
21
- sizes?: string;
22
- /**
23
- * Custom list of **device-width breakpoints** in pixels.
24
- * These define common screen widths for responsive image generation.
25
- *
26
- * Defaults to `[640, 750, 828, 1080, 1200, 1920, 2048, 3840]`.
27
- * Sorted automatically.
28
- */
29
- deviceBreakpoints?: number[];
30
- /**
31
- * Custom list of **image-specific breakpoints** in pixels.
32
- * Useful for generating small variants (e.g., placeholders or thumbnails).
33
- *
34
- * Merged with `deviceBreakpoints` before calculating `srcSet`.
35
- * Defaults to `[16, 32, 48, 64, 96, 128, 256, 384]`.
36
- * Sorted automatically.
37
- */
38
- imageBreakpoints?: number[];
39
- }
40
- /**
41
- * Resulting set of attributes suitable for an HTML `<img>` element.
42
- * Useful for enabling responsive image loading.
43
- */
44
- export interface ResponsiveImageAttributes {
45
- /** URL for the *largest* candidate (assigned to plain `src`). */
46
- src: string;
47
- /** Candidate set with `w` or `x` descriptors. */
48
- srcSet?: string;
49
- /** `sizes` returned (or synthesised as `100vw`). */
50
- sizes?: string;
51
- /** Width as a number (if `width` was provided). */
52
- width?: number;
53
- }
1
+ import type { ResponsiveImageAttributes, GetImageAttributesOptions } from './interfaces';
54
2
  /**
55
3
  * Generates a responsive image URL, `srcSet`, and `sizes` attributes
56
4
  * based on the input options such as `width`, `sizes`, and breakpoints.
package/dist/url.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import type { SrcOptions } from "./interfaces";
2
- import type { Transformation } from "./interfaces/Transformation";
1
+ import type { SrcOptions, Transformation } from "./interfaces";
3
2
  /**
4
3
  * Builds a source URL with the given options.
5
4
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imagekit/javascript",
3
- "version": "5.1.0-beta.1",
3
+ "version": "5.2.0",
4
4
  "description": "ImageKit Javascript SDK",
5
5
  "main": "dist/imagekit.cjs.js",
6
6
  "module": "dist/imagekit.esm.js",
@@ -1,32 +0,0 @@
1
- import { Transformation } from "./Transformation";
2
- import { TransformationPosition } from ".";
3
- export interface SrcOptions {
4
- /**
5
- * Accepts a relative or absolute path of the resource. If a relative path is provided, it is appended to the `urlEndpoint`.
6
- * If an absolute path is provided, `urlEndpoint` is ignored.
7
- */
8
- src: string;
9
- /**
10
- * Get your urlEndpoint from the [ImageKit dashboard](https://imagekit.io/dashboard/url-endpoints).
11
- */
12
- urlEndpoint: string;
13
- /**
14
- * An array of objects specifying the transformations to be applied in the URL. If more than one transformation is specified, they are applied in the order they are specified as chained transformations.
15
- *
16
- * {@link https://imagekit.io/docs/transformations#chained-transformations}
17
- */
18
- transformation?: Array<Transformation>;
19
- /**
20
- * These are additional query parameters that you want to add to the final URL.
21
- * They can be any query parameters and not necessarily related to ImageKit.
22
- * This is especially useful if you want to add a versioning parameter to your URLs.
23
- */
24
- queryParameters?: {
25
- [key: string]: string | number;
26
- };
27
- /**
28
- * By default, the transformation string is added as a query parameter in the URL, e.g., `?tr=w-100,h-100`.
29
- * If you want to add the transformation string in the path of the URL, set this to `path`.
30
- */
31
- transformationPosition?: TransformationPosition;
32
- }