Spaces:
Sleeping
Sleeping
pythonic-rag-FastAPIReact / frontend /node_modules /@mui /system /modern /Unstable_Grid /traverseBreakpoints.js
Download frontend/node_modules/@mui/system/modern/Unstable_Grid/traverseBreakpoints.js from sepidnes/pythonic-rag-FastAPIReact: direct link, hf CLI and curl.
- Browser
- Download file 1.82 kB
-
https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/c9f908872ebbec3c4fa1392419c0f6cd3750ddb3/frontend/node_modules/%40mui/system/modern/Unstable_Grid/traverseBreakpoints.js
- Command line
-
hf download hf://spaces/sepidnes/pythonic-rag-FastAPIReact@c9f908872ebbec3c4fa1392419c0f6cd3750ddb3/frontend/node_modules/@mui/system/modern/Unstable_Grid/traverseBreakpoints.js
-
curl -L -o traverseBreakpoints.js https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/c9f908872ebbec3c4fa1392419c0f6cd3750ddb3/frontend/node_modules/%40mui/system/modern/Unstable_Grid/traverseBreakpoints.js
1.82 kB
| export const filterBreakpointKeys = (breakpointsKeys, responsiveKeys) => breakpointsKeys.filter(key => responsiveKeys.includes(key)); | |
| export const traverseBreakpoints = (breakpoints, responsive, iterator) => { | |
| const smallestBreakpoint = breakpoints.keys[0]; // the keys is sorted from smallest to largest by `createBreakpoints`. | |
| if (Array.isArray(responsive)) { | |
| responsive.forEach((breakpointValue, index) => { | |
| iterator((responsiveStyles, style) => { | |
| if (index <= breakpoints.keys.length - 1) { | |
| if (index === 0) { | |
| Object.assign(responsiveStyles, style); | |
| } else { | |
| responsiveStyles[breakpoints.up(breakpoints.keys[index])] = style; | |
| } | |
| } | |
| }, breakpointValue); | |
| }); | |
| } else if (responsive && typeof responsive === 'object') { | |
| // prevent null | |
| // responsive could be a very big object, pick the smallest responsive values | |
| const keys = Object.keys(responsive).length > breakpoints.keys.length ? breakpoints.keys : filterBreakpointKeys(breakpoints.keys, Object.keys(responsive)); | |
| keys.forEach(key => { | |
| if (breakpoints.keys.indexOf(key) !== -1) { | |
| // @ts-ignore already checked that responsive is an object | |
| const breakpointValue = responsive[key]; | |
| if (breakpointValue !== undefined) { | |
| iterator((responsiveStyles, style) => { | |
| if (smallestBreakpoint === key) { | |
| Object.assign(responsiveStyles, style); | |
| } else { | |
| responsiveStyles[breakpoints.up(key)] = style; | |
| } | |
| }, breakpointValue); | |
| } | |
| } | |
| }); | |
| } else if (typeof responsive === 'number' || typeof responsive === 'string') { | |
| iterator((responsiveStyles, style) => { | |
| Object.assign(responsiveStyles, style); | |
| }, responsive); | |
| } | |
| }; |