@deriv-web-design/ui 0.1.19 → 0.1.20
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/components.manifest.json +20 -0
- package/dist/index.d.mts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/components.manifest.json
CHANGED
|
@@ -1826,6 +1826,16 @@
|
|
|
1826
1826
|
"required": true,
|
|
1827
1827
|
"description": "Visible label on the link, e.g. \"Learn more\""
|
|
1828
1828
|
},
|
|
1829
|
+
"mediaSizes": {
|
|
1830
|
+
"type": "string",
|
|
1831
|
+
"required": false,
|
|
1832
|
+
"description": "Browser layout contract for `mediaSrcSet`. Defaults to the column this template actually lays out (`(min-width: 992px) 50vw, 100vw`), so a consumer supplying only `mediaSrcSet` still gets a correct pick."
|
|
1833
|
+
},
|
|
1834
|
+
"mediaSrcSet": {
|
|
1835
|
+
"type": "string",
|
|
1836
|
+
"required": false,
|
|
1837
|
+
"description": "Responsive candidates for `mediaUrl`, as a standard `srcset` string. Render-time only — a CMS stores one master URL and the renderer derives these. Without them the same file is sent to every device: the desktop media column is ~560 CSS px (1120 at DPR 2, so a 1200w rendition), while a phone paints the same slot at ~382 CSS px and needs 800w. Measured on one asset: 64,736 B against 40,120 B for the width that actually paints. Ignored for `\"lottie\"` items — an animation is played, not resized."
|
|
1838
|
+
},
|
|
1829
1839
|
"mediaType": {
|
|
1830
1840
|
"type": "\"image\" | \"lottie\"",
|
|
1831
1841
|
"required": false,
|
|
@@ -1836,6 +1846,16 @@
|
|
|
1836
1846
|
"required": true,
|
|
1837
1847
|
"description": "URL to the .lottie file or any image asset (png, jpg, svg, webp…)"
|
|
1838
1848
|
},
|
|
1849
|
+
"posterSizes": {
|
|
1850
|
+
"type": "string",
|
|
1851
|
+
"required": false,
|
|
1852
|
+
"description": "Layout contract for `posterSrcSet`. Same default as `mediaSizes`."
|
|
1853
|
+
},
|
|
1854
|
+
"posterSrcSet": {
|
|
1855
|
+
"type": "string",
|
|
1856
|
+
"required": false,
|
|
1857
|
+
"description": "Responsive candidates for `posterUrl`. Same contract as `mediaSrcSet`."
|
|
1858
|
+
},
|
|
1839
1859
|
"posterUrl": {
|
|
1840
1860
|
"type": "string",
|
|
1841
1861
|
"required": false,
|
package/dist/index.d.mts
CHANGED
|
@@ -750,6 +750,24 @@ interface FeatureScrollItem {
|
|
|
750
750
|
mediaType?: "lottie" | "image";
|
|
751
751
|
/** URL to the .lottie file or any image asset (png, jpg, svg, webp…) */
|
|
752
752
|
mediaUrl: string;
|
|
753
|
+
/**
|
|
754
|
+
* Responsive candidates for `mediaUrl`, as a standard `srcset` string.
|
|
755
|
+
*
|
|
756
|
+
* Render-time only — a CMS stores one master URL and the renderer derives
|
|
757
|
+
* these. Without them the same file is sent to every device: the desktop
|
|
758
|
+
* media column is ~560 CSS px (1120 at DPR 2, so a 1200w rendition), while a
|
|
759
|
+
* phone paints the same slot at ~382 CSS px and needs 800w. Measured on one
|
|
760
|
+
* asset: 64,736 B against 40,120 B for the width that actually paints.
|
|
761
|
+
*
|
|
762
|
+
* Ignored for `"lottie"` items — an animation is played, not resized.
|
|
763
|
+
*/
|
|
764
|
+
mediaSrcSet?: string;
|
|
765
|
+
/**
|
|
766
|
+
* Browser layout contract for `mediaSrcSet`. Defaults to the column this
|
|
767
|
+
* template actually lays out (`(min-width: 992px) 50vw, 100vw`), so a
|
|
768
|
+
* consumer supplying only `mediaSrcSet` still gets a correct pick.
|
|
769
|
+
*/
|
|
770
|
+
mediaSizes?: string;
|
|
753
771
|
/**
|
|
754
772
|
* Still frame painted while an animation's player and engine are loading.
|
|
755
773
|
*
|
|
@@ -760,6 +778,10 @@ interface FeatureScrollItem {
|
|
|
760
778
|
* a hole in the layout. Ignored once the animation is playing.
|
|
761
779
|
*/
|
|
762
780
|
posterUrl?: string;
|
|
781
|
+
/** Responsive candidates for `posterUrl`. Same contract as `mediaSrcSet`. */
|
|
782
|
+
posterSrcSet?: string;
|
|
783
|
+
/** Layout contract for `posterSrcSet`. Same default as `mediaSizes`. */
|
|
784
|
+
posterSizes?: string;
|
|
763
785
|
}
|
|
764
786
|
interface FeatureScrollProps extends HTMLAttributes<HTMLElement> {
|
|
765
787
|
/** Section heading rendered as an H2 */
|
package/dist/index.d.ts
CHANGED
|
@@ -750,6 +750,24 @@ interface FeatureScrollItem {
|
|
|
750
750
|
mediaType?: "lottie" | "image";
|
|
751
751
|
/** URL to the .lottie file or any image asset (png, jpg, svg, webp…) */
|
|
752
752
|
mediaUrl: string;
|
|
753
|
+
/**
|
|
754
|
+
* Responsive candidates for `mediaUrl`, as a standard `srcset` string.
|
|
755
|
+
*
|
|
756
|
+
* Render-time only — a CMS stores one master URL and the renderer derives
|
|
757
|
+
* these. Without them the same file is sent to every device: the desktop
|
|
758
|
+
* media column is ~560 CSS px (1120 at DPR 2, so a 1200w rendition), while a
|
|
759
|
+
* phone paints the same slot at ~382 CSS px and needs 800w. Measured on one
|
|
760
|
+
* asset: 64,736 B against 40,120 B for the width that actually paints.
|
|
761
|
+
*
|
|
762
|
+
* Ignored for `"lottie"` items — an animation is played, not resized.
|
|
763
|
+
*/
|
|
764
|
+
mediaSrcSet?: string;
|
|
765
|
+
/**
|
|
766
|
+
* Browser layout contract for `mediaSrcSet`. Defaults to the column this
|
|
767
|
+
* template actually lays out (`(min-width: 992px) 50vw, 100vw`), so a
|
|
768
|
+
* consumer supplying only `mediaSrcSet` still gets a correct pick.
|
|
769
|
+
*/
|
|
770
|
+
mediaSizes?: string;
|
|
753
771
|
/**
|
|
754
772
|
* Still frame painted while an animation's player and engine are loading.
|
|
755
773
|
*
|
|
@@ -760,6 +778,10 @@ interface FeatureScrollItem {
|
|
|
760
778
|
* a hole in the layout. Ignored once the animation is playing.
|
|
761
779
|
*/
|
|
762
780
|
posterUrl?: string;
|
|
781
|
+
/** Responsive candidates for `posterUrl`. Same contract as `mediaSrcSet`. */
|
|
782
|
+
posterSrcSet?: string;
|
|
783
|
+
/** Layout contract for `posterSrcSet`. Same default as `mediaSizes`. */
|
|
784
|
+
posterSizes?: string;
|
|
763
785
|
}
|
|
764
786
|
interface FeatureScrollProps extends HTMLAttributes<HTMLElement> {
|
|
765
787
|
/** Section heading rendered as an H2 */
|
package/dist/index.js
CHANGED
|
@@ -2804,6 +2804,7 @@ var ChevronRight2 = () => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
|
2804
2804
|
)
|
|
2805
2805
|
}
|
|
2806
2806
|
);
|
|
2807
|
+
var DEFAULT_MEDIA_SIZES = "(min-width: 992px) 50vw, 100vw";
|
|
2807
2808
|
function mediaSrc(item) {
|
|
2808
2809
|
return typeof item.mediaUrl === "string" && item.mediaUrl !== "" ? item.mediaUrl : null;
|
|
2809
2810
|
}
|
|
@@ -2827,6 +2828,10 @@ var MediaRenderer = ({ item, active, rootMargin, threshold }) => {
|
|
|
2827
2828
|
"img",
|
|
2828
2829
|
{
|
|
2829
2830
|
src: item.posterUrl,
|
|
2831
|
+
...item.posterSrcSet ? {
|
|
2832
|
+
srcSet: item.posterSrcSet,
|
|
2833
|
+
sizes: item.posterSizes ?? DEFAULT_MEDIA_SIZES
|
|
2834
|
+
} : {},
|
|
2830
2835
|
alt: "",
|
|
2831
2836
|
"aria-hidden": "true",
|
|
2832
2837
|
loading: "lazy",
|
|
@@ -2840,6 +2845,7 @@ var MediaRenderer = ({ item, active, rootMargin, threshold }) => {
|
|
|
2840
2845
|
"img",
|
|
2841
2846
|
{
|
|
2842
2847
|
src,
|
|
2848
|
+
...item.mediaSrcSet ? { srcSet: item.mediaSrcSet, sizes: item.mediaSizes ?? DEFAULT_MEDIA_SIZES } : {},
|
|
2843
2849
|
alt: item.title,
|
|
2844
2850
|
loading: "lazy",
|
|
2845
2851
|
decoding: "async"
|