@canlooks/can-ui 0.0.122 → 0.0.123

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.
@@ -200,12 +200,14 @@ function useResponsiveValue(prop, disabled = false) {
200
200
  const syncBreakpoints = (0, hooks_1.useSync)(breakpoints);
201
201
  const fn = () => {
202
202
  let maxBreakpoint = 'xs';
203
- for (const k in syncBreakpoints.current) {
204
- if (window.innerWidth < syncBreakpoints.current[k]) {
205
- break;
206
- }
207
- if (k in responsiveObj) {
208
- maxBreakpoint = k;
203
+ if (typeof window !== 'undefined') {
204
+ for (const k in syncBreakpoints.current) {
205
+ if (window.innerWidth < syncBreakpoints.current[k]) {
206
+ break;
207
+ }
208
+ if (k in responsiveObj) {
209
+ maxBreakpoint = k;
210
+ }
209
211
  }
210
212
  }
211
213
  return responsiveObj[maxBreakpoint];
@@ -184,12 +184,14 @@ export function useResponsiveValue(prop, disabled = false) {
184
184
  const syncBreakpoints = useSync(breakpoints);
185
185
  const fn = () => {
186
186
  let maxBreakpoint = 'xs';
187
- for (const k in syncBreakpoints.current) {
188
- if (window.innerWidth < syncBreakpoints.current[k]) {
189
- break;
190
- }
191
- if (k in responsiveObj) {
192
- maxBreakpoint = k;
187
+ if (typeof window !== 'undefined') {
188
+ for (const k in syncBreakpoints.current) {
189
+ if (window.innerWidth < syncBreakpoints.current[k]) {
190
+ break;
191
+ }
192
+ if (k in responsiveObj) {
193
+ maxBreakpoint = k;
194
+ }
193
195
  }
194
196
  }
195
197
  return responsiveObj[maxBreakpoint];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canlooks/can-ui",
3
- "version": "0.0.122",
3
+ "version": "0.0.123",
4
4
  "author": "C.CanLiang <canlooks@gmail.com>",
5
5
  "description": "My ui framework",
6
6
  "license": "MIT",