jazz-react-native 0.11.5 → 0.11.6
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +13 -0
- package/dist/media.d.ts +4 -2
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +4 -4
- package/dist/media.js.map +1 -1
- package/package.json +6 -6
- package/src/media.tsx +6 -2
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# jazz-browser
|
2
2
|
|
3
|
+
## 0.11.6
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- e7c85b7: Add targetWidth to highestResAvailable to add a way to fetch the next size up
|
8
|
+
- Updated dependencies [e7c85b7]
|
9
|
+
- Updated dependencies [8ed144e]
|
10
|
+
- jazz-tools@0.11.6
|
11
|
+
- cojson@0.11.6
|
12
|
+
- jazz-react-core@0.11.6
|
13
|
+
- cojson-storage-rn-sqlite@0.11.6
|
14
|
+
- cojson-transport-ws@0.11.6
|
15
|
+
|
3
16
|
## 0.11.5
|
4
17
|
|
5
18
|
### Patch Changes
|
package/dist/media.d.ts
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
import { ImageDefinition } from "jazz-tools";
|
2
2
|
import React from "react";
|
3
3
|
/** @category Media */
|
4
|
-
export declare function useProgressiveImg({ image, maxWidth, }: {
|
4
|
+
export declare function useProgressiveImg({ image, maxWidth, targetWidth, }: {
|
5
5
|
image: ImageDefinition | null | undefined;
|
6
6
|
maxWidth?: number;
|
7
|
+
targetWidth?: number;
|
7
8
|
}): {
|
8
9
|
src: string | undefined;
|
9
10
|
res: "placeholder" | `${number}x${number}` | undefined;
|
10
11
|
originalSize: import("jazz-tools").co<[number, number]> | undefined;
|
11
12
|
};
|
12
13
|
/** @category Media */
|
13
|
-
export declare function ProgressiveImg({ children, image, maxWidth, }: {
|
14
|
+
export declare function ProgressiveImg({ children, image, maxWidth, targetWidth, }: {
|
14
15
|
children: (result: {
|
15
16
|
src: string | undefined;
|
16
17
|
res: `${number}x${number}` | "placeholder" | undefined;
|
@@ -18,5 +19,6 @@ export declare function ProgressiveImg({ children, image, maxWidth, }: {
|
|
18
19
|
}) => React.ReactNode;
|
19
20
|
image: ImageDefinition | null | undefined;
|
20
21
|
maxWidth?: number;
|
22
|
+
targetWidth?: number;
|
21
23
|
}): React.ReactNode;
|
22
24
|
//# sourceMappingURL=media.d.ts.map
|
package/dist/media.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../src/media.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,sBAAsB;AACtB,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,QAAQ,
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../src/media.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,sBAAsB;AACtB,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,QAAQ,EACR,WAAW,GACZ,EAAE;IACD,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;;;;EA2DA;AAED,sBAAsB;AACtB,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,WAAW,GACZ,EAAE;IACD,QAAQ,EAAE,CAAC,MAAM,EAAE;QACjB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;QACxB,GAAG,EAAE,GAAG,MAAM,IAAI,MAAM,EAAE,GAAG,aAAa,GAAG,SAAS,CAAC;QACvD,YAAY,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;KACrD,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,mBAGA"}
|
package/dist/media.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
import { useEffect, useState } from "react";
|
2
2
|
/** @category Media */
|
3
|
-
export function useProgressiveImg({ image, maxWidth, }) {
|
3
|
+
export function useProgressiveImg({ image, maxWidth, targetWidth, }) {
|
4
4
|
const [current, setCurrent] = useState(undefined);
|
5
5
|
useEffect(() => {
|
6
6
|
let lastHighestRes;
|
7
7
|
if (!image)
|
8
8
|
return;
|
9
9
|
const unsub = image.subscribe({}, (update) => {
|
10
|
-
const highestRes = update?.highestResAvailable({ maxWidth });
|
10
|
+
const highestRes = update?.highestResAvailable({ maxWidth, targetWidth });
|
11
11
|
if (highestRes && highestRes.res !== lastHighestRes) {
|
12
12
|
lastHighestRes = highestRes.res;
|
13
13
|
// use the base64 data directly
|
@@ -54,8 +54,8 @@ export function useProgressiveImg({ image, maxWidth, }) {
|
|
54
54
|
};
|
55
55
|
}
|
56
56
|
/** @category Media */
|
57
|
-
export function ProgressiveImg({ children, image, maxWidth, }) {
|
58
|
-
const result = useProgressiveImg({ image, maxWidth });
|
57
|
+
export function ProgressiveImg({ children, image, maxWidth, targetWidth, }) {
|
58
|
+
const result = useProgressiveImg({ image, maxWidth, targetWidth });
|
59
59
|
return result && children(result);
|
60
60
|
}
|
61
61
|
//# sourceMappingURL=media.js.map
|
package/dist/media.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"media.js","sourceRoot":"","sources":["../src/media.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,O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AM,MAAM,GAAG,iBAAiB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;IACnE,OAAO,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "jazz-react-native",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.6",
|
4
4
|
"type": "module",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"module": "./dist/index.js",
|
@@ -28,11 +28,11 @@
|
|
28
28
|
"@scure/base": "1.2.1",
|
29
29
|
"react-native-nitro-modules": "0.21.0",
|
30
30
|
"react-native-quick-crypto": "1.0.0-beta.12",
|
31
|
-
"cojson": "0.11.
|
32
|
-
"cojson-storage-rn-sqlite": "0.11.
|
33
|
-
"cojson-transport-ws": "0.11.
|
34
|
-
"jazz-react-core": "0.11.
|
35
|
-
"jazz-tools": "0.11.
|
31
|
+
"cojson": "0.11.6",
|
32
|
+
"cojson-storage-rn-sqlite": "0.11.6",
|
33
|
+
"cojson-transport-ws": "0.11.6",
|
34
|
+
"jazz-react-core": "0.11.6",
|
35
|
+
"jazz-tools": "0.11.6"
|
36
36
|
},
|
37
37
|
"peerDependencies": {
|
38
38
|
"@react-native-community/netinfo": "*",
|
package/src/media.tsx
CHANGED
@@ -5,9 +5,11 @@ import React, { useEffect, useState } from "react";
|
|
5
5
|
export function useProgressiveImg({
|
6
6
|
image,
|
7
7
|
maxWidth,
|
8
|
+
targetWidth,
|
8
9
|
}: {
|
9
10
|
image: ImageDefinition | null | undefined;
|
10
11
|
maxWidth?: number;
|
12
|
+
targetWidth?: number;
|
11
13
|
}) {
|
12
14
|
const [current, setCurrent] = useState<
|
13
15
|
{ src?: string; res?: `${number}x${number}` | "placeholder" } | undefined
|
@@ -17,7 +19,7 @@ export function useProgressiveImg({
|
|
17
19
|
let lastHighestRes: string | undefined;
|
18
20
|
if (!image) return;
|
19
21
|
const unsub = image.subscribe({}, (update) => {
|
20
|
-
const highestRes = update?.highestResAvailable({ maxWidth });
|
22
|
+
const highestRes = update?.highestResAvailable({ maxWidth, targetWidth });
|
21
23
|
if (highestRes && highestRes.res !== lastHighestRes) {
|
22
24
|
lastHighestRes = highestRes.res;
|
23
25
|
// use the base64 data directly
|
@@ -74,6 +76,7 @@ export function ProgressiveImg({
|
|
74
76
|
children,
|
75
77
|
image,
|
76
78
|
maxWidth,
|
79
|
+
targetWidth,
|
77
80
|
}: {
|
78
81
|
children: (result: {
|
79
82
|
src: string | undefined;
|
@@ -82,7 +85,8 @@ export function ProgressiveImg({
|
|
82
85
|
}) => React.ReactNode;
|
83
86
|
image: ImageDefinition | null | undefined;
|
84
87
|
maxWidth?: number;
|
88
|
+
targetWidth?: number;
|
85
89
|
}) {
|
86
|
-
const result = useProgressiveImg({ image, maxWidth });
|
90
|
+
const result = useProgressiveImg({ image, maxWidth, targetWidth });
|
87
91
|
return result && children(result);
|
88
92
|
}
|