(
query: BreakpointQuery | MediaQueryInput | (string & {}),
)
| 30 | } |
| 31 | |
| 32 | function parseQuery( |
| 33 | query: BreakpointQuery | MediaQueryInput | (string & {}), |
| 34 | ): string { |
| 35 | if (typeof query !== "string") { |
| 36 | const parts: string[] = []; |
| 37 | if (query.min != null) parts.push(resolveMin(query.min)); |
| 38 | if (query.max != null) parts.push(resolveMax(query.max)); |
| 39 | if (query.pointer === "coarse") parts.push("(pointer: coarse)"); |
| 40 | if (query.pointer === "fine") parts.push("(pointer: fine)"); |
| 41 | if (parts.length === 0) return "(min-width: 0px)"; |
| 42 | return parts.join(" and "); |
| 43 | } |
| 44 | |
| 45 | if (query.startsWith("(")) return query; |
| 46 | |
| 47 | const parts: string[] = []; |
| 48 | for (const segment of query.split(":")) { |
| 49 | if (segment.startsWith("max-")) { |
| 50 | const bp = segment.slice(4); |
| 51 | if (bp in BREAKPOINTS) parts.push(resolveMax(bp as Breakpoint)); |
| 52 | } else if (segment in BREAKPOINTS) { |
| 53 | parts.push(resolveMin(segment as Breakpoint)); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | return parts.length > 0 ? parts.join(" and ") : query; |
| 58 | } |
| 59 | |
| 60 | function getServerSnapshot(): boolean { |
| 61 | return false; |
no test coverage detected