imgix-url-builder 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -41,15 +41,133 @@ const buildWidthSrcSet = (url, { widths, ...params }) => {
41
41
  };
42
42
 
43
43
  class Client {
44
+ /**
45
+ * Creates a new `Client` instance for an Imgix domain.
46
+ *
47
+ * @param options - Options to instantiate a new client.
48
+ *
49
+ * @returns A `Client` instance for the given Imgix domain.
50
+ */
44
51
  constructor(options) {
45
52
  this.baseURL = options.baseURL;
46
53
  }
54
+ /**
55
+ * Builds a URL to an Imgix image with Imgix URL API parameters for the
56
+ * client's base URL.
57
+ *
58
+ * @example
59
+ *
60
+ * ```ts
61
+ * const client = new Client({ baseURL: "https://example.imgix.net" });
62
+ * const url = client.buildURLForPath("/image.png", { width: 400 });
63
+ * // => https://example.imgix.net/image.png?width=400
64
+ * ```
65
+ *
66
+ * @example
67
+ *
68
+ * ```ts
69
+ * const client = new Client({
70
+ * baseURL: "https://example.imgix.net/folder",
71
+ * });
72
+ * const url = client.buildURLForPath("./image.png", { width: 400 });
73
+ * // => https://example.imgix.net/folder/image.png?width=400
74
+ * ```
75
+ *
76
+ * @param path - Path to the image relative to the client's base URL.
77
+ * @param params - An object of Imgix URL API parameters.
78
+ *
79
+ * @returns The full absolute URL to the image with the given Imgix URL API
80
+ * parameters applied.
81
+ */
47
82
  buildURLForPath(path, params = {}) {
48
83
  return buildURL(`${new URL(path, this.baseURL)}`, params);
49
84
  }
85
+ /**
86
+ * Builds an `<img>` `srcset` attribute value for a given set of widths for
87
+ * the client's base URL. It can also optinally apply Imgix URL API parameters
88
+ * to the URLs.
89
+ *
90
+ * The `width` URL parameter will be applied for each `srcset` entry. If a
91
+ * `width` or `w` parameter is provided to the `params` parameter, it will be
92
+ * ignored.
93
+ *
94
+ * @example
95
+ *
96
+ * ```ts
97
+ * const client = new Client({ baseURL: "https://example.imgix.net" });
98
+ * const srcset = client.buildWidthSrcSetForPath("/image.png", {
99
+ * widths: [400, 800, 1600],
100
+ * });
101
+ * // => https://example.imgix.net/image.png?width=400 400w,
102
+ * // https://example.imgix.net/image.png?width=800 800w,
103
+ * // https://example.imgix.net/image.png?width=1600 1600w
104
+ * ```
105
+ *
106
+ * @example
107
+ *
108
+ * ```ts
109
+ * const client = new Client({
110
+ * baseURL: "https://example.imgix.net",
111
+ * });
112
+ * const srcset = client.buildWidthSrcSetForPath("/image.png", {
113
+ * widths: [400, 800, 1600],
114
+ * sat: -100,
115
+ * });
116
+ * // => https://example.imgix.net/image.png?width=400&sat=-100 400w,
117
+ * // https://example.imgix.net/image.png?width=800&sat=-100 800w,
118
+ * // https://example.imgix.net/image.png?width=1600&sat=-100 1600w
119
+ * ```
120
+ *
121
+ * @param path - Path to the image relative to the client's base URL.
122
+ * @param params - An object of Imgix URL API parameters. The `widths`
123
+ * parameter defines the resulting `srcset` widths.
124
+ *
125
+ * @returns A `srcset` attribute value for `url` with the given Imgix URL API
126
+ * parameters applied.
127
+ */
50
128
  buildWidthSrcSetForPath(path, params) {
51
129
  return buildWidthSrcSet(`${new URL(path, this.baseURL)}`, params);
52
130
  }
131
+ /**
132
+ * Builds an `<img>` `srcset` attribute value for a given set of pixel
133
+ * densities for the client's base URL. It can also optinally apply Imgix URL
134
+ * API parameters to the URLs.
135
+ *
136
+ * The `dpr` URL parameter will be applied for each `srcset` entry. If a `dpr`
137
+ * parameter is provided to the `params` parameter, it will be ignored.
138
+ *
139
+ * @example
140
+ *
141
+ * ```ts
142
+ * const client = new Client({ baseURL: "https://example.imgix.net" });
143
+ * const srcset = client.buildPixelDensitySrcSetForPath("/image.png", {
144
+ * pixelDensities: [1, 2, 3],
145
+ * });
146
+ * // => https://example.imgix.net/image.png?dpr=1 1x,
147
+ * // https://example.imgix.net/image.png?dpr=2 2x,
148
+ * // https://example.imgix.net/image.png?dpr=3 3x
149
+ * ```
150
+ *
151
+ * @example
152
+ *
153
+ * ```ts
154
+ * const client = new Client({ baseURL: "https://example.imgix.net" });
155
+ * const srcset = client.buildPixelDensitySrcSetForPath("/image.png", {
156
+ * pixelDensities: [1, 2, 3],
157
+ * sat: -100,
158
+ * });
159
+ * // => https://example.imgix.net/image.png?dpr=1&sat=-100 1x,
160
+ * // https://example.imgix.net/image.png?dpr=2&sat=-100 2x,
161
+ * // https://example.imgix.net/image.png?dpr=3&sat=-100 3x
162
+ * ```
163
+ *
164
+ * @param path - Path to the image relative to the client's base URL.
165
+ * @param params - An object of Imgix URL API parameters. The `pixelDensities`
166
+ * parameter defines the resulting `srcset` widths.
167
+ *
168
+ * @returns A `srcset` attribute value for `url` with the given Imgix URL API
169
+ * parameters applied.
170
+ */
53
171
  buildPixelDensitySrcSetForPath(path, params) {
54
172
  return buildPixelDensitySrcSet(`${new URL(path, this.baseURL)}`, params);
55
173
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/buildURL.ts","../src/buildPixelDensitySrcSet.ts","../src/buildWidthSrcSet.ts","../src/Client.ts"],"sourcesContent":["import type { ImgixURLParams } from \"./types.generated\";\n\n/**\n * Converts a camel case string to a param case string.\n *\n * @example\n *\n * ```ts\n * camelCaseToParamCase(\"fooBar\");\n * // => 'foo-bar'\n * ```\n *\n * @param input - Camel case string to convert.\n *\n * @returns Param case version of `input`.\n */\nconst camelCaseToParamCase = (input: string): string => {\n\treturn input.replace(/[A-Z]/g, (match) => {\n\t\treturn `-${match.toLowerCase()}`;\n\t});\n};\n\n/**\n * Builds a URL to an Imgix image with Imgix URL API parameters.\n *\n * The given URL must be a full absolute URL containing the protocol and domain.\n *\n * URL parameters already applied to the image will be retained. To remove\n * existing parameters, set the parameter to `undefined` in the `params` argument.\n *\n * @example\n *\n * ```ts\n * const url = buildURL(\"https://example.imgix.net/image.png\", {\n * \twidth: 400,\n * });\n * // => https://example.imgix.net/image.png?width=400\n * ```\n *\n * @example\n *\n * ```ts\n * const url = buildURL(\"https://example.imgix.net/image.png?width=400\", {\n * \theight: 300,\n * });\n * // => https://example.imgix.net/image.png?width=400&height=300\n * ```\n *\n * @param url - Full absolute URL to the Imgix image.\n * @param params - An object of Imgix URL API parameters.\n *\n * @returns `url` with the given Imgix URL API parameters applied.\n *\n * @see Imgix URL API reference: https://docs.imgix.com/apis/rendering\n */\nexport const buildURL = (url: string, params: ImgixURLParams): string => {\n\tconst instance = new URL(url);\n\n\tfor (const camelCasedParamKey in params) {\n\t\tconst paramKey = camelCaseToParamCase(camelCasedParamKey);\n\t\tconst paramValue = params[camelCasedParamKey as keyof typeof params];\n\n\t\tif (paramValue === undefined) {\n\t\t\tinstance.searchParams.delete(paramKey);\n\t\t} else if (Array.isArray(paramValue)) {\n\t\t\tinstance.searchParams.set(paramKey, paramValue.join(\",\"));\n\t\t} else {\n\t\t\tinstance.searchParams.set(paramKey, `${paramValue}`);\n\t\t}\n\t}\n\n\t// Ensure the `s` parameter is the last parameter, if it exists.\n\t// @see https://github.com/imgix/imgix-blueprint#securing-urls\n\tconst s = instance.searchParams.get(\"s\");\n\tif (s) {\n\t\tinstance.searchParams.delete(\"s\");\n\t\tinstance.searchParams.append(\"s\", s);\n\t}\n\n\treturn instance.toString();\n};\n","import type { ImgixURLParams } from \"./types.generated\";\nimport { buildURL } from \"./buildURL\";\n\n/**\n * Parameters for `buildPixelDensitySrcSet`.\n */\nexport type BuildPixelDensitySrcSetParams = Omit<ImgixURLParams, \"dpr\"> & {\n\t/**\n\t * The pixel densities to include in the resulting `srcset` value.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * [1, 2, 3];\n\t * ```\n\t */\n\tpixelDensities: number[];\n};\n\n/**\n * Builds an `<img>` `srcset` attribute value for a given set of pixel\n * densities. It can also optinally apply Imgix URL API parameters to the URLs.\n *\n * The `dpr` URL parameter will be applied for each `srcset` entry. If a `dpr`\n * parameter is provided to the `params` parameter, it will be ignored.\n *\n * @example\n *\n * ```ts\n * const srcset = buildPixelDensitySrcSet(\n * \t\"https://example.imgix.net/image.png\",\n * \t{ pixelDensities: [1, 2, 3] },\n * );\n * // => https://example.imgix.net/image.png?dpr=1 1x,\n * // https://example.imgix.net/image.png?dpr=2 2x,\n * // https://example.imgix.net/image.png?dpr=3 3x\n * ```\n *\n * @example\n *\n * ```ts\n * const srcset = buildPixelDensitySrcSet(\n * \t\"https://example.imgix.net/image.png\",\n * \t{\n * \t\tpixelDensities: [1, 2, 3],\n * \t\tsat: -100,\n * \t},\n * );\n * // => https://example.imgix.net/image.png?dpr=1&sat=-100 1x,\n * // https://example.imgix.net/image.png?dpr=2&sat=-100 2x,\n * // https://example.imgix.net/image.png?dpr=3&sat=-100 3x\n * ```\n *\n * @param url - Full absolute URL to the Imgix image.\n * @param params - An object of Imgix URL API parameters. The `pixelDensities`\n * parameter defines the resulting `srcset` widths.\n *\n * @returns A `srcset` attribute value for `url` with the given Imgix URL API\n * parameters applied.\n */\nexport const buildPixelDensitySrcSet = (\n\turl: string,\n\t{ pixelDensities, ...params }: BuildPixelDensitySrcSetParams,\n): string => {\n\treturn pixelDensities\n\t\t.map((dpr) => {\n\t\t\treturn `${buildURL(url, { ...params, dpr })} ${dpr}x`;\n\t\t})\n\t\t.join(\", \");\n};\n","import type { ImgixURLParams } from \"./types.generated\";\nimport { buildURL } from \"./buildURL\";\n\n/**\n * Parameters for `buildWidthSrcSet`.\n */\nexport type BuildWidthSrcSetParams = Omit<ImgixURLParams, \"width\" | \"w\"> & {\n\t/**\n\t * The pixel widths to include in the resulting `srcset` value.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * [400, 800, 1600];\n\t * ```\n\t */\n\twidths: number[];\n};\n\n/**\n * Builds an `<img>` `srcset` attribute value for a given set of widths. It can\n * also optinally apply Imgix URL API parameters to the URLs.\n *\n * The `width` URL parameter will be applied for each `srcset` entry. If a\n * `width` or `w` parameter is provided to the `params` parameter, it will be ignored.\n *\n * @example\n *\n * ```ts\n * const srcset = buildWidthSrcSet(\"https://example.imgix.net/image.png\", {\n * \twidths: [400, 800, 1600],\n * });\n * // => https://example.imgix.net/image.png?width=400 400w,\n * // https://example.imgix.net/image.png?width=800 800w,\n * // https://example.imgix.net/image.png?width=1600 1600w\n * ```\n *\n * @example\n *\n * ```ts\n * const srcset = buildWidthSrcSet(\"https://example.imgix.net/image.png\", {\n * \twidths: [400, 800, 1600],\n * \tsat: -100,\n * });\n * // => https://example.imgix.net/image.png?width=400&sat=-100 400w,\n * // https://example.imgix.net/image.png?width=800&sat=-100 800w,\n * // https://example.imgix.net/image.png?width=1600&sat=-100 1600w\n * ```\n *\n * @param url - Full absolute URL to the Imgix image.\n * @param params - An object of Imgix URL API parameters. The `widths` parameter\n * defines the resulting `srcset` widths.\n *\n * @returns A `srcset` attribute value for `url` with the given Imgix URL API\n * parameters applied.\n */\nexport const buildWidthSrcSet = (\n\turl: string,\n\t{ widths, ...params }: BuildWidthSrcSetParams,\n): string => {\n\treturn widths\n\t\t.map((width) => {\n\t\t\treturn `${buildURL(url, { ...params, w: undefined, width })} ${width}w`;\n\t\t})\n\t\t.join(\", \");\n};\n","import type { BuildPixelDensitySrcSetParams } from \"./buildPixelDensitySrcSet\";\nimport type { BuildWidthSrcSetParams } from \"./buildWidthSrcSet\";\nimport type { ImgixURLParams } from \"./types.generated\";\nimport { buildPixelDensitySrcSet } from \"./buildPixelDensitySrcSet\";\nimport { buildURL } from \"./buildURL\";\nimport { buildWidthSrcSet } from \"./buildWidthSrcSet\";\n\n/**\n * Options to instantiate a new client.\n */\nexport type ClientOptions = {\n\t/**\n\t * The base URL used to construct image URLs from a path. The base URL must\n\t * include the protocol, domain, and optionally a path.\n\t *\n\t * @example `https://example.imgix.net`\n\t *\n\t * @example `https://example.imgix.net/folder`\n\t */\n\tbaseURL: string;\n};\n\n/**\n * An Imgix Rendering API client. A client is paired to a single Imgix domain.\n */\nexport class Client {\n\tbaseURL: string;\n\n\t/**\n\t * Creates a new `Client` instance for an Imgix domain.\n\t *\n\t * @param options - Options to instantiate a new client.\n\t *\n\t * @returns A `Client` instance for the given Imgix domain.\n\t */\n\tconstructor(options: ClientOptions) {\n\t\tthis.baseURL = options.baseURL;\n\t}\n\n\t/**\n\t * Builds a URL to an Imgix image with Imgix URL API parameters for the\n\t * client's base URL.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const client = new Client({ baseURL: \"https://example.imgix.net\" });\n\t * const url = client.buildURLForPath(\"/image.png\", { width: 400 });\n\t * // => https://example.imgix.net/image.png?width=400\n\t * ```\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const client = new Client({\n\t * \tbaseURL: \"https://example.imgix.net/folder\",\n\t * });\n\t * const url = client.buildURLForPath(\"./image.png\", { width: 400 });\n\t * // => https://example.imgix.net/folder/image.png?width=400\n\t * ```\n\t *\n\t * @param path - Path to the image relative to the client's base URL.\n\t * @param params - An object of Imgix URL API parameters.\n\t *\n\t * @returns The full absolute URL to the image with the given Imgix URL API\n\t * parameters applied.\n\t */\n\tbuildURLForPath(path: string, params: ImgixURLParams = {}) {\n\t\treturn buildURL(`${new URL(path, this.baseURL)}`, params);\n\t}\n\n\t/**\n\t * Builds an `<img>` `srcset` attribute value for a given set of widths for\n\t * the client's base URL. It can also optinally apply Imgix URL API parameters\n\t * to the URLs.\n\t *\n\t * The `width` URL parameter will be applied for each `srcset` entry. If a\n\t * `width` or `w` parameter is provided to the `params` parameter, it will be ignored.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const client = new Client({ baseURL: \"https://example.imgix.net\" });\n\t * const srcset = client.buildWidthSrcSetForPath(\"/image.png\", {\n\t * \twidths: [400, 800, 1600],\n\t * });\n\t * // => https://example.imgix.net/image.png?width=400 400w,\n\t * // https://example.imgix.net/image.png?width=800 800w,\n\t * // https://example.imgix.net/image.png?width=1600 1600w\n\t * ```\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const client = new Client({\n\t * \tbaseURL: \"https://example.imgix.net\",\n\t * });\n\t * const srcset = client.buildWidthSrcSetForPath(\"/image.png\", {\n\t * \twidths: [400, 800, 1600],\n\t * \tsat: -100,\n\t * });\n\t * // => https://example.imgix.net/image.png?width=400&sat=-100 400w,\n\t * // https://example.imgix.net/image.png?width=800&sat=-100 800w,\n\t * // https://example.imgix.net/image.png?width=1600&sat=-100 1600w\n\t * ```\n\t *\n\t * @param path - Path to the image relative to the client's base URL.\n\t * @param params - An object of Imgix URL API parameters. The `widths`\n\t * parameter defines the resulting `srcset` widths.\n\t *\n\t * @returns A `srcset` attribute value for `url` with the given Imgix URL API\n\t * parameters applied.\n\t */\n\tbuildWidthSrcSetForPath(path: string, params: BuildWidthSrcSetParams) {\n\t\treturn buildWidthSrcSet(`${new URL(path, this.baseURL)}`, params);\n\t}\n\n\t/**\n\t * Builds an `<img>` `srcset` attribute value for a given set of pixel\n\t * densities for the client's base URL. It can also optinally apply Imgix URL\n\t * API parameters to the URLs.\n\t *\n\t * The `dpr` URL parameter will be applied for each `srcset` entry. If a `dpr`\n\t * parameter is provided to the `params` parameter, it will be ignored.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const client = new Client({ baseURL: \"https://example.imgix.net\" });\n\t * const srcset = client.buildPixelDensitySrcSetForPath(\"/image.png\", {\n\t * \tpixelDensities: [1, 2, 3],\n\t * });\n\t * // => https://example.imgix.net/image.png?dpr=1 1x,\n\t * // https://example.imgix.net/image.png?dpr=2 2x,\n\t * // https://example.imgix.net/image.png?dpr=3 3x\n\t * ```\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const client = new Client({ baseURL: \"https://example.imgix.net\" });\n\t * const srcset = client.buildPixelDensitySrcSetForPath(\"/image.png\", {\n\t * \tpixelDensities: [1, 2, 3],\n\t * \tsat: -100,\n\t * });\n\t * // => https://example.imgix.net/image.png?dpr=1&sat=-100 1x,\n\t * // https://example.imgix.net/image.png?dpr=2&sat=-100 2x,\n\t * // https://example.imgix.net/image.png?dpr=3&sat=-100 3x\n\t * ```\n\t *\n\t * @param path - Path to the image relative to the client's base URL.\n\t * @param params - An object of Imgix URL API parameters. The `pixelDensities`\n\t * parameter defines the resulting `srcset` widths.\n\t *\n\t * @returns A `srcset` attribute value for `url` with the given Imgix URL API\n\t * parameters applied.\n\t */\n\tbuildPixelDensitySrcSetForPath(\n\t\tpath: string,\n\t\tparams: BuildPixelDensitySrcSetParams,\n\t) {\n\t\treturn buildPixelDensitySrcSet(`${new URL(path, this.baseURL)}`, params);\n\t}\n}\n"],"names":[],"mappings":";;;;AAgBA,MAAM,uBAAuB,CAAC,UAA0B;AACvD,SAAO,MAAM,QAAQ,UAAU,CAAC,UAAU;AACzC,WAAO,IAAI,MAAM;AAAA;AAAA;MAqCN,WAAW,CAAC,KAAa,WAAmC;AACxE,QAAM,WAAW,IAAI,IAAI;AAEzB,aAAW,sBAAsB,QAAQ;AACxC,UAAM,WAAW,qBAAqB;AACtC,UAAM,aAAa,OAAO;AAE1B,QAAI,eAAe,QAAW;AAC7B,eAAS,aAAa,OAAO;AAAA,eACnB,MAAM,QAAQ,aAAa;AACrC,eAAS,aAAa,IAAI,UAAU,WAAW,KAAK;AAAA,WAC9C;AACN,eAAS,aAAa,IAAI,UAAU,GAAG;AAAA;AAAA;AAMzC,QAAM,IAAI,SAAS,aAAa,IAAI;AACpC,MAAI,GAAG;AACN,aAAS,aAAa,OAAO;AAC7B,aAAS,aAAa,OAAO,KAAK;AAAA;AAGnC,SAAO,SAAS;AAAA;;MCnBJ,0BAA0B,CACtC,KACA,EAAE,mBAAmB,aACT;AACZ,SAAO,eACL,IAAI,CAAC,QAAQ;AACb,WAAO,GAAG,SAAS,KAAK,KAAK,QAAQ,UAAU;AAAA,KAE/C,KAAK;AAAA;;MCZK,mBAAmB,CAC/B,KACA,EAAE,WAAW,aACD;AACZ,SAAO,OACL,IAAI,CAAC,UAAU;AACf,WAAO,GAAG,SAAS,KAAK,KAAK,QAAQ,GAAG,QAAW,YAAY;AAAA,KAE/D,KAAK;AAAA;;aCvCY;AAAA,EAUnB,YAAY,SAAwB;AACnC,SAAK,UAAU,QAAQ;AAAA;AAAA,EA+BxB,gBAAgB,MAAc,SAAyB,IAAI;AAC1D,WAAO,SAAS,GAAG,IAAI,IAAI,MAAM,KAAK,YAAY;AAAA;AAAA,EA6CnD,wBAAwB,MAAc,QAAgC;AACrE,WAAO,iBAAiB,GAAG,IAAI,IAAI,MAAM,KAAK,YAAY;AAAA;AAAA,EA2C3D,+BACC,MACA,QACC;AACD,WAAO,wBAAwB,GAAG,IAAI,IAAI,MAAM,KAAK,YAAY;AAAA;AAAA;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/buildURL.ts","../src/buildPixelDensitySrcSet.ts","../src/buildWidthSrcSet.ts","../src/Client.ts"],"sourcesContent":["import type { ImgixURLParams } from \"./types.generated\";\n\n/**\n * Converts a camel case string to a param case string.\n *\n * @example\n *\n * ```ts\n * camelCaseToParamCase(\"fooBar\");\n * // => 'foo-bar'\n * ```\n *\n * @param input - Camel case string to convert.\n *\n * @returns Param case version of `input`.\n */\nconst camelCaseToParamCase = (input: string): string => {\n\treturn input.replace(/[A-Z]/g, (match) => {\n\t\treturn `-${match.toLowerCase()}`;\n\t});\n};\n\n/**\n * Builds a URL to an Imgix image with Imgix URL API parameters.\n *\n * The given URL must be a full absolute URL containing the protocol and domain.\n *\n * URL parameters already applied to the image will be retained. To remove\n * existing parameters, set the parameter to `undefined` in the `params`\n * argument.\n *\n * @example\n *\n * ```ts\n * const url = buildURL(\"https://example.imgix.net/image.png\", {\n * \twidth: 400,\n * });\n * // => https://example.imgix.net/image.png?width=400\n * ```\n *\n * @example\n *\n * ```ts\n * const url = buildURL(\"https://example.imgix.net/image.png?width=400\", {\n * \theight: 300,\n * });\n * // => https://example.imgix.net/image.png?width=400&height=300\n * ```\n *\n * @param url - Full absolute URL to the Imgix image.\n * @param params - An object of Imgix URL API parameters.\n *\n * @returns `url` with the given Imgix URL API parameters applied.\n *\n * @see Imgix URL API reference: https://docs.imgix.com/apis/rendering\n */\nexport const buildURL = (url: string, params: ImgixURLParams): string => {\n\tconst instance = new URL(url);\n\n\tfor (const camelCasedParamKey in params) {\n\t\tconst paramKey = camelCaseToParamCase(camelCasedParamKey);\n\t\tconst paramValue = params[camelCasedParamKey as keyof typeof params];\n\n\t\tif (paramValue === undefined) {\n\t\t\tinstance.searchParams.delete(paramKey);\n\t\t} else if (Array.isArray(paramValue)) {\n\t\t\tinstance.searchParams.set(paramKey, paramValue.join(\",\"));\n\t\t} else {\n\t\t\tinstance.searchParams.set(paramKey, `${paramValue}`);\n\t\t}\n\t}\n\n\t// Ensure the `s` parameter is the last parameter, if it exists.\n\t// @see https://github.com/imgix/imgix-blueprint#securing-urls\n\tconst s = instance.searchParams.get(\"s\");\n\tif (s) {\n\t\tinstance.searchParams.delete(\"s\");\n\t\tinstance.searchParams.append(\"s\", s);\n\t}\n\n\treturn instance.toString();\n};\n","import type { ImgixURLParams } from \"./types.generated\";\nimport { buildURL } from \"./buildURL\";\n\n/**\n * Parameters for `buildPixelDensitySrcSet`.\n */\nexport type BuildPixelDensitySrcSetParams = Omit<ImgixURLParams, \"dpr\"> & {\n\t/**\n\t * The pixel densities to include in the resulting `srcset` value.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * [1, 2, 3];\n\t * ```\n\t */\n\tpixelDensities: number[];\n};\n\n/**\n * Builds an `<img>` `srcset` attribute value for a given set of pixel\n * densities. It can also optinally apply Imgix URL API parameters to the URLs.\n *\n * The `dpr` URL parameter will be applied for each `srcset` entry. If a `dpr`\n * parameter is provided to the `params` parameter, it will be ignored.\n *\n * @example\n *\n * ```ts\n * const srcset = buildPixelDensitySrcSet(\n * \t\"https://example.imgix.net/image.png\",\n * \t{ pixelDensities: [1, 2, 3] },\n * );\n * // => https://example.imgix.net/image.png?dpr=1 1x,\n * // https://example.imgix.net/image.png?dpr=2 2x,\n * // https://example.imgix.net/image.png?dpr=3 3x\n * ```\n *\n * @example\n *\n * ```ts\n * const srcset = buildPixelDensitySrcSet(\n * \t\"https://example.imgix.net/image.png\",\n * \t{\n * \t\tpixelDensities: [1, 2, 3],\n * \t\tsat: -100,\n * \t},\n * );\n * // => https://example.imgix.net/image.png?dpr=1&sat=-100 1x,\n * // https://example.imgix.net/image.png?dpr=2&sat=-100 2x,\n * // https://example.imgix.net/image.png?dpr=3&sat=-100 3x\n * ```\n *\n * @param url - Full absolute URL to the Imgix image.\n * @param params - An object of Imgix URL API parameters. The `pixelDensities`\n * parameter defines the resulting `srcset` widths.\n *\n * @returns A `srcset` attribute value for `url` with the given Imgix URL API\n * parameters applied.\n */\nexport const buildPixelDensitySrcSet = (\n\turl: string,\n\t{ pixelDensities, ...params }: BuildPixelDensitySrcSetParams,\n): string => {\n\treturn pixelDensities\n\t\t.map((dpr) => {\n\t\t\treturn `${buildURL(url, { ...params, dpr })} ${dpr}x`;\n\t\t})\n\t\t.join(\", \");\n};\n","import type { ImgixURLParams } from \"./types.generated\";\nimport { buildURL } from \"./buildURL\";\n\n/**\n * Parameters for `buildWidthSrcSet`.\n */\nexport type BuildWidthSrcSetParams = Omit<ImgixURLParams, \"width\" | \"w\"> & {\n\t/**\n\t * The pixel widths to include in the resulting `srcset` value.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * [400, 800, 1600];\n\t * ```\n\t */\n\twidths: number[];\n};\n\n/**\n * Builds an `<img>` `srcset` attribute value for a given set of widths. It can\n * also optinally apply Imgix URL API parameters to the URLs.\n *\n * The `width` URL parameter will be applied for each `srcset` entry. If a\n * `width` or `w` parameter is provided to the `params` parameter, it will be\n * ignored.\n *\n * @example\n *\n * ```ts\n * const srcset = buildWidthSrcSet(\"https://example.imgix.net/image.png\", {\n * \twidths: [400, 800, 1600],\n * });\n * // => https://example.imgix.net/image.png?width=400 400w,\n * // https://example.imgix.net/image.png?width=800 800w,\n * // https://example.imgix.net/image.png?width=1600 1600w\n * ```\n *\n * @example\n *\n * ```ts\n * const srcset = buildWidthSrcSet(\"https://example.imgix.net/image.png\", {\n * \twidths: [400, 800, 1600],\n * \tsat: -100,\n * });\n * // => https://example.imgix.net/image.png?width=400&sat=-100 400w,\n * // https://example.imgix.net/image.png?width=800&sat=-100 800w,\n * // https://example.imgix.net/image.png?width=1600&sat=-100 1600w\n * ```\n *\n * @param url - Full absolute URL to the Imgix image.\n * @param params - An object of Imgix URL API parameters. The `widths` parameter\n * defines the resulting `srcset` widths.\n *\n * @returns A `srcset` attribute value for `url` with the given Imgix URL API\n * parameters applied.\n */\nexport const buildWidthSrcSet = (\n\turl: string,\n\t{ widths, ...params }: BuildWidthSrcSetParams,\n): string => {\n\treturn widths\n\t\t.map((width) => {\n\t\t\treturn `${buildURL(url, { ...params, w: undefined, width })} ${width}w`;\n\t\t})\n\t\t.join(\", \");\n};\n","import type { BuildPixelDensitySrcSetParams } from \"./buildPixelDensitySrcSet\";\nimport type { BuildWidthSrcSetParams } from \"./buildWidthSrcSet\";\nimport type { ImgixURLParams } from \"./types.generated\";\nimport { buildPixelDensitySrcSet } from \"./buildPixelDensitySrcSet\";\nimport { buildURL } from \"./buildURL\";\nimport { buildWidthSrcSet } from \"./buildWidthSrcSet\";\n\n/**\n * Options to instantiate a new client.\n */\nexport type ClientOptions = {\n\t/**\n\t * The base URL used to construct image URLs from a path. The base URL must\n\t * include the protocol, domain, and optionally a path.\n\t *\n\t * @example `https://example.imgix.net`\n\t *\n\t * @example `https://example.imgix.net/folder`\n\t */\n\tbaseURL: string;\n};\n\n/**\n * An Imgix Rendering API client. A client is paired to a single Imgix domain.\n */\nexport class Client {\n\tbaseURL: string;\n\n\t/**\n\t * Creates a new `Client` instance for an Imgix domain.\n\t *\n\t * @param options - Options to instantiate a new client.\n\t *\n\t * @returns A `Client` instance for the given Imgix domain.\n\t */\n\tconstructor(options: ClientOptions) {\n\t\tthis.baseURL = options.baseURL;\n\t}\n\n\t/**\n\t * Builds a URL to an Imgix image with Imgix URL API parameters for the\n\t * client's base URL.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const client = new Client({ baseURL: \"https://example.imgix.net\" });\n\t * const url = client.buildURLForPath(\"/image.png\", { width: 400 });\n\t * // => https://example.imgix.net/image.png?width=400\n\t * ```\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const client = new Client({\n\t * \tbaseURL: \"https://example.imgix.net/folder\",\n\t * });\n\t * const url = client.buildURLForPath(\"./image.png\", { width: 400 });\n\t * // => https://example.imgix.net/folder/image.png?width=400\n\t * ```\n\t *\n\t * @param path - Path to the image relative to the client's base URL.\n\t * @param params - An object of Imgix URL API parameters.\n\t *\n\t * @returns The full absolute URL to the image with the given Imgix URL API\n\t * parameters applied.\n\t */\n\tbuildURLForPath(path: string, params: ImgixURLParams = {}) {\n\t\treturn buildURL(`${new URL(path, this.baseURL)}`, params);\n\t}\n\n\t/**\n\t * Builds an `<img>` `srcset` attribute value for a given set of widths for\n\t * the client's base URL. It can also optinally apply Imgix URL API parameters\n\t * to the URLs.\n\t *\n\t * The `width` URL parameter will be applied for each `srcset` entry. If a\n\t * `width` or `w` parameter is provided to the `params` parameter, it will be\n\t * ignored.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const client = new Client({ baseURL: \"https://example.imgix.net\" });\n\t * const srcset = client.buildWidthSrcSetForPath(\"/image.png\", {\n\t * \twidths: [400, 800, 1600],\n\t * });\n\t * // => https://example.imgix.net/image.png?width=400 400w,\n\t * // https://example.imgix.net/image.png?width=800 800w,\n\t * // https://example.imgix.net/image.png?width=1600 1600w\n\t * ```\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const client = new Client({\n\t * \tbaseURL: \"https://example.imgix.net\",\n\t * });\n\t * const srcset = client.buildWidthSrcSetForPath(\"/image.png\", {\n\t * \twidths: [400, 800, 1600],\n\t * \tsat: -100,\n\t * });\n\t * // => https://example.imgix.net/image.png?width=400&sat=-100 400w,\n\t * // https://example.imgix.net/image.png?width=800&sat=-100 800w,\n\t * // https://example.imgix.net/image.png?width=1600&sat=-100 1600w\n\t * ```\n\t *\n\t * @param path - Path to the image relative to the client's base URL.\n\t * @param params - An object of Imgix URL API parameters. The `widths`\n\t * parameter defines the resulting `srcset` widths.\n\t *\n\t * @returns A `srcset` attribute value for `url` with the given Imgix URL API\n\t * parameters applied.\n\t */\n\tbuildWidthSrcSetForPath(path: string, params: BuildWidthSrcSetParams) {\n\t\treturn buildWidthSrcSet(`${new URL(path, this.baseURL)}`, params);\n\t}\n\n\t/**\n\t * Builds an `<img>` `srcset` attribute value for a given set of pixel\n\t * densities for the client's base URL. It can also optinally apply Imgix URL\n\t * API parameters to the URLs.\n\t *\n\t * The `dpr` URL parameter will be applied for each `srcset` entry. If a `dpr`\n\t * parameter is provided to the `params` parameter, it will be ignored.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const client = new Client({ baseURL: \"https://example.imgix.net\" });\n\t * const srcset = client.buildPixelDensitySrcSetForPath(\"/image.png\", {\n\t * \tpixelDensities: [1, 2, 3],\n\t * });\n\t * // => https://example.imgix.net/image.png?dpr=1 1x,\n\t * // https://example.imgix.net/image.png?dpr=2 2x,\n\t * // https://example.imgix.net/image.png?dpr=3 3x\n\t * ```\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * const client = new Client({ baseURL: \"https://example.imgix.net\" });\n\t * const srcset = client.buildPixelDensitySrcSetForPath(\"/image.png\", {\n\t * \tpixelDensities: [1, 2, 3],\n\t * \tsat: -100,\n\t * });\n\t * // => https://example.imgix.net/image.png?dpr=1&sat=-100 1x,\n\t * // https://example.imgix.net/image.png?dpr=2&sat=-100 2x,\n\t * // https://example.imgix.net/image.png?dpr=3&sat=-100 3x\n\t * ```\n\t *\n\t * @param path - Path to the image relative to the client's base URL.\n\t * @param params - An object of Imgix URL API parameters. The `pixelDensities`\n\t * parameter defines the resulting `srcset` widths.\n\t *\n\t * @returns A `srcset` attribute value for `url` with the given Imgix URL API\n\t * parameters applied.\n\t */\n\tbuildPixelDensitySrcSetForPath(\n\t\tpath: string,\n\t\tparams: BuildPixelDensitySrcSetParams,\n\t) {\n\t\treturn buildPixelDensitySrcSet(`${new URL(path, this.baseURL)}`, params);\n\t}\n}\n"],"names":[],"mappings":";;;;AAgBA,MAAM,uBAAuB,CAAC,UAA0B;AACvD,SAAO,MAAM,QAAQ,UAAU,CAAC,UAAU;AACzC,WAAO,IAAI,MAAM;AAAY,GAC7B;AACF;MAoCa,WAAW,CAAC,KAAa,WAAmC;AACxE,QAAM,WAAW,IAAI,IAAI,GAAG;AAE5B,aAAW,sBAAsB,QAAQ;AACxC,UAAM,WAAW,qBAAqB,kBAAkB;AACxD,UAAM,aAAa,OAAO,kBAAyC;AAEnE,QAAI,eAAe,QAAW;AAC7B,eAAS,aAAa,OAAO,QAAQ;AAAA,eAC3B,MAAM,QAAQ,UAAU,GAAG;AACrC,eAAS,aAAa,IAAI,UAAU,WAAW,KAAK,GAAG,CAAC;AAAA,WAClD;AACN,eAAS,aAAa,IAAI,UAAU,GAAG,YAAY;AAAA;AACpD;AAKD,QAAM,IAAI,SAAS,aAAa,IAAI,GAAG;AACvC,MAAI,GAAG;AACN,aAAS,aAAa,OAAO,GAAG;AAChC,aAAS,aAAa,OAAO,KAAK,CAAC;AAAA;AAGpC,SAAO,SAAS;AACjB;;MCrBa,0BAA0B,CACtC,KACA,EAAE,gBAAgB,GAAG,aACT;AACZ,SAAO,eACL,IAAI,CAAC,QAAQ;AACb,WAAO,GAAG,SAAS,KAAK,EAAE,GAAG,QAAQ,KAAK,KAAK;AAAA,GAC/C,EACA,KAAK,IAAI;AACZ;;MCZa,mBAAmB,CAC/B,KACA,EAAE,QAAQ,GAAG,aACD;AACZ,SAAO,OACL,IAAI,CAAC,UAAU;AACf,WAAO,GAAG,SAAS,KAAK,EAAE,GAAG,QAAQ,GAAG,QAAW,OAAO,KAAK;AAAA,GAC/D,EACA,KAAK,IAAI;AACZ;;MCzCa,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUnB,YAAY,SAAwB;AACnC,SAAK,UAAU,QAAQ;AAAA;AACxB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA8BA,gBAAgB,MAAc,SAAyB,IAAI;AAC1D,WAAO,SAAS,GAAG,IAAI,IAAI,MAAM,KAAK,OAAO,KAAK,MAAM;AAAA;AACzD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6CA,wBAAwB,MAAc,QAAgC;AACrE,WAAO,iBAAiB,GAAG,IAAI,IAAI,MAAM,KAAK,OAAO,KAAK,MAAM;AAAA;AACjE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0CA,+BACC,MACA,QACC;AACD,WAAO,wBAAwB,GAAG,IAAI,IAAI,MAAM,KAAK,OAAO,KAAK,MAAM;AAAA;AAEzE;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- declare type Ratio = `${number}:${number}`;
2
- declare type ColorKeyword = "aliceblue" | "antiquewhite" | "aqua" | "aquamarine" | "azure" | "beige" | "bisque" | "black" | "blanchedalmond" | "blue" | "blueviolet" | "brown" | "burlywood" | "cadetblue" | "chartreuse" | "chocolate" | "coral" | "cornflowerblue" | "cornsilk" | "crimson" | "cyan" | "darkblue" | "darkcyan" | "darkgoldenrod" | "darkgray" | "darkgreen" | "darkgrey" | "darkkhaki" | "darkmagenta" | "darkolivegreen" | "darkorange" | "darkorchid" | "darkred" | "darksalmon" | "darkseagreen" | "darkslateblue" | "darkslategray" | "darkslategrey" | "darkturquoise" | "darkviolet" | "deeppink" | "deepskyblue" | "dimgray" | "dimgrey" | "dodgerblue" | "firebrick" | "floralwhite" | "forestgreen" | "fuchsia" | "gainsboro" | "ghostwhite" | "gold" | "goldenrod" | "gray" | "green" | "greenyellow" | "grey" | "honeydew" | "hotpink" | "imgixorange" | "imgixblue" | "indianred" | "indigo" | "ivory" | "khaki" | "lavender" | "lavenderblush" | "lawngreen" | "lemonchiffon" | "lightblue" | "lightcoral" | "lightcyan" | "lightgoldenrodyellow" | "lightgray" | "lightgreen" | "lightgrey" | "lightpink" | "lightsalmon" | "lightseagreen" | "lightskyblue" | "lightslategray" | "lightslategrey" | "lightsteelblue" | "lightyellow" | "lime" | "limegreen" | "linen" | "magenta" | "maroon" | "mediumaquamarine" | "mediumblue" | "mediumorchid" | "mediumpurple" | "mediumseagreen" | "mediumslateblue" | "mediumspringgreen" | "mediumturquoise" | "mediumvioletred" | "midnightblue" | "mintcream" | "mistyrose" | "moccasin" | "navajowhite" | "navy" | "oldlace" | "olive" | "olivedrab" | "orange" | "orangered" | "orchid" | "palegoldenrod" | "palegreen" | "paleturquoise" | "palevioletred" | "papayawhip" | "peachpuff" | "peru" | "pink" | "plum" | "powderblue" | "purple" | "rebeccapurple" | "red" | "rosybrown" | "royalblue" | "saddlebrown" | "salmon" | "sandybrown" | "seagreen" | "seashell" | "sienna" | "silver" | "skyblue" | "slateblue" | "slategray" | "slategrey" | "snow" | "springgreen" | "steelblue" | "tan" | "teal" | "thistle" | "tomato" | "turquoise" | "violet" | "wheat" | "white" | "whitesmoke" | "yellow" | "yellowgreen";
3
- declare type Font = "serif" | "sans-serif" | "monospace" | "cursive" | "fantasy" | "serif,bold" | "sans-serif,bold" | "monospace,bold" | "fantasy,bold" | "serif,italic" | "sans-serif,italic" | "monospace,italic" | "serif,bold,italic" | "sans-serif,bold,italic" | "monospace,bold,italic" | "American Typewriter" | "American Typewriter Condensed" | "American Typewriter Condensed Light" | "American Typewriter Condensed,Bold" | "American Typewriter Light" | "American Typewriter,Bold" | "AndaleMono" | "Arial Narrow" | "Arial Narrow,Bold" | "Arial Narrow,BoldItalic" | "Arial Narrow,Italic" | "Arial Rounded MT,Bold" | "Arial UnicodeMS" | "Arial,BoldItalicMT" | "Arial,BoldMT" | "Arial,ItalicMT" | "Arial-Black" | "ArialMT" | "Athelas,Bold" | "Athelas,BoldItalic" | "Athelas,Italic" | "Athelas-Regular" | "Avenir Next Condensed Demi,Bold" | "Avenir Next Condensed Demi,BoldItalic" | "Avenir Next Condensed Heavy" | "Avenir Next Condensed Heavy,Italic" | "Avenir Next Condensed Medium" | "Avenir Next Condensed Medium,Italic" | "Avenir Next Condensed Regular" | "Avenir Next Condensed Ultra Light" | "Avenir Next Condensed Ultra Light,Italic" | "Avenir Next Condensed,Bold" | "Avenir Next Condensed,BoldItalic" | "Avenir Next Condensed,Italic" | "Avenir Next Demi,Bold" | "Avenir Next Demi,BoldItalic" | "Avenir Next Heavy" | "Avenir Next Heavy,Italic" | "Avenir Next Medium" | "Avenir Next Medium,Italic" | "Avenir Next Regular" | "Avenir Next Ultra Light" | "Avenir Next Ultra Light,Italic" | "Avenir Next,Bold" | "Avenir Next,BoldItalic" | "Avenir Next,Italic" | "Avenir-Black" | "Avenir-BlackOblique" | "Avenir-Book" | "Avenir-BookOblique" | "Avenir-Heavy" | "Avenir-HeavyOblique" | "Avenir-Light" | "Avenir-LightOblique" | "Avenir-Medium" | "Avenir-MediumOblique" | "Avenir-Oblique" | "Avenir-Roman" | "Baskerville" | "Baskerville,Bold" | "Baskerville,BoldItalic" | "Baskerville,Italic" | "BigCaslon-Medium" | "BrushScriptMT" | "Chalkboard" | "Chalkboard SE Light" | "Chalkboard SE Regular" | "Chalkboard SE,Bold" | "Chalkboard,Bold" | "Chalkduster" | "CharcoalCY" | "Charter Black,Italic" | "Charter,Bold" | "Charter,BoldItalic" | "Charter,Italic" | "Charter-Black" | "Charter-Roman" | "Cochin" | "Cochin,Bold" | "Cochin,BoldItalic" | "Cochin,Italic" | "Comic Sans MS,Bold" | "ComicSansMS" | "Copperplate" | "Copperplate,Bold" | "Copperplate-Light" | "Courier" | "Courier New,Bold" | "Courier New,BoldItalic" | "Courier New,Italic" | "Courier,Bold" | "Courier-Oblique" | "CourierNewPSMT" | "DIN Alternate,Bold" | "DIN Condensed,Bold" | "Didot" | "Didot,Bold" | "Didot,Italic" | "Futura Medium,Italic" | "Futura-CondensedMedium" | "Futura-Medium" | "Geneva" | "GenevaCyr" | "Georgia" | "Georgia,Bold" | "Georgia,BoldItalic" | "Georgia,Italic" | "Gill Sans" | "Gill Sans Light,Italic" | "Gill Sans,Bold" | "Gill Sans,BoldItalic" | "Gill Sans,UltraBold" | "GillSans,Italic" | "GillSans-Light" | "Helvetica" | "Helvetica CY,Bold" | "Helvetica Neue" | "Helvetica Neue Condensed Black" | "Helvetica Neue Condensed,Bold" | "Helvetica Neue Light" | "Helvetica Neue Light,Italic" | "Helvetica Neue Medium" | "Helvetica Neue Medium,Italic" | "Helvetica Neue Thin" | "Helvetica Neue Thin,Italic" | "Helvetica Neue UltraLight" | "Helvetica Neue UltraLight,Italic" | "Helvetica Neue,Bold" | "Helvetica Neue,BoldItalic" | "Helvetica Neue,Italic" | "Helvetica,Bold" | "Helvetica-Light" | "Helvetica-LightOblique" | "Helvetica-Oblique" | "HelveticaCY-Oblique" | "HelveticaCY-Plain" | "Herculanum" | "Hoefler Text Black,Italic" | "Hoefler Text,Italic" | "HoeflerText-Black" | "HoeflerText-Ornaments" | "HoeflerText-Regular" | "Impact" | "Iowan Old Style Black,Italic" | "Iowan Old Style,Bold" | "Iowan Old Style,BoldItalic" | "Iowan Old Style,Italic" | "IowanOldStyle-Black" | "IowanOldStyle-Roman" | "IowanOldStyle-Titling" | "Lucida Grande" | "Lucida Grande,Bold" | "Marion,Bold" | "Marion,Italic" | "Marion-Regular" | "Marker Felt Thin" | "Marker Felt Wide" | "Menlo,Bold" | "Menlo,BoldItalic" | "Menlo,Italic" | "Menlo-Regular" | "Monaco" | "Noteworthy,Bold" | "Noteworthy-Light" | "Optima,Bold" | "Optima,BoldItalic" | "Optima,Italic" | "Optima-ExtraBlack" | "Optima-Regular" | "PT Mono,Bold" | "PT Sans Caption,Bold" | "PT Sans Narrow,Bold" | "PT Sans,Bold" | "PT Sans,BoldItalic" | "PT Sans,Italic" | "PT Serif Caption,Italic" | "PT Serif,Bold" | "PT Serif,BoldItalic" | "PT Serif,Italic" | "PTMono-Regular" | "PTSans-Caption" | "PTSans-Narrow" | "PTSans-Regular" | "PTSerif-Caption" | "PTSerif-Regular" | "Palatino,Bold" | "Palatino,BoldItalic" | "Palatino,Italic" | "Palatino-Roman" | "Papyrus" | "Papyrus-Condensed" | "PlantagenetCherokee" | "STBaoli-SC-Regular" | "STYuanti-SC-Light" | "STYuanti-SC-Regular" | "SavoyeLetPlain" | "Seravek" | "Seravek ExtraLight, Italic" | "Seravek Light,Italic" | "Seravek Medium,Italic" | "Seravek,Bold" | "Seravek,BoldItalic" | "Seravek,Italic" | "Seravek-ExtraLight" | "Seravek-Light" | "Seravek-Medium" | "Skia-Regular" | "Skia-Regular_Black" | "Skia-Regular_Black-Condensed" | "Skia-Regular_Black-Extended" | "Skia-Regular_Condensed" | "Skia-Regular_Extended" | "Skia-Regular_Light" | "Skia-Regular_Light-Condensed" | "Skia-Regular_Light-Extended" | "Snell Roundhand,Bold" | "SnellRoundhand" | "SnellRoundhand-Black" | "Superclarendon Black,Italic" | "Superclarendon Light,Italic" | "Superclarendon,Bold" | "Superclarendon,BoldItalic" | "Superclarendon,Italic" | "Superclarendon-Black" | "Superclarendon-Light" | "Superclarendon-Regular" | "Tahoma" | "Tahoma,Bold" | "Times New Roman,Bold" | "Times New Roman,BoldItalic" | "Times New Roman,Italic" | "Times,Bold" | "Times,BoldItalic" | "Times,Italic" | "Times-Roman" | "TimesNewRomanPSMT" | "Trebuchet MS,Bold" | "Trebuchet MS,BoldItalic" | "Trebuchet MS,Italic" | "TrebuchetMS" | "Verdana" | "Verdana,Bold" | "Verdana,BoldItalic" | "Verdana,Italic" | "Waseem" | "WaseemLight" | "Webdings" | "Wingdings-Regular" | "Wingdings2" | "Wingdings3" | "Yuanti SC,Bold" | "YuppySC-Regular" | "Zapf Dingbats" | "Zapfino";
1
+ type Ratio = `${number}:${number}`;
2
+ type ColorKeyword = "aliceblue" | "antiquewhite" | "aqua" | "aquamarine" | "azure" | "beige" | "bisque" | "black" | "blanchedalmond" | "blue" | "blueviolet" | "brown" | "burlywood" | "cadetblue" | "chartreuse" | "chocolate" | "coral" | "cornflowerblue" | "cornsilk" | "crimson" | "cyan" | "darkblue" | "darkcyan" | "darkgoldenrod" | "darkgray" | "darkgreen" | "darkgrey" | "darkkhaki" | "darkmagenta" | "darkolivegreen" | "darkorange" | "darkorchid" | "darkred" | "darksalmon" | "darkseagreen" | "darkslateblue" | "darkslategray" | "darkslategrey" | "darkturquoise" | "darkviolet" | "deeppink" | "deepskyblue" | "dimgray" | "dimgrey" | "dodgerblue" | "firebrick" | "floralwhite" | "forestgreen" | "fuchsia" | "gainsboro" | "ghostwhite" | "gold" | "goldenrod" | "gray" | "green" | "greenyellow" | "grey" | "honeydew" | "hotpink" | "imgixorange" | "imgixblue" | "indianred" | "indigo" | "ivory" | "khaki" | "lavender" | "lavenderblush" | "lawngreen" | "lemonchiffon" | "lightblue" | "lightcoral" | "lightcyan" | "lightgoldenrodyellow" | "lightgray" | "lightgreen" | "lightgrey" | "lightpink" | "lightsalmon" | "lightseagreen" | "lightskyblue" | "lightslategray" | "lightslategrey" | "lightsteelblue" | "lightyellow" | "lime" | "limegreen" | "linen" | "magenta" | "maroon" | "mediumaquamarine" | "mediumblue" | "mediumorchid" | "mediumpurple" | "mediumseagreen" | "mediumslateblue" | "mediumspringgreen" | "mediumturquoise" | "mediumvioletred" | "midnightblue" | "mintcream" | "mistyrose" | "moccasin" | "navajowhite" | "navy" | "oldlace" | "olive" | "olivedrab" | "orange" | "orangered" | "orchid" | "palegoldenrod" | "palegreen" | "paleturquoise" | "palevioletred" | "papayawhip" | "peachpuff" | "peru" | "pink" | "plum" | "powderblue" | "purple" | "rebeccapurple" | "red" | "rosybrown" | "royalblue" | "saddlebrown" | "salmon" | "sandybrown" | "seagreen" | "seashell" | "sienna" | "silver" | "skyblue" | "slateblue" | "slategray" | "slategrey" | "snow" | "springgreen" | "steelblue" | "tan" | "teal" | "thistle" | "tomato" | "turquoise" | "violet" | "wheat" | "white" | "whitesmoke" | "yellow" | "yellowgreen";
3
+ type Font = ".Aqua Kana" | ".Arabic UI Display Black" | ".Arabic UI Text Regular" | ".HeitiUI TC Thin" | ".HeitiUI TC Ultra Light" | ".Helvetica Neue DeskInterface Regular" | ".New York" | ".New York Italic" | ".SF Compact Display" | ".SF Compact Rounded" | ".SF Compact Text" | ".SF Compact Text Italic" | ".SF NS Display Condensed Black" | ".SF NS Display Condensed Bold" | ".SF NS Display Condensed Heavy" | ".SF NS Display Condensed Light" | ".SF NS Display Condensed Medium" | ".SF NS Display Condensed Regular" | ".SF NS Display Condensed Semibold" | ".SF NS Display Condensed Thin" | ".SF NS Display Condensed Ultralight" | ".SF NS Mono Light" | ".SF NS Mono Light Italic" | ".SF NS Rounded" | ".SF NS Text Condensed Bold" | ".SF NS Text Condensed Heavy" | ".SF NS Text Condensed Light" | ".SF NS Text Condensed Medium" | ".SF NS Text Condensed Regular" | ".SF NS Text Condensed Semibold" | "Al Nile" | "Al Tarikh" | "AlBayan" | "AmericanTypewriter" | "Andale Mono" | "Apple Braille" | "Apple Braille Outline 6 Dot" | "Apple Braille Outline 8 Dot" | "Apple Braille Pinpoint 6 Dot" | "Apple Braille Pinpoint 8 Dot" | "Apple Chancery" | "Apple Color Emoji" | "Apple Symbols" | "AppleGothic" | "AppleMyungjo Regular" | "AppleSDGothicNeo" | "Arial" | "Arial Black" | "Arial Bold" | "Arial Bold Italic" | "Arial Italic" | "Arial Narrow" | "Arial Narrow Bold" | "Arial Narrow Bold Italic" | "Arial Narrow Italic" | "Arial Rounded MT Bold" | "Arial Unicode MS" | "ArialHB" | "Athelas Regular" | "Avenir Book" | "Avenir Next Bold" | "Avenir Next Condensed Bold" | "Ayuthaya" | "BIZ UDGothic" | "BIZ UDGothic Bold" | "BIZ UDMincho" | "BIZ UDPGothic" | "BIZ UDPGothic Bold" | "BIZ UDPMincho" | "Baghdad" | "Bangla MN" | "Bangla Sangam MN" | "Baoli SC Regular" | "Baskerville" | "Beirut" | "BigCaslon" | "Bodoni 72 Book" | "Bodoni 72 Oldstyle Book" | "Bodoni 72 Smallcaps Book" | "Bodoni Ornaments" | "Bradley Hand Bold" | "Brush Script MT Italic" | "Chalkboard" | "ChalkboardSE" | "Chalkduster" | "Charter Roman" | "Cochin" | "Comic Sans MS" | "Comic Sans MS Bold" | "Copperplate" | "Corsiva" | "Courier" | "Courier New" | "Courier New Bold" | "Courier New Bold Italic" | "Courier New Italic" | "DIN Alternate Bold" | "DIN Condensed Bold" | "Damascus" | "DecoTypeNaskh" | "Dela Gothic One Regular" | "Devanagari MT" | "Devanagari Sangam MN" | "Didot" | "Diwan Kufi" | "Diwan Thuluth" | "DotGothic16 Regular" | "EuphemiaCAS" | "Farah" | "Farisi" | "Futura" | "GB18030 Bitmap" | "Galvji" | "GeezaPro" | "Geneva" | "Georgia" | "Georgia Bold" | "Georgia Bold Italic" | "Georgia Italic" | "GillSans" | "Gujarati Sangam MN" | "GujaratiMT" | "Gungseouche" | "Gurmukhi" | "Gurmukhi MN" | "Gurmukhi Sangam MN" | "Hachi Maru Pop Regular" | "Hannotate SC Regular" | "HanziPen SC Regular" | "Headline Alternate" | "Heiti TC Light" | "Heiti TC Medium" | "Helvetica" | "HelveticaNeue" | "Herculanum" | "Hina Mincho Regular" | "HiraMaruPro-W4" | "HiraMinProN-W3" | "HiraMinProN-W6" | "Hiragino Sans GB W3" | "Hiragino Sans GB W6" | "Hiragino Sans W0" | "Hiragino Sans W1" | "Hiragino Sans W2" | "Hiragino Sans W3" | "Hiragino Sans W4" | "Hiragino Sans W5" | "Hiragino Sans W6" | "Hiragino Sans W7" | "Hiragino Sans W8" | "Hiragino Sans W9" | "Hoefler Text" | "Hoefler Text Ornaments" | "IBM Plex Sans JP Bold" | "IBM Plex Sans JP ExtraLight" | "IBM Plex Sans JP Light" | "IBM Plex Sans JP Medium" | "IBM Plex Sans JP Regular" | "IBM Plex Sans JP SemiBold" | "IBM Plex Sans JP Thin" | "ITFDevanagari-Book" | "Impact" | "InaiMathi" | "InaiMathi-MN" | "Iowan Old Style Roman" | "Kailasa" | "Kaisei Decol Bold" | "Kaisei Decol Medium" | "Kaisei Decol Regular" | "Kaisei HarunoUmi Bold" | "Kaisei HarunoUmi Medium" | "Kaisei HarunoUmi Regular" | "Kaisei Opti Bold" | "Kaisei Opti Medium" | "Kaisei Opti Regular" | "Kaisei Tokumin Bold" | "Kaisei Tokumin ExtraBold" | "Kaisei Tokumin Medium" | "Kaisei Tokumin Regular" | "Kaiti SC Black" | "Kannada MN" | "Kannada Sangam MN" | "Kefa Regular" | "Keyboard" | "Khmer MN" | "Khmer Sangam MN" | "Kiwi Maru Light" | "Kiwi Maru Medium" | "Kiwi Maru Regular" | "Klee Demibold" | "Klee One Regular" | "Klee One SemiBold" | "Kohinoor Bangla" | "Kohinoor Devanagari Regular" | "Kohinoor Gujarati Bold" | "Kohinoor Telugu" | "Kokonor" | "Kosugi Maru Regular" | "Kosugi Regular" | "Krungthep" | "KufiStandardGK Regular" | "Lantinghei SC Demibold" | "Lao MN" | "Lao Sangam MN" | "LastResort" | "Libian SC Regular" | "LucidaGrande" | "Luminari" | "M PLUS 1 Black" | "M PLUS 1 Bold" | "M PLUS 1 Code Bold" | "M PLUS 1 Code ExtraLight" | "M PLUS 1 Code Light" | "M PLUS 1 Code Medium" | "M PLUS 1 Code Regular" | "M PLUS 1 Code SemiBold" | "M PLUS 1 Code Thin" | "M PLUS 1 ExtraBold" | "M PLUS 1 ExtraLight" | "M PLUS 1 Light" | "M PLUS 1 Medium" | "M PLUS 1 Regular" | "M PLUS 1 SemiBold" | "M PLUS 1 Thin" | "M PLUS 1p Black" | "M PLUS 1p Bold" | "M PLUS 1p ExtraBold" | "M PLUS 1p Light" | "M PLUS 1p Medium" | "M PLUS 1p Regular" | "M PLUS 1p Thin" | "M PLUS 2 Black" | "M PLUS 2 Bold" | "M PLUS 2 ExtraBold" | "M PLUS 2 ExtraLight" | "M PLUS 2 Light" | "M PLUS 2 Medium" | "M PLUS 2 Regular" | "M PLUS 2 SemiBold" | "M PLUS 2 Thin" | "Malayalam MN" | "Malayalam Sangam MN" | "Marion Regular" | "MarkerFelt" | "Menlo" | "Microsoft Sans Serif" | "Mishafi" | "Mishafi Gold" | "Mochiy Pop One Regular" | "Mochiy Pop P One Regular" | "Monaco" | "Mshtakan" | "MuktaMahee Regular" | "Muna" | "Murecho Black" | "Murecho Bold" | "Murecho ExtraBold" | "Murecho ExtraLight" | "Murecho Light" | "Murecho Medium" | "Murecho Regular" | "Murecho SemiBold" | "Murecho Thin" | "Myanmar MN" | "Myanmar Sangam MN" | "Nadeem" | "Nanum Brush Script" | "NanumGothic" | "NanumMyeongjo" | "New Tegomin Regular" | "NewPeninimMT" | "Noteworthy Light" | "Noto Nastaliq Urdu" | "Noto Sans Armenian Black" | "Noto Sans Avestan Regular" | "Noto Sans Bamum Regular" | "Noto Sans Batak Regular" | "Noto Sans Brahmi Regular" | "Noto Sans Buginese Regular" | "Noto Sans Buhid Regular" | "Noto Sans Carian Regular" | "Noto Sans Chakma Regular" | "Noto Sans Cham Regular" | "Noto Sans Coptic Regular" | "Noto Sans Cuneiform Regular" | "Noto Sans Cypriot Regular" | "Noto Sans Egyptian Hieroglyphs Regular" | "Noto Sans Glagolitic Regular" | "Noto Sans Gothic Regular" | "Noto Sans Hanunoo Regular" | "Noto Sans Imperial Aramaic Regular" | "Noto Sans Inscriptional Pahlavi Regular" | "Noto Sans Inscriptional Parthian Regular" | "Noto Sans JP" | "Noto Sans JP Black" | "Noto Sans JP Bold" | "Noto Sans JP Light" | "Noto Sans JP Medium" | "Noto Sans JP Thin" | "Noto Sans Javanese Regular" | "Noto Sans Kaithi Regular" | "Noto Sans Kannada Black" | "Noto Sans Kayah Li Regular" | "Noto Sans Kharoshthi Regular" | "Noto Sans Lepcha Regular" | "Noto Sans Limbu Regular" | "Noto Sans Linear B Regular" | "Noto Sans Lisu Regular" | "Noto Sans Lycian Regular" | "Noto Sans Lydian Regular" | "Noto Sans Mandaic Regular" | "Noto Sans Meetei Mayek Regular" | "Noto Sans Mongolian" | "Noto Sans Myanmar Black" | "Noto Sans NKo Regular" | "Noto Sans New Tai Lue Regular" | "Noto Sans Ogham Regular" | "Noto Sans Ol Chiki Regular" | "Noto Sans Old Italic Regular" | "Noto Sans Old Persian Regular" | "Noto Sans Old South Arabian Regular" | "Noto Sans Old Turkic Regular" | "Noto Sans Oriya" | "Noto Sans Osmanya Regular" | "Noto Sans PhagsPa Regular" | "Noto Sans Phoenician Regular" | "Noto Sans Rejang Regular" | "Noto Sans Runic Regular" | "Noto Sans Samaritan Regular" | "Noto Sans Saurashtra Regular" | "Noto Sans Shavian Regular" | "Noto Sans Sundanese Regular" | "Noto Sans Syloti Nagri Regular" | "Noto Sans Syriac Regular" | "Noto Sans Tagalog Regular" | "Noto Sans Tagbanwa Regular" | "Noto Sans Tai Le Regular" | "Noto Sans Tai Tham" | "Noto Sans Tai Viet Regular" | "Noto Sans Thaana Regular" | "Noto Sans Tifinagh Regular" | "Noto Sans Ugaritic Regular" | "Noto Sans Vai Regular" | "Noto Sans Yi Regular" | "Noto Serif Balinese Regular" | "Noto Serif JP" | "Noto Serif JP Black" | "Noto Serif JP Bold" | "Noto Serif JP ExtraLight" | "Noto Serif JP Light" | "Noto Serif JP Medium" | "Noto Serif JP SemiBold" | "Noto Serif Myanmar Black" | "Optima" | "Oriya MN" | "Oriya Sangam MN" | "Osaka" | "OsakaMono" | "PCmyoungjo" | "PT Mono Bold" | "PT Sans" | "PT Serif Caption" | "PT Serif" | "Palatino" | "Papyrus" | "Phosphate" | "Pilgiche" | "PingFang HK Regular" | "PlantagenetCherokee" | "Potta One Regular" | "Raanana" | "Rampart One Regular" | "Reggae One Regular" | "RocknRoll One Regular" | "Rockwell" | "Rounded Mplus 1c" | "Rounded Mplus 1c Black" | "Rounded Mplus 1c Bold" | "Rounded Mplus 1c ExtraBold" | "Rounded Mplus 1c Light" | "Rounded Mplus 1c Medium" | "Rounded Mplus 1c Thin" | "STIXGeneral-Bold" | "STIXGeneral-BoldItalic" | "STIXGeneral-Italic" | "STIXGeneral-Regular" | "STIXIntegralsD-Bold" | "STIXIntegralsD-Regular" | "STIXIntegralsSm-Bold" | "STIXIntegralsSm-Regular" | "STIXIntegralsUp-Bold" | "STIXIntegralsUp-Regular" | "STIXIntegralsUpD-Bold" | "STIXIntegralsUpD-Regular" | "STIXIntegralsUpSm-Bold" | "STIXIntegralsUpSm-Regular" | "STIXNonUnicode-Bold" | "STIXNonUnicode-BoldItalic" | "STIXNonUnicode-Italic" | "STIXNonUnicode-Regular" | "STIXSizeFiveSym-Regular" | "STIXSizeFourSym-Bold" | "STIXSizeFourSym-Regular" | "STIXSizeOneSym-Bold" | "STIXSizeOneSym-Regular" | "STIXSizeThreeSym-Bold" | "STIXSizeThreeSym-Regular" | "STIXSizeTwoSym-Bold" | "STIXSizeTwoSym-Regular" | "STIXVariants-Bold" | "STIXVariants-Regular" | "Sana" | "Sathu" | "Savoye LET" | "Sawarabi Gothic" | "Sawarabi Mincho" | "Seravek" | "Shippori Antique B1 Regular" | "Shippori Antique Regular" | "Shippori Mincho B1 Bold" | "Shippori Mincho B1 ExtraBold" | "Shippori Mincho B1 Medium" | "Shippori Mincho B1 Regular" | "Shippori Mincho B1 SemiBold" | "Shippori Mincho Bold" | "Shippori Mincho ExtraBold" | "Shippori Mincho Medium" | "Shippori Mincho Regular" | "Shippori Mincho SemiBold" | "Shree Devanagari 714" | "SignPainter-HouseScript" | "Silom" | "Sinhala MN" | "Sinhala Sangam MN" | "Skia" | "Snell Roundhand" | "Songti SC Black" | "Stick Regular" | "SukhumvitSet-Thin" | "Superclarendon Regular" | "Symbol" | "System Font" | "System Font Black" | "System Font Bold" | "System Font Bold G1" | "System Font Bold G2" | "System Font Bold G3" | "System Font Bold Italic" | "System Font Bold Italic G1" | "System Font Bold Italic G2" | "System Font Bold Italic G3" | "System Font Heavy" | "System Font Heavy Italic" | "System Font Italic" | "System Font Italic G1" | "System Font Italic G2" | "System Font Italic G3" | "System Font Light" | "System Font Light Italic" | "System Font Medium" | "System Font Medium Italic" | "System Font Regular" | "System Font Regular G1" | "System Font Regular G2" | "System Font Regular G3" | "System Font Regular Italic" | "System Font SemiBold" | "System Font SemiBold Italic" | "System Font Thin" | "System Font UltraLight" | "Tahoma" | "Tahoma Bold" | "Tamil MN" | "Tamil Sangam MN" | "Telugu MN" | "Telugu Sangam MN" | "Thonburi" | "Times" | "Times New Roman" | "Times New Roman Bold" | "Times New Roman Bold Italic" | "Times New Roman Italic" | "Train One Regular" | "Trattatello" | "Trebuchet MS" | "Trebuchet MS Bold" | "Trebuchet MS Bold Italic" | "Trebuchet MS Italic" | "Tsukushi A Round Gothic Regular" | "Tsukushi B Round Gothic Regula" | "Verdana" | "Verdana Bold" | "Verdana Bold Italic" | "Verdana Italic" | "Waseem" | "Wawati SC Regular" | "Wawati TC Regular" | "Webdings" | "Weibei SC Bold" | "Weibei TC Bold" | "Wingdings" | "Wingdings 2" | "Wingdings 3" | "Xingkai SC Bold" | "Yomogi Regular" | "YuGothic Bold" | "YuGothic Medium" | "YuMincho Medium" | "Yuanti SC Bold" | "Yuji Boku Regular" | "Yuji Mai Regular" | "Yuji Syuku Regular" | "Yuppy SC Regular" | "Yuppy TC Regular" | "Yusei Magic Regular" | "ZapfDingbats" | "Zapfino" | "Zen Antique Regular" | "Zen Antique Soft Regular" | "Zen Kaku Gothic Antique Black" | "Zen Kaku Gothic Antique Bold" | "Zen Kaku Gothic Antique Light" | "Zen Kaku Gothic Antique Medium" | "Zen Kaku Gothic Antique Regular" | "Zen Kaku Gothic New Black" | "Zen Kaku Gothic New Bold" | "Zen Kaku Gothic New Light" | "Zen Kaku Gothic New Medium" | "Zen Kaku Gothic New Regular" | "Zen Kurenaido Regular" | "Zen Maru Gothic Black" | "Zen Maru Gothic Bold" | "Zen Maru Gothic Light" | "Zen Maru Gothic Medium" | "Zen Maru Gothic Regular" | "Zen Old Mincho Black" | "Zen Old Mincho Bold" | "Zen Old Mincho Medium" | "Zen Old Mincho Regular" | "Zen Old Mincho SemiBold" | "儷宋 Pro" | "儷黑 Pro" | "华文仿宋" | "华文细黑" | "华文黑体";
4
+ type Range = `${number}-${number}` | `${number}-` | `-${number}`;
4
5
  interface ImgixURLParams {
5
6
  /**
6
7
  * Aspect ratio
@@ -18,6 +19,26 @@ interface ImgixURLParams {
18
19
  * @see https://docs.imgix.com/apis/url/auto
19
20
  */
20
21
  auto?: ("enhance" | "format" | "redeye" | "compress" | "true")[];
22
+ /**
23
+ * Background removal
24
+ *
25
+ * Removes background from image.
26
+ *
27
+ * @defaultValue `false`
28
+ *
29
+ * @see https://docs.imgix.com/apis/rendering/background-removal/bg-remove
30
+ */
31
+ bgRemove?: boolean;
32
+ /**
33
+ * Background removal fallback
34
+ *
35
+ * Overrides default fallback behavior for bg-remove failures.
36
+ *
37
+ * @defaultValue `true`
38
+ *
39
+ * @see https://docs.imgix.com/apis/rendering/background-removal/bg-remove
40
+ */
41
+ bgRemoveFallback?: boolean;
21
42
  /**
22
43
  * Background color
23
44
  *
@@ -684,7 +705,8 @@ interface ImgixURLParams {
684
705
  /**
685
706
  * Json face data
686
707
  *
687
- * Specifies that face data should be included in output when combined with `fm=json`.
708
+ * Specifies that face data should be included in output when combined with
709
+ * `fm=json`.
688
710
  *
689
711
  * @see https://docs.imgix.com/apis/url/face-detection/faces
690
712
  */
@@ -692,7 +714,8 @@ interface ImgixURLParams {
692
714
  /**
693
715
  * Fill color
694
716
  *
695
- * Sets the fill color for images with additional space created by the fit setting
717
+ * Sets the fill color for images with additional space created by the fit
718
+ * setting
696
719
  *
697
720
  * Aliases: `fillcolor`
698
721
  *
@@ -704,7 +727,8 @@ interface ImgixURLParams {
704
727
  /**
705
728
  * Fill color
706
729
  *
707
- * Sets the fill color for images with additional space created by the fit setting
730
+ * Sets the fill color for images with additional space created by the fit
731
+ * setting
708
732
  *
709
733
  * Alias for: `fillColor`
710
734
  *
@@ -795,6 +819,18 @@ interface ImgixURLParams {
795
819
  * @see https://docs.imgix.com/apis/url/focalpoint-crop/fp-z
796
820
  */
797
821
  fpZ?: number;
822
+ /**
823
+ * Frames per second
824
+ *
825
+ * Specifies the framerate of the generated image.
826
+ */
827
+ fps?: number;
828
+ /**
829
+ * Frame selection
830
+ *
831
+ * Specifies the frame of an animated image to use.
832
+ */
833
+ frame?: number | Range;
798
834
  /**
799
835
  * Gamma
800
836
  *
@@ -805,6 +841,18 @@ interface ImgixURLParams {
805
841
  * @see https://docs.imgix.com/apis/url/adjustment/gam
806
842
  */
807
843
  gam?: number;
844
+ /**
845
+ * Animated gif quality
846
+ *
847
+ * Aliases: `gifq`
848
+ */
849
+ gifQ?: number;
850
+ /**
851
+ * Animated gif quality
852
+ *
853
+ * Alias for: `gifQ`
854
+ */
855
+ gifq?: number;
808
856
  /**
809
857
  * Grid colors
810
858
  *
@@ -867,6 +915,12 @@ interface ImgixURLParams {
867
915
  * @see https://docs.imgix.com/apis/url/adjustment/hue
868
916
  */
869
917
  hue?: number;
918
+ /**
919
+ * Frame interval
920
+ *
921
+ * Displays every Nth frame starting with the first frame.
922
+ */
923
+ interval?: number;
870
924
  /**
871
925
  * Invert
872
926
  *
@@ -897,6 +951,15 @@ interface ImgixURLParams {
897
951
  * Determine if IPTC data should be passed for JPEG images.
898
952
  */
899
953
  iptc?: "allow" | "block";
954
+ /**
955
+ * Animation loop count
956
+ *
957
+ * Specifies the number of times an animated image should repeat. A value of 0
958
+ * means infinite looping.
959
+ *
960
+ * @defaultValue `0`
961
+ */
962
+ loop?: number;
900
963
  /**
901
964
  * Lossless compression
902
965
  *
@@ -1584,6 +1647,14 @@ interface ImgixURLParams {
1584
1647
  number,
1585
1648
  number
1586
1649
  ];
1650
+ /**
1651
+ * Reverse
1652
+ *
1653
+ * Reverses the frame order on the source animation.
1654
+ *
1655
+ * @defaultValue `false`
1656
+ */
1657
+ reverse?: boolean;
1587
1658
  /**
1588
1659
  * Rotation
1589
1660
  *
@@ -1634,6 +1705,12 @@ interface ImgixURLParams {
1634
1705
  * @see https://docs.imgix.com/apis/url/adjustment/sharp
1635
1706
  */
1636
1707
  sharp?: number;
1708
+ /**
1709
+ * Frame skip
1710
+ *
1711
+ * Skips every Nth frame starting with the first frame.
1712
+ */
1713
+ skip?: number;
1637
1714
  /**
1638
1715
  * Transparency
1639
1716
  *
@@ -2229,6 +2306,58 @@ interface ImgixURLParams {
2229
2306
  * @see https://docs.imgix.com/apis/url/text/txt-width
2230
2307
  */
2231
2308
  txtwidth?: number;
2309
+ /**
2310
+ * Text x position
2311
+ *
2312
+ * Sets the horizontal (x) position of the text in pixels relative to the left
2313
+ * edge of the base image.
2314
+ *
2315
+ * Aliases: `txtx`
2316
+ *
2317
+ * @defaultValue `0`
2318
+ *
2319
+ * @see https://docs.imgix.com/apis/url/text/txt-x
2320
+ */
2321
+ txtX?: number;
2322
+ /**
2323
+ * Text x position
2324
+ *
2325
+ * Sets the horizontal (x) position of the text in pixels relative to the left
2326
+ * edge of the base image.
2327
+ *
2328
+ * Alias for: `txtX`
2329
+ *
2330
+ * @defaultValue `0`
2331
+ *
2332
+ * @see https://docs.imgix.com/apis/url/text/txt-x
2333
+ */
2334
+ txtx?: number;
2335
+ /**
2336
+ * Text y position
2337
+ *
2338
+ * Sets the vertical (y) position of the text in pixels relative to the top
2339
+ * edge of the base image.
2340
+ *
2341
+ * Aliases: `txty`
2342
+ *
2343
+ * @defaultValue `0`
2344
+ *
2345
+ * @see https://docs.imgix.com/apis/url/text/txt-y
2346
+ */
2347
+ txtY?: number;
2348
+ /**
2349
+ * Text y position
2350
+ *
2351
+ * Sets the vertical (y) position of the text in pixels relative to the top
2352
+ * edge of the base image.
2353
+ *
2354
+ * Alias for: `txtY`
2355
+ *
2356
+ * @defaultValue `0`
2357
+ *
2358
+ * @see https://docs.imgix.com/apis/url/text/txt-y
2359
+ */
2360
+ txty?: number;
2232
2361
  /**
2233
2362
  * Text string
2234
2363
  *
@@ -2313,7 +2442,7 @@ interface ImgixURLParams {
2313
2442
  /**
2314
2443
  * Parameters for `buildPixelDensitySrcSet`.
2315
2444
  */
2316
- declare type BuildPixelDensitySrcSetParams = Omit<ImgixURLParams, "dpr"> & {
2445
+ type BuildPixelDensitySrcSetParams = Omit<ImgixURLParams, "dpr"> & {
2317
2446
  /**
2318
2447
  * The pixel densities to include in the resulting `srcset` value.
2319
2448
  *
@@ -2371,7 +2500,7 @@ declare const buildPixelDensitySrcSet: (url: string, { pixelDensities, ...params
2371
2500
  /**
2372
2501
  * Parameters for `buildWidthSrcSet`.
2373
2502
  */
2374
- declare type BuildWidthSrcSetParams = Omit<ImgixURLParams, "width" | "w"> & {
2503
+ type BuildWidthSrcSetParams = Omit<ImgixURLParams, "width" | "w"> & {
2375
2504
  /**
2376
2505
  * The pixel widths to include in the resulting `srcset` value.
2377
2506
  *
@@ -2388,7 +2517,8 @@ declare type BuildWidthSrcSetParams = Omit<ImgixURLParams, "width" | "w"> & {
2388
2517
  * also optinally apply Imgix URL API parameters to the URLs.
2389
2518
  *
2390
2519
  * The `width` URL parameter will be applied for each `srcset` entry. If a
2391
- * `width` or `w` parameter is provided to the `params` parameter, it will be ignored.
2520
+ * `width` or `w` parameter is provided to the `params` parameter, it will be
2521
+ * ignored.
2392
2522
  *
2393
2523
  * @example
2394
2524
  *
@@ -2425,7 +2555,7 @@ declare const buildWidthSrcSet: (url: string, { widths, ...params }: BuildWidthS
2425
2555
  /**
2426
2556
  * Options to instantiate a new client.
2427
2557
  */
2428
- declare type ClientOptions = {
2558
+ type ClientOptions = {
2429
2559
  /**
2430
2560
  * The base URL used to construct image URLs from a path. The base URL must
2431
2561
  * include the protocol, domain, and optionally a path.
@@ -2484,7 +2614,8 @@ declare class Client {
2484
2614
  * to the URLs.
2485
2615
  *
2486
2616
  * The `width` URL parameter will be applied for each `srcset` entry. If a
2487
- * `width` or `w` parameter is provided to the `params` parameter, it will be ignored.
2617
+ * `width` or `w` parameter is provided to the `params` parameter, it will be
2618
+ * ignored.
2488
2619
  *
2489
2620
  * @example
2490
2621
  *
@@ -2570,7 +2701,8 @@ declare class Client {
2570
2701
  * The given URL must be a full absolute URL containing the protocol and domain.
2571
2702
  *
2572
2703
  * URL parameters already applied to the image will be retained. To remove
2573
- * existing parameters, set the parameter to `undefined` in the `params` argument.
2704
+ * existing parameters, set the parameter to `undefined` in the `params`
2705
+ * argument.
2574
2706
  *
2575
2707
  * @example
2576
2708
  *