@theme-ui/mdx
Advanced tools
Comparing version 0.3.2-alpha.10 to 0.3.4
@@ -6,22 +6,4 @@ import { jsx } from '@theme-ui/core'; | ||
import styled from '@emotion/styled'; | ||
import { useMDXComponents, MDXProvider as MDXProvider$1 } from '@mdx-js/react'; | ||
import { MDXProvider, useMDXComponents } from '@mdx-js/react'; | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
var tags = ['p', 'b', 'i', 'a', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'pre', 'code', 'ol', 'ul', 'li', 'blockquote', 'hr', 'em', 'table', 'tr', 'th', 'td', 'em', 'strong', 'del', // mdx | ||
@@ -37,11 +19,5 @@ 'inlineCode', 'thematicBreak', // other | ||
var alias = function alias(n) { | ||
return aliases[n] || n; | ||
}; | ||
var alias = function (n) { return aliases[n] || n; }; | ||
var themed = function themed(key) { | ||
return function (props) { | ||
return css(get(props.theme, "styles." + key))(props.theme); | ||
}; | ||
}; | ||
var themed = function (key) { return function (props) { return css(get(props.theme, ("styles." + key)))(props.theme); }; }; | ||
var Styled = styled('div')(themed('div')); | ||
@@ -54,5 +30,4 @@ var components = {}; | ||
var createComponents = function createComponents(comps) { | ||
var next = _extends({}, components); | ||
var createComponents = function (comps) { | ||
var next = Object.assign({}, components); | ||
Object.keys(comps).forEach(function (key) { | ||
@@ -64,8 +39,10 @@ next[key] = styled(comps[key])(themed(key)); | ||
var MDXProvider = function MDXProvider(_ref) { | ||
var components = _ref.components, | ||
children = _ref.children; | ||
var MDXProvider$1 = function (ref) { | ||
var components = ref.components; | ||
var children = ref.children; | ||
var outer = useMDXComponents(); | ||
return jsx(MDXProvider$1, { | ||
components: createComponents(_extends({}, outer, components)), | ||
return jsx(MDXProvider, { | ||
components: createComponents(Object.assign({}, outer, | ||
components)), | ||
children: children | ||
@@ -75,3 +52,3 @@ }); | ||
export { MDXProvider, Styled, components, themed }; | ||
export { themed, Styled, components, MDXProvider$1 as MDXProvider }; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -10,20 +10,2 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
var tags = ['p', 'b', 'i', 'a', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'pre', 'code', 'ol', 'ul', 'li', 'blockquote', 'hr', 'em', 'table', 'tr', 'th', 'td', 'em', 'strong', 'del', // mdx | ||
@@ -39,11 +21,5 @@ 'inlineCode', 'thematicBreak', // other | ||
var alias = function alias(n) { | ||
return aliases[n] || n; | ||
}; | ||
var alias = function (n) { return aliases[n] || n; }; | ||
var themed = function themed(key) { | ||
return function (props) { | ||
return css.css(css.get(props.theme, "styles." + key))(props.theme); | ||
}; | ||
}; | ||
var themed = function (key) { return function (props) { return css.css(css.get(props.theme, ("styles." + key)))(props.theme); }; }; | ||
var Styled = styled('div')(themed('div')); | ||
@@ -56,5 +32,4 @@ var components = {}; | ||
var createComponents = function createComponents(comps) { | ||
var next = _extends({}, components); | ||
var createComponents = function (comps) { | ||
var next = Object.assign({}, components); | ||
Object.keys(comps).forEach(function (key) { | ||
@@ -66,8 +41,10 @@ next[key] = styled(comps[key])(themed(key)); | ||
var MDXProvider = function MDXProvider(_ref) { | ||
var components = _ref.components, | ||
children = _ref.children; | ||
var MDXProvider = function (ref) { | ||
var components = ref.components; | ||
var children = ref.children; | ||
var outer = react$1.useMDXComponents(); | ||
return core.jsx(react$1.MDXProvider, { | ||
components: createComponents(_extends({}, outer, components)), | ||
components: createComponents(Object.assign({}, outer, | ||
components)), | ||
children: children | ||
@@ -77,6 +54,6 @@ }); | ||
exports.MDXProvider = MDXProvider; | ||
exports.themed = themed; | ||
exports.Styled = Styled; | ||
exports.components = components; | ||
exports.themed = themed; | ||
exports.MDXProvider = MDXProvider; | ||
//# sourceMappingURL=index.js.map |
import { jsx } from '@theme-ui/core'; | ||
import { css, get } from '@theme-ui/css'; | ||
import 'react'; | ||
import '@emotion/core'; | ||
import styled from '@emotion/styled'; | ||
@@ -36,4 +34,6 @@ import { useMDXComponents, MDXProvider as MDXProvider$1 } from '@mdx-js/react'; | ||
const alias = n => aliases[n] || n; | ||
const isAlias = x => x in aliases; | ||
const alias = n => isAlias(n) ? aliases[n] : n; | ||
const themed = key => props => css(get(props.theme, `styles.${key}`))(props.theme); | ||
@@ -43,2 +43,3 @@ const Styled = styled('div')(themed('div')); | ||
tags.forEach(tag => { | ||
// fixme? | ||
components[tag] = styled(alias(tag))(themed(tag)); | ||
@@ -51,3 +52,4 @@ Styled[tag] = components[tag]; | ||
Object.keys(comps).forEach(key => { | ||
const componentKeys = Object.keys(comps); | ||
componentKeys.forEach(key => { | ||
next[key] = styled(comps[key])(themed(key)); | ||
@@ -54,0 +56,0 @@ }); |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@theme-ui/core'), require('@theme-ui/css'), require('react'), require('@emotion/core'), require('@emotion/styled'), require('@mdx-js/react')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@theme-ui/core', '@theme-ui/css', 'react', '@emotion/core', '@emotion/styled', '@mdx-js/react'], factory) : | ||
(global = global || self, factory(global.mdx = {}, global.core, global.css, global.react, global.core$1, global.styled, global.react$1)); | ||
}(this, (function (exports, core, css, react, core$1, styled, react$1) { | ||
react = react && Object.prototype.hasOwnProperty.call(react, 'default') ? react['default'] : react; | ||
styled = styled && Object.prototype.hasOwnProperty.call(styled, 'default') ? styled['default'] : styled; | ||
(factory((global.mdx = {}),global.core,global.css,global.react,global.core$1,global.styled,global.react$1)); | ||
}(this, (function (exports,core,css,react,core$1,styled,react$1) { | ||
react = react && react.hasOwnProperty('default') ? react['default'] : react; | ||
styled = styled && styled.hasOwnProperty('default') ? styled['default'] : styled; | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
var tags = ['p', 'b', 'i', 'a', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'pre', 'code', 'ol', 'ul', 'li', 'blockquote', 'hr', 'em', 'table', 'tr', 'th', 'td', 'em', 'strong', 'del', // mdx | ||
@@ -37,11 +19,5 @@ 'inlineCode', 'thematicBreak', // other | ||
var alias = function alias(n) { | ||
return aliases[n] || n; | ||
}; | ||
var alias = function (n) { return aliases[n] || n; }; | ||
var themed = function themed(key) { | ||
return function (props) { | ||
return css.css(css.get(props.theme, "styles." + key))(props.theme); | ||
}; | ||
}; | ||
var themed = function (key) { return function (props) { return css.css(css.get(props.theme, ("styles." + key)))(props.theme); }; }; | ||
var Styled = styled('div')(themed('div')); | ||
@@ -54,5 +30,4 @@ var components = {}; | ||
var createComponents = function createComponents(comps) { | ||
var next = _extends({}, components); | ||
var createComponents = function (comps) { | ||
var next = Object.assign({}, components); | ||
Object.keys(comps).forEach(function (key) { | ||
@@ -64,8 +39,10 @@ next[key] = styled(comps[key])(themed(key)); | ||
var MDXProvider = function MDXProvider(_ref) { | ||
var components = _ref.components, | ||
children = _ref.children; | ||
var MDXProvider = function (ref) { | ||
var components = ref.components; | ||
var children = ref.children; | ||
var outer = react$1.useMDXComponents(); | ||
return core.jsx(react$1.MDXProvider, { | ||
components: createComponents(_extends({}, outer, components)), | ||
components: createComponents(Object.assign({}, outer, | ||
components)), | ||
children: children | ||
@@ -75,8 +52,8 @@ }); | ||
exports.MDXProvider = MDXProvider; | ||
exports.themed = themed; | ||
exports.Styled = Styled; | ||
exports.components = components; | ||
exports.themed = themed; | ||
exports.MDXProvider = MDXProvider; | ||
}))); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@theme-ui/mdx", | ||
"version": "0.3.2-alpha.10+80ad9af6", | ||
"version": "0.3.4", | ||
"main": "dist/index.js", | ||
@@ -27,3 +27,3 @@ "module": "dist/index.esm.js", | ||
}, | ||
"gitHead": "80ad9af6483a680fb703d5ebd7b8564d06e7d6c7" | ||
"gitHead": "7840f829dea27b554c5cd1cb00470770fceca2eb" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
30406
0
386