Skip to content

Commit ac89edc

Browse files
committed
fix: patch update, add support for config options
2 parents cdaeec8 + 3b3d0be commit ac89edc

File tree

5 files changed

+144
-25
lines changed

5 files changed

+144
-25
lines changed

pnpm-lock.yaml

Lines changed: 119 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

svelte-cloudinary/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"types": "./dist/index.d.ts",
6262
"type": "module",
6363
"dependencies": {
64-
"@cloudinary-util/url-loader": "3.5.1",
64+
"@cloudinary-util/url-loader": "3.8.1",
6565
"@cloudinary-util/util": "2.0.1",
6666
"@unpic/core": "0.0.24",
6767
"@unpic/svelte": "0.0.25"

svelte-cloudinary/src/lib/components/CldImage.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
*/
1414
type $$Props = CldImageProps;
1515
16-
const CLD_OPTIONS = ['deliveryType', 'preserveTransformations'];
16+
const CLD_OPTIONS = ['config', 'deliveryType', 'preserveTransformations'];
1717
1818
// reactively destructure the props
19-
$: ({ alt, src, width, height } = $$props as $$Props);
19+
$: ({ alt, src, width, height, config } = $$props as $$Props);
2020
2121
transformationPlugins.forEach(({ props = [] }) => {
2222
props.forEach((prop) => {
@@ -89,6 +89,6 @@
8989
options.widthResize = width;
9090
}
9191

92-
return getCldImageUrl(options);
92+
return getCldImageUrl(options, config);
9393
}}
9494
/>

svelte-cloudinary/src/lib/components/CldImageTypes.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
import type { UnpicImageProps } from '@unpic/core';
55
import type { HTMLImgAttributes } from 'svelte/elements';
66
type ImageProps = UnpicImageProps<HTMLImgAttributes, string | null>;
7-
import type { ImageOptions } from '@cloudinary-util/url-loader';
7+
import type { ImageOptions, ConfigOptions } from '@cloudinary-util/url-loader';
88
export type CldImageProps = ImageOptions &
99
ImageProps & {
10+
config?: ConfigOptions;
1011
layout?: ImageProps['layout'];
1112
preserveTransformations?: boolean;
1213
tint?: string;

svelte-cloudinary/src/routes/+page.svelte

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,27 @@
22
import CldImage from '$lib/components/CldImage.svelte';
33
</script>
44

5+
<!-- <CldImage -->
6+
<!-- height={300} -->
7+
<!-- src="images/woman-headphones" -->
8+
<!-- removeBackground -->
9+
<!-- tint="70:blue:green:purple" -->
10+
<!-- underlay="images/city-skyline" -->
11+
<!-- sizes="100vw" -->
12+
<!-- alt="Description of my image" -->
13+
<!-- layout="fullWidth" -->
14+
<!-- /> -->
515
<CldImage
6-
height={1200}
16+
width={200}
17+
height={200}
718
src="images/woman-headphones"
8-
removeBackground
9-
tint="70:blue:green:purple"
10-
underlay="images/city-skyline"
11-
sizes="100vw"
12-
alt="Description of my image"
13-
layout="fullWidth"
19+
alt="Original image of images/woman with headphones"
20+
config={{
21+
cloud: {
22+
cloudName: 'next-cloudinary'
23+
},
24+
url: { secureDistribution: 'spacejelly.dev' }
25+
}}
1426
/>
1527
<!-- <CldImage -->
1628
<!-- width={1200} -->

0 commit comments

Comments
 (0)