Socket
Socket
Sign inDemoInstall

theme-ui

Package Overview
Dependencies
Maintainers
2
Versions
495
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

theme-ui - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

11

package.json
{
"name": "theme-ui",
"version": "0.0.14",
"version": "0.0.15",
"main": "dist/index.js",

@@ -19,3 +19,2 @@ "module": "dist/index.esm.js",

"@styled-system/css": "^2.0.2",
"css-what": "^2.1.3",
"emotion-theming": "^10.0.0",

@@ -26,3 +25,3 @@ "lodash.get": "^4.4.0",

"styled-system": "^4.0.0",
"typography": "^0.16.0"
"theme-ui-typography": "^0.0.15"
},

@@ -37,4 +36,3 @@ "devDependencies": {

"react-test-renderer": "^16.8.6",
"react-testing-library": "^7.0.0",
"typography-theme-wordpress-2016": "^0.16.19"
"react-testing-library": "^7.0.0"
},

@@ -55,3 +53,4 @@ "jest": {

}
}
},
"gitHead": "822695c47385342cfaa971126e45b038bae162db"
}

@@ -1,55 +0,2 @@

// based on https://github.com/jxnblk/typography-mdx
import Typography from 'typography'
import merge from 'lodash.merge'
import cssWhat from 'css-what'
const isMedia = str => /^@/.test(str)
const parseSelectors = styles => {
const parsed = {}
for (const key in styles) {
// todo: handle media queries
if (isMedia(key)) continue
const selectors = key.split(',') //cssWhat(key)
selectors.forEach(selector => {
const [ parent, ...children ] = cssWhat(selector)[0]
if (parent.type === 'universal') return
if (parent.type !== 'tag') {
// todo...
// console.log('!TAG', selector, parent.type)
return
}
if (children.length) {
const sub = selector.replace(parent.name, '&')
parsed[parent.name] = merge({}, parsed[parent.name], {
[sub]: styles[key]
})
} else {
parsed[parent.name] = merge({}, parsed[parent.name], styles[key])
}
})
}
for (const key in parsed) {
if (key === 'html' || key === 'body') {
// todo: what should this be named?
parsed.root = merge({}, parsed.root, parsed[key])
}
}
return parsed
}
export const toStyles = (theme) => {
const typography = new Typography({
...theme,
rhythmUnit: 'px',
includeNormalize: false,
})
const json = typography.toJSON()
const styles = parseSelectors(json)
typography.styles = styles
return typography
}
export default toStyles
// for backwards compatibility
module.exports = require('theme-ui-typography')
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc