@plasmicapp/react-web 0.2.73 → 0.2.78
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/all.d.ts +9 -6
- package/dist/react-web.cjs.development.js +37 -15
- package/dist/react-web.cjs.development.js.map +1 -1
- package/dist/react-web.cjs.production.min.js +1 -1
- package/dist/react-web.cjs.production.min.js.map +1 -1
- package/dist/react-web.esm.js +37 -15
- package/dist/react-web.esm.js.map +1 -1
- package/dist/render/PlasmicImg/index.d.ts +9 -6
- package/lib/plasmic.css +9 -1
- package/package.json +2 -2
- package/skinny/dist/{collection-utils-4dae6efa.js → collection-utils-21ad9cae.js} +4 -3
- package/skinny/dist/{collection-utils-4dae6efa.js.map → collection-utils-21ad9cae.js.map} +1 -1
- package/skinny/dist/{collection-utils-57ec40f9.js → collection-utils-87ffc0ed.js} +4 -3
- package/skinny/dist/{collection-utils-57ec40f9.js.map → collection-utils-87ffc0ed.js.map} +1 -1
- package/skinny/dist/collection-utils-96cde83c.js +238 -0
- package/skinny/dist/collection-utils-96cde83c.js.map +1 -0
- package/skinny/dist/collection-utils-976df07d.js +238 -0
- package/skinny/dist/collection-utils-976df07d.js.map +1 -0
- package/skinny/dist/collection-utils-aadc3a43.js +238 -0
- package/skinny/dist/collection-utils-aadc3a43.js.map +1 -0
- package/skinny/dist/collection-utils-b8a2fd59.js +238 -0
- package/skinny/dist/collection-utils-b8a2fd59.js.map +1 -0
- package/skinny/dist/index.js +3 -3
- package/skinny/dist/plume/checkbox/index.js +3 -3
- package/skinny/dist/plume/menu/index.js +4 -4
- package/skinny/dist/plume/menu-button/index.js +3 -3
- package/skinny/dist/plume/select/index.js +4 -4
- package/skinny/dist/plume/switch/index.js +3 -3
- package/skinny/dist/plume/triggered-overlay/index.js +3 -3
- package/skinny/dist/props-utils-1f98cfd3.js +40 -0
- package/skinny/dist/props-utils-1f98cfd3.js.map +1 -0
- package/skinny/dist/{props-utils-5c0ad25a.js → props-utils-40224c71.js} +3 -2
- package/skinny/dist/props-utils-40224c71.js.map +1 -0
- package/skinny/dist/props-utils-69f9ba8b.js +40 -0
- package/skinny/dist/props-utils-69f9ba8b.js.map +1 -0
- package/skinny/dist/{props-utils-fd5f444e.js → props-utils-6cf101b2.js} +2 -2
- package/skinny/dist/{props-utils-5c0ad25a.js.map → props-utils-6cf101b2.js.map} +1 -1
- package/skinny/dist/props-utils-754f655a.js +39 -0
- package/skinny/dist/{props-utils-fd5f444e.js.map → props-utils-754f655a.js.map} +1 -1
- package/skinny/dist/props-utils-85691c9c.js +40 -0
- package/skinny/dist/props-utils-85691c9c.js.map +1 -0
- package/skinny/dist/{react-utils-2a2fd6c9.js → react-utils-06bae09a.js} +14 -61
- package/skinny/dist/react-utils-06bae09a.js.map +1 -0
- package/skinny/dist/react-utils-14af9d28.js +172 -0
- package/skinny/dist/react-utils-14af9d28.js.map +1 -0
- package/skinny/dist/react-utils-7c01e440.js +172 -0
- package/skinny/dist/react-utils-7c01e440.js.map +1 -0
- package/skinny/dist/react-utils-834a65c3.js +254 -0
- package/skinny/dist/react-utils-834a65c3.js.map +1 -0
- package/skinny/dist/{react-utils-675565b4.js → react-utils-ae69f4e0.js} +3 -46
- package/skinny/dist/react-utils-ae69f4e0.js.map +1 -0
- package/skinny/dist/react-utils-cca81efc.js +245 -0
- package/skinny/dist/react-utils-cca81efc.js.map +1 -0
- package/skinny/dist/render/PlasmicImg/index.d.ts +9 -6
- package/skinny/dist/render/PlasmicImg/index.js +43 -17
- package/skinny/dist/render/PlasmicImg/index.js.map +1 -1
- package/skinny/dist/stories/Button.d.ts +29 -0
- package/skinny/dist/stories/Header.d.ts +10 -0
- package/skinny/dist/stories/Page.d.ts +10 -0
- package/skinny/dist/tslib.es6-10d3f595.js +132 -0
- package/skinny/dist/tslib.es6-10d3f595.js.map +1 -0
- package/skinny/dist/tslib.es6-d26ffe68.js +132 -0
- package/skinny/dist/tslib.es6-d26ffe68.js.map +1 -0
- package/skinny/dist/react-utils-2a2fd6c9.js.map +0 -1
- package/skinny/dist/react-utils-675565b4.js.map +0 -1
package/dist/all.d.ts
CHANGED
|
@@ -91,12 +91,15 @@ declare function PlasmicIcon(props: React.ComponentProps<"svg"> & {
|
|
|
91
91
|
* Responsive `<img/>` replacement, based on `next/image`
|
|
92
92
|
*/
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
interface ImageLoader {
|
|
95
|
+
supportsUrl: (url: string) => boolean;
|
|
96
|
+
transformUrl: (opts: {
|
|
97
|
+
src: string;
|
|
98
|
+
width?: number;
|
|
99
|
+
quality?: number;
|
|
100
|
+
format?: "webp";
|
|
101
|
+
}) => string;
|
|
102
|
+
}
|
|
100
103
|
declare type ImgTagProps = Omit<React__default.ComponentProps<"img">, "src" | "srcSet" | "ref" | "style">;
|
|
101
104
|
interface PlasmicImgProps extends ImgTagProps {
|
|
102
105
|
/**
|
|
@@ -889,10 +889,10 @@ function makePicture(opts) {
|
|
|
889
889
|
ref = opts.ref;
|
|
890
890
|
return React__default.createElement("picture", {
|
|
891
891
|
className: "__wab_picture"
|
|
892
|
-
}, imageLoader && React__default.createElement("source", {
|
|
892
|
+
}, imageLoader && imageLoader.supportsUrl(src) && React__default.createElement("source", {
|
|
893
893
|
type: "image/webp",
|
|
894
894
|
srcSet: widthDescs.map(function (wd) {
|
|
895
|
-
return imageLoader({
|
|
895
|
+
return imageLoader.transformUrl({
|
|
896
896
|
src: src,
|
|
897
897
|
quality: quality,
|
|
898
898
|
width: wd.width,
|
|
@@ -903,13 +903,13 @@ function makePicture(opts) {
|
|
|
903
903
|
ref: ref,
|
|
904
904
|
className: className,
|
|
905
905
|
decoding: "async",
|
|
906
|
-
src: imageLoader ? imageLoader({
|
|
906
|
+
src: imageLoader && imageLoader.supportsUrl(src) ? imageLoader.transformUrl({
|
|
907
907
|
src: src,
|
|
908
908
|
quality: quality,
|
|
909
909
|
width: widthDescs[widthDescs.length - 1].width
|
|
910
910
|
}) : src,
|
|
911
|
-
srcSet: imageLoader ? widthDescs.map(function (wd) {
|
|
912
|
-
return imageLoader({
|
|
911
|
+
srcSet: imageLoader && imageLoader.supportsUrl(src) ? widthDescs.map(function (wd) {
|
|
912
|
+
return imageLoader.transformUrl({
|
|
913
913
|
src: src,
|
|
914
914
|
quality: quality,
|
|
915
915
|
width: wd.width
|
|
@@ -920,12 +920,20 @@ function makePicture(opts) {
|
|
|
920
920
|
})));
|
|
921
921
|
}
|
|
922
922
|
|
|
923
|
-
function getClosestPresetSize(width) {
|
|
923
|
+
function getClosestPresetSize(width, fullWidth) {
|
|
924
924
|
var _ALL_SIZES$find;
|
|
925
925
|
|
|
926
|
-
|
|
926
|
+
var nextBigger = (_ALL_SIZES$find = ALL_SIZES.find(function (w) {
|
|
927
927
|
return w >= width;
|
|
928
928
|
})) != null ? _ALL_SIZES$find : ALL_SIZES[ALL_SIZES.length - 1];
|
|
929
|
+
|
|
930
|
+
if (nextBigger >= fullWidth / 2) {
|
|
931
|
+
// If the requested width is larger than half the fullWidth,
|
|
932
|
+
// we just use the original width instead
|
|
933
|
+
return undefined;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
return nextBigger;
|
|
929
937
|
}
|
|
930
938
|
/**
|
|
931
939
|
* Computes the appropriate srcSet and sizes to use
|
|
@@ -939,10 +947,10 @@ function getWidths(width, fullWidth) {
|
|
|
939
947
|
// If there's an exact width, then we just need to display it at 1x and 2x density
|
|
940
948
|
return {
|
|
941
949
|
widthDescs: [{
|
|
942
|
-
width: getClosestPresetSize(pixelWidth),
|
|
950
|
+
width: getClosestPresetSize(pixelWidth, fullWidth),
|
|
943
951
|
desc: "1x"
|
|
944
952
|
}, {
|
|
945
|
-
width: getClosestPresetSize(pixelWidth * 2),
|
|
953
|
+
width: getClosestPresetSize(pixelWidth * 2, fullWidth),
|
|
946
954
|
desc: "2x"
|
|
947
955
|
}],
|
|
948
956
|
sizes: undefined
|
|
@@ -960,7 +968,7 @@ function getWidths(width, fullWidth) {
|
|
|
960
968
|
// is offer 1x
|
|
961
969
|
return {
|
|
962
970
|
widthDescs: [{
|
|
963
|
-
width: getClosestPresetSize(fullWidth),
|
|
971
|
+
width: getClosestPresetSize(fullWidth, fullWidth),
|
|
964
972
|
desc: "1x"
|
|
965
973
|
}],
|
|
966
974
|
sizes: undefined
|
|
@@ -968,9 +976,15 @@ function getWidths(width, fullWidth) {
|
|
|
968
976
|
}
|
|
969
977
|
|
|
970
978
|
return {
|
|
971
|
-
widthDescs: usefulSizes.map(function (size) {
|
|
979
|
+
widthDescs: usefulSizes.map(function (size, i) {
|
|
972
980
|
return {
|
|
973
|
-
width:
|
|
981
|
+
width: // If this is the last (buggest) useful width, but it is
|
|
982
|
+
// still within the bounds set by DEVICE_SIZES, then just
|
|
983
|
+
// use the original, unresized image. This means if we match
|
|
984
|
+
// the largest size, we use unresized and best quality image.
|
|
985
|
+
// We only do this, though, if fullWidth is "reasonable" --
|
|
986
|
+
// smaller than the largest size we would consider.
|
|
987
|
+
i === usefulSizes.length - 1 && fullWidth < DEVICE_SIZES[DEVICE_SIZES.length - 1] ? undefined : size,
|
|
974
988
|
desc: size + "w"
|
|
975
989
|
};
|
|
976
990
|
}),
|
|
@@ -1032,10 +1046,18 @@ function getImageLoader(loader) {
|
|
|
1032
1046
|
}
|
|
1033
1047
|
}
|
|
1034
1048
|
|
|
1035
|
-
var PLASMIC_IMAGE_LOADER =
|
|
1036
|
-
|
|
1049
|
+
var PLASMIC_IMAGE_LOADER = {
|
|
1050
|
+
supportsUrl: function supportsUrl(src) {
|
|
1051
|
+
return src.startsWith("https://img.plasmic.app");
|
|
1052
|
+
},
|
|
1053
|
+
transformUrl: function transformUrl(opts) {
|
|
1054
|
+
var _opts$quality;
|
|
1037
1055
|
|
|
1038
|
-
|
|
1056
|
+
var params = [opts.width ? "w=" + opts.width : undefined, "q=" + ((_opts$quality = opts.quality) != null ? _opts$quality : 75), opts.format ? "f=" + opts.format : undefined].filter(function (x) {
|
|
1057
|
+
return !!x;
|
|
1058
|
+
});
|
|
1059
|
+
return opts.src + "?" + params.join("&");
|
|
1060
|
+
}
|
|
1039
1061
|
};
|
|
1040
1062
|
|
|
1041
1063
|
function PlasmicLink(props) {
|