qstd 0.3.41 → 0.3.42
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/react/index.cjs +20 -12
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +20 -12
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -2946,10 +2946,13 @@ function Backdrop(props) {
|
|
|
2946
2946
|
);
|
|
2947
2947
|
}
|
|
2948
2948
|
function useMatchMedia(queries) {
|
|
2949
|
+
const isClient = typeof window !== "undefined";
|
|
2949
2950
|
const [value, setValue] = React13__namespace.default.useState(() => {
|
|
2951
|
+
if (!isClient) return queries.map(() => false);
|
|
2950
2952
|
return queries.map((q) => window.matchMedia(q).matches);
|
|
2951
2953
|
});
|
|
2952
2954
|
React13__namespace.default.useLayoutEffect(() => {
|
|
2955
|
+
if (!isClient) return;
|
|
2953
2956
|
const mediaQueryLists = queries.map((q) => window.matchMedia(q));
|
|
2954
2957
|
const handler = () => {
|
|
2955
2958
|
setValue(mediaQueryLists.map((mql) => mql.matches));
|
|
@@ -2959,7 +2962,7 @@ function useMatchMedia(queries) {
|
|
|
2959
2962
|
return () => mediaQueryLists.forEach(
|
|
2960
2963
|
(mql) => mql.removeEventListener("change", handler)
|
|
2961
2964
|
);
|
|
2962
|
-
}, [queries]);
|
|
2965
|
+
}, [queries, isClient]);
|
|
2963
2966
|
return value;
|
|
2964
2967
|
}
|
|
2965
2968
|
var MotionDiv5 = motionTags.div;
|
|
@@ -4141,18 +4144,23 @@ function useThrottle(value, interval = 500) {
|
|
|
4141
4144
|
}
|
|
4142
4145
|
function useMatchMedia2(queries, defaultValues = []) {
|
|
4143
4146
|
const initialValues = defaultValues.length ? defaultValues : Array(queries.length).fill(false);
|
|
4144
|
-
const
|
|
4145
|
-
const
|
|
4146
|
-
|
|
4147
|
-
return
|
|
4148
|
-
};
|
|
4149
|
-
const [value, setValue] = React13__namespace.default.useState(getValue);
|
|
4147
|
+
const isClient = typeof window !== "undefined";
|
|
4148
|
+
const [value, setValue] = React13__namespace.default.useState(() => {
|
|
4149
|
+
if (!isClient) return initialValues;
|
|
4150
|
+
return queries.map((q) => window.matchMedia(q).matches);
|
|
4151
|
+
});
|
|
4150
4152
|
React13__namespace.default.useLayoutEffect(() => {
|
|
4151
|
-
|
|
4152
|
-
mediaQueryLists.
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4153
|
+
if (!isClient) return;
|
|
4154
|
+
const mediaQueryLists = queries.map((q) => window.matchMedia(q));
|
|
4155
|
+
const handler = () => {
|
|
4156
|
+
setValue(mediaQueryLists.map((mql) => mql.matches));
|
|
4157
|
+
};
|
|
4158
|
+
handler();
|
|
4159
|
+
mediaQueryLists.forEach((mql) => mql.addEventListener("change", handler));
|
|
4160
|
+
return () => mediaQueryLists.forEach(
|
|
4161
|
+
(mql) => mql.removeEventListener("change", handler)
|
|
4162
|
+
);
|
|
4163
|
+
}, [queries, isClient]);
|
|
4156
4164
|
return value;
|
|
4157
4165
|
}
|
|
4158
4166
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAKH,OAAO,gCAAgC,CAAC;AAKxC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMlD,MAAM,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC;AAClC,MAAM,MAAM,YAAY,GAAG,OAAO,EAAE,CAAC;AAErC;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,MAAY,UAe7D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAY,UAkChE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,UAAU,EACnB,aAAa,GAAE,YAAiB,GAC/B,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAKH,OAAO,gCAAgC,CAAC;AAKxC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMlD,MAAM,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC;AAClC,MAAM,MAAM,YAAY,GAAG,OAAO,EAAE,CAAC;AAErC;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,MAAY,UAe7D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAY,UAkChE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,UAAU,EACnB,aAAa,GAAE,YAAiB,GAC/B,YAAY,CAoCd;AAED,cAAc,aAAa,CAAC"}
|
package/dist/react/index.js
CHANGED
|
@@ -2923,10 +2923,13 @@ function Backdrop(props) {
|
|
|
2923
2923
|
);
|
|
2924
2924
|
}
|
|
2925
2925
|
function useMatchMedia(queries) {
|
|
2926
|
+
const isClient = typeof window !== "undefined";
|
|
2926
2927
|
const [value, setValue] = React13__default.useState(() => {
|
|
2928
|
+
if (!isClient) return queries.map(() => false);
|
|
2927
2929
|
return queries.map((q) => window.matchMedia(q).matches);
|
|
2928
2930
|
});
|
|
2929
2931
|
React13__default.useLayoutEffect(() => {
|
|
2932
|
+
if (!isClient) return;
|
|
2930
2933
|
const mediaQueryLists = queries.map((q) => window.matchMedia(q));
|
|
2931
2934
|
const handler = () => {
|
|
2932
2935
|
setValue(mediaQueryLists.map((mql) => mql.matches));
|
|
@@ -2936,7 +2939,7 @@ function useMatchMedia(queries) {
|
|
|
2936
2939
|
return () => mediaQueryLists.forEach(
|
|
2937
2940
|
(mql) => mql.removeEventListener("change", handler)
|
|
2938
2941
|
);
|
|
2939
|
-
}, [queries]);
|
|
2942
|
+
}, [queries, isClient]);
|
|
2940
2943
|
return value;
|
|
2941
2944
|
}
|
|
2942
2945
|
var MotionDiv5 = motionTags.div;
|
|
@@ -4118,18 +4121,23 @@ function useThrottle(value, interval = 500) {
|
|
|
4118
4121
|
}
|
|
4119
4122
|
function useMatchMedia2(queries, defaultValues = []) {
|
|
4120
4123
|
const initialValues = defaultValues.length ? defaultValues : Array(queries.length).fill(false);
|
|
4121
|
-
const
|
|
4122
|
-
const
|
|
4123
|
-
|
|
4124
|
-
return
|
|
4125
|
-
};
|
|
4126
|
-
const [value, setValue] = React13__default.useState(getValue);
|
|
4124
|
+
const isClient = typeof window !== "undefined";
|
|
4125
|
+
const [value, setValue] = React13__default.useState(() => {
|
|
4126
|
+
if (!isClient) return initialValues;
|
|
4127
|
+
return queries.map((q) => window.matchMedia(q).matches);
|
|
4128
|
+
});
|
|
4127
4129
|
React13__default.useLayoutEffect(() => {
|
|
4128
|
-
|
|
4129
|
-
mediaQueryLists.
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4130
|
+
if (!isClient) return;
|
|
4131
|
+
const mediaQueryLists = queries.map((q) => window.matchMedia(q));
|
|
4132
|
+
const handler = () => {
|
|
4133
|
+
setValue(mediaQueryLists.map((mql) => mql.matches));
|
|
4134
|
+
};
|
|
4135
|
+
handler();
|
|
4136
|
+
mediaQueryLists.forEach((mql) => mql.addEventListener("change", handler));
|
|
4137
|
+
return () => mediaQueryLists.forEach(
|
|
4138
|
+
(mql) => mql.removeEventListener("change", handler)
|
|
4139
|
+
);
|
|
4140
|
+
}, [queries, isClient]);
|
|
4133
4141
|
return value;
|
|
4134
4142
|
}
|
|
4135
4143
|
|