Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const media = Object.keys(this.props.queries).reduce((acc, queryName) => {
const query = this.props.queries[queryName];
if (this.props.values) {
acc[queryName] = cssMediaQuery.match(query, this.props.values);
} else {
// if the consumer has not set `values` and is server rendering, default to false
// because we don't know the screen size
acc[queryName] = hasMatchMedia
? window.matchMedia(query).matches
: false;
}
return acc;
}, {});
const ssrMatchMedia = query => ({
matches: mediaQuery.match(query, {
// The estimated CSS width of the browser.
width: 800,
}),
});
get matches() {
return mediaQuery.match(query, state.currentDesc)
},
media: query,
const doesQueryMatch = (query, viewportSize) => {
if (!viewportSize) {
return true
}
return mediaQuery.match(query, {
type: 'screen',
width: `${viewportSize}px`,
})
}
? (query: string) => ({
matches: mediaQuery.match(query, {
width: theme.breakpoints.values[INITIAL_BREAKPOINT],
}),
})
: undefined,
mqKeys.forEach(key => {
const mqStr = key.replace(PREFIX, '');
const isMatch = mediaQuery.match(mqStr, matchObject);
if (isMatch) {
merge(res, obj[key]);
}
});
}
ast.stylesheet.rules = ast.stylesheet.rules.reduce(function (rules, rule) {
if (rule.type === 'media') {
if (mediaQuery.match(rule.media, options)) {
rules.push.apply(rules, rule.rules);
}
}
else {
rules.push(rule);
}
return rules;
}, []);
return ast;
get matches() {
return mediaQuery.match(this._query, {
type: 'screen',
...Dimensions.get('window'),
})
}
Object.keys(mediaQueries).forEach(id => {
const condition = mediaQueries[id]
const matches = mediaQuery.match(condition, media)
if (matches) {
classNames.push(id)
}
})
} catch (err) {