@pylonsync/react 0.3.356 → 0.3.358
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/Image.d.ts +21 -3
- package/package.json +3 -3
- package/src/Image.tsx +22 -3
package/dist/Image.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The three qualities `PYLON_IMAGE_QUALITIES` allows out of the box, kept as
|
|
4
|
+
* literals so editors and coding agents autocomplete a value the server will
|
|
5
|
+
* actually render. `(number & {})` keeps the union open for apps that have
|
|
6
|
+
* configured a different set — it accepts any number without collapsing the
|
|
7
|
+
* literals out of the completion list.
|
|
8
|
+
*/
|
|
9
|
+
export type PylonImageQuality = 50 | 75 | 90 | (number & {});
|
|
2
10
|
export interface ImageProps extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, "src" | "width" | "height" | "loading" | "srcSet"> {
|
|
3
11
|
/** Source URL — site-relative (`/foo.jpg`) or http(s) (allowlisted via env). */
|
|
4
12
|
src: string;
|
|
@@ -9,10 +17,20 @@ export interface ImageProps extends Omit<React.ImgHTMLAttributes<HTMLImageElemen
|
|
|
9
17
|
/** Required alt text. Pass `""` for purely decorative images. */
|
|
10
18
|
alt: string;
|
|
11
19
|
/**
|
|
12
|
-
* JPEG/WebP quality
|
|
13
|
-
*
|
|
20
|
+
* JPEG/WebP quality. Default 75. PNG ignores it (lossless).
|
|
21
|
+
*
|
|
22
|
+
* This is an ALLOWLIST, not a range: the server renders the values in
|
|
23
|
+
* `PYLON_IMAGE_QUALITIES`, which defaults to **50, 75, 90**. Anything else
|
|
24
|
+
* — `quality={80}` being the usual one — snaps to the nearest of them, so
|
|
25
|
+
* the image still renders, and the server logs which value it actually
|
|
26
|
+
* served. `pylon dev` prints that to your console; don't ignore it, you are
|
|
27
|
+
* not getting the quality you asked for.
|
|
28
|
+
*
|
|
29
|
+
* Bounding the set is what keeps a caller from minting unlimited distinct
|
|
30
|
+
* cache entries. Pick one of the allowed values, or set
|
|
31
|
+
* `PYLON_IMAGE_QUALITIES` to the ones your app actually uses.
|
|
14
32
|
*/
|
|
15
|
-
quality?:
|
|
33
|
+
quality?: PylonImageQuality;
|
|
16
34
|
/**
|
|
17
35
|
* Override the candidate widths used in `srcset`. By default we
|
|
18
36
|
* emit 1x and 2x of `width`, capped at 3840px.
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.3.
|
|
6
|
+
"version": "0.3.358",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"prepack": "bun run build"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@pylonsync/sdk": "0.3.
|
|
17
|
-
"@pylonsync/sync": "0.3.
|
|
16
|
+
"@pylonsync/sdk": "0.3.358",
|
|
17
|
+
"@pylonsync/sync": "0.3.358"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"react": ">=19.0.0"
|
package/src/Image.tsx
CHANGED
|
@@ -26,6 +26,15 @@
|
|
|
26
26
|
|
|
27
27
|
import React from "react";
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* The three qualities `PYLON_IMAGE_QUALITIES` allows out of the box, kept as
|
|
31
|
+
* literals so editors and coding agents autocomplete a value the server will
|
|
32
|
+
* actually render. `(number & {})` keeps the union open for apps that have
|
|
33
|
+
* configured a different set — it accepts any number without collapsing the
|
|
34
|
+
* literals out of the completion list.
|
|
35
|
+
*/
|
|
36
|
+
export type PylonImageQuality = 50 | 75 | 90 | (number & {});
|
|
37
|
+
|
|
29
38
|
export interface ImageProps
|
|
30
39
|
extends Omit<
|
|
31
40
|
React.ImgHTMLAttributes<HTMLImageElement>,
|
|
@@ -40,10 +49,20 @@ export interface ImageProps
|
|
|
40
49
|
/** Required alt text. Pass `""` for purely decorative images. */
|
|
41
50
|
alt: string;
|
|
42
51
|
/**
|
|
43
|
-
* JPEG/WebP quality
|
|
44
|
-
*
|
|
52
|
+
* JPEG/WebP quality. Default 75. PNG ignores it (lossless).
|
|
53
|
+
*
|
|
54
|
+
* This is an ALLOWLIST, not a range: the server renders the values in
|
|
55
|
+
* `PYLON_IMAGE_QUALITIES`, which defaults to **50, 75, 90**. Anything else
|
|
56
|
+
* — `quality={80}` being the usual one — snaps to the nearest of them, so
|
|
57
|
+
* the image still renders, and the server logs which value it actually
|
|
58
|
+
* served. `pylon dev` prints that to your console; don't ignore it, you are
|
|
59
|
+
* not getting the quality you asked for.
|
|
60
|
+
*
|
|
61
|
+
* Bounding the set is what keeps a caller from minting unlimited distinct
|
|
62
|
+
* cache entries. Pick one of the allowed values, or set
|
|
63
|
+
* `PYLON_IMAGE_QUALITIES` to the ones your app actually uses.
|
|
45
64
|
*/
|
|
46
|
-
quality?:
|
|
65
|
+
quality?: PylonImageQuality;
|
|
47
66
|
/**
|
|
48
67
|
* Override the candidate widths used in `srcset`. By default we
|
|
49
68
|
* emit 1x and 2x of `width`, capped at 3840px.
|