From 72f0dfcd060ac0e92bb1e02d81dee061d8717473 Mon Sep 17 00:00:00 2001 From: Abraham Date: Sun, 24 Jan 2021 06:37:51 +0000 Subject: [PATCH] add import and refactor template to CSS Media Queries #97 --- creep.js | 132 +++++++------------- index.html | 48 +------ modules/computedStyle.js | 16 +-- modules/css.js | 264 +++++++++++++++++---------------------- style.css | 4 +- 5 files changed, 176 insertions(+), 288 deletions(-) diff --git a/creep.js b/creep.js index 5e8e8840..9a0b74f4 100644 --- a/creep.js +++ b/creep.js @@ -334,7 +334,7 @@ const imports = { anyPointer: caniuse(() => fp.cssMedia.mediaCSS.anyPointer), pointer: caniuse(() => fp.cssMedia.mediaCSS.pointer), colorGamut: caniuse(() => fp.cssMedia.mediaCSS.colorGamut), - screenQuery: caniuse(() => fp.cssMedia.mediaCSS.screenQuery), + screenQuery: caniuse(() => fp.cssMedia.screenQuery), }, css: !fp.css ? undefined : { prototype: caniuse(() => fp.css.getComputedStyle.prototypeName), @@ -1002,43 +1002,13 @@ const imports = { })()}
- ${!fp.css ? `
- @media -
screen query: ${note.blocked}
-
device aspect ratio: ${note.blocked}
-
device screen: ${note.blocked}
-
display mode: ${note.unsupported}
-
orientation: ${note.unsupported}
-
motion: ${note.unsupported}
-
hover: ${note.unsupported}
-
any hover: ${note.unsupported}
-
pointer: ${note.unsupported}
-
any pointer: ${note.unsupported}
-
monochrome: ${note.unsupported}
-
color scheme: ${note.unsupported}
-
color gamut: ${note.unsupported}
-
forced colors: ${note.unsupported}
-
inverted colors: ${note.unsupported}
-
-
- MediaQueryList + CSS Media Queries< +
@media: ${note.blocked}
+
@import: ${note.blocked}
+
matchMedia: ${note.blocked}
screen query: ${note.blocked}
-
device aspect ratio: ${note.blocked}
-
device screen: ${note.blocked}
-
display mode: ${note.unsupported}
-
orientation: ${note.unsupported}
-
motion: ${note.unsupported}
-
hover: ${note.unsupported}
-
any hover: ${note.unsupported}
-
pointer: ${note.unsupported}
-
any pointer: ${note.unsupported}
-
monochrome: ${note.unsupported}
-
color scheme: ${note.unsupported}
-
color gamut: ${note.unsupported}
-
forced colors: ${note.unsupported}
-
inverted colors: ${note.unsupported}
` : (() => { const { @@ -1046,60 +1016,47 @@ const imports = { } = fp const { $hash, + importCSS, mediaCSS, - matchMediaCSS + matchMediaCSS, + screenQuery } = data + return `
- @media${hashMini(mediaCSS)} -
screen query: ${''+mediaCSS.screenQuery.width} x ${''+mediaCSS.screenQuery.height}
-
screen match: ${mediaCSS.deviceScreen || note.blocked}
-
device aspect ratio: ${mediaCSS.deviceAspectRatio || note.blocked}
-
display mode: ${mediaCSS.displayMode || note.unsupported}
-
orientation: ${mediaCSS.orientation || note.unsupported}
-
motion: ${mediaCSS.reducedMotion || note.unsupported}
-
hover: ${mediaCSS.hover || note.unsupported}
-
any hover: ${mediaCSS.anyHover || note.unsupported}
-
pointer: ${mediaCSS.pointer || note.unsupported}
-
any pointer: ${mediaCSS.anyPointer || note.unsupported}
-
monochrome: ${mediaCSS.monochrome || note.unsupported}
-
color scheme: ${mediaCSS.colorScheme || note.unsupported}
-
color gamut: ${mediaCSS.colorGamut || note.unsupported}
-
forced colors: ${mediaCSS.forcedColors || note.unsupported}
-
inverted colors: ${mediaCSS.invertedColors || note.unsupported}
-
-
- MediaQueryList${hashMini(matchMediaCSS)} -
screen query: ${''+matchMediaCSS.screenQuery.width} x ${''+matchMediaCSS.screenQuery.height}
-
screen match: ${matchMediaCSS.deviceScreen || note.blocked}
-
device aspect ratio: ${matchMediaCSS.deviceAspectRatio || note.blocked}
-
display mode: ${matchMediaCSS.displayMode || note.unsupported}
-
orientation: ${matchMediaCSS.orientation || note.unsupported}
-
motion: ${matchMediaCSS.reducedMotion || note.unsupported}
-
hover: ${matchMediaCSS.hover || note.unsupported}
-
any hover: ${matchMediaCSS.anyHover || note.unsupported}
-
pointer: ${matchMediaCSS.pointer || note.unsupported}
-
any pointer: ${matchMediaCSS.anyPointer || note.unsupported}
-
monochrome: ${matchMediaCSS.monochrome || note.unsupported}
-
color scheme: ${matchMediaCSS.colorScheme || note.unsupported}
-
color gamut: ${matchMediaCSS.colorGamut || note.unsupported}
-
forced colors: ${matchMediaCSS.forcedColors || note.unsupported}
-
inverted colors: ${matchMediaCSS.invertedColors || note.unsupported}
+ CSS Media Queries${hashMini($hash)} +
@media: ${ + !mediaCSS ? note.blocked : + modal( + 'creep-css-media', + Object.keys(mediaCSS).map(key => `${key}: ${mediaCSS[key] || note.unsupported}`).join('
'), + hashMini(mediaCSS) + ) + }
+
@import: ${ + !importCSS ? note.blocked : + modal( + 'creep-css-import', + Object.keys(importCSS).map(key => `${key}: ${importCSS[key] || note.unsupported}`).join('
'), + hashMini(importCSS) + ) + }
+
matchMedia: ${ + !matchMediaCSS ? note.blocked : + modal( + 'creep-css-match-media', + Object.keys(matchMediaCSS).map(key => `${key}: ${matchMediaCSS[key] || note.unsupported}`).join('
'), + hashMini(matchMediaCSS) + ) + }
+
screen query: ${!screenQuery ? note.blocked : `${screenQuery.width} x ${screenQuery.height}`}
` })()} -
-
${!fp.css ? `
Computed Style -
getComputedStyle: ${note.blocked}
-
keys: ${note.blocked}
-
moz: ${note.blocked}
-
webkit: ${note.blocked}
-
apple: ${note.blocked}
-
-
+
keys (0): ${note.blocked}
prototype: ${note.blocked}
system styles: ${note.blocked}
@@ -1110,7 +1067,7 @@ const imports = { } = fp const { $hash, - getComputedStyle: computedStyle, + computedStyle, system } = data const colorsLen = system.colors.length @@ -1127,13 +1084,14 @@ const imports = { return `
Computed Style${hashMini($hash)} -
getComputedStyle:${hashMini(computedStyle.keys)}
-
keys: ${computedStyle.keys.length}
-
moz: ${''+computedStyle.moz}
-
webkit: ${''+computedStyle.webkit}
-
apple: ${''+computedStyle.apple}
-
-
+
keys (${!computedStyle ? '0' : count(computedStyle.keys)}): ${ + !computedStyle ? note.blocked : + modal( + 'creep-computed-style', + computedStyle.keys.join(', '), + hashMini(computedStyle) + ) + }
prototype: ${prototypeName}
system styles: ${ system && system.colors ? modal( diff --git a/index.html b/index.html index 64f054dc..ffdfe4c9 100644 --- a/index.html +++ b/index.html @@ -188,52 +188,16 @@
-