@builder.io/mitosis
Advanced tools
Comparing version
@@ -152,2 +152,3 @@ "use strict"; | ||
stylesType: 'styled-jsx', | ||
styleTagsPlacement: 'bottom', | ||
type: 'dom', | ||
@@ -240,2 +241,13 @@ plugins: [ | ||
}; | ||
const generateStyleTags = (placement, json, options, componentHasStyles, css, shouldInjectCustomStyles) => { | ||
if (placement !== options.styleTagsPlacement) | ||
return ''; | ||
return (0, dedent_1.dedent) ` | ||
${componentHasStyles && options.stylesType === 'styled-jsx' | ||
? `<style jsx>{\`${css}\`}</style>` | ||
: ''} | ||
${componentHasStyles && options.stylesType === 'style-tag' ? `<style>{\`${css}\`}</style>` : ''} | ||
${shouldInjectCustomStyles ? `<style>{\`${json.style}\`}</style>` : ''} | ||
`; | ||
}; | ||
const _componentToReact = (json, options, isSubComponent = false) => { | ||
@@ -343,10 +355,5 @@ var _a, _b, _c, _d, _e, _f; | ||
${wrap ? (0, helpers_2.openFrag)(options) : ''} | ||
${generateStyleTags('top', json, options, componentHasStyles, css, shouldInjectCustomStyles)} | ||
${json.children.map((item) => (0, blocks_1.blockToReact)(item, options, json, wrap, [])).join('\n')} | ||
${componentHasStyles && options.stylesType === 'styled-jsx' | ||
? `<style jsx>{\`${css}\`}</style>` | ||
: ''} | ||
${componentHasStyles && options.stylesType === 'style-tag' | ||
? `<style>{\`${css}\`}</style>` | ||
: ''} | ||
${shouldInjectCustomStyles ? `<style>{\`${json.style}\`}</style>` : ''} | ||
${generateStyleTags('bottom', json, options, componentHasStyles, css, shouldInjectCustomStyles)} | ||
${wrap ? (0, helpers_2.closeFrag)(options) : ''} | ||
@@ -353,0 +360,0 @@ ); |
import { BaseTranspilerOptions } from '../../types/transpiler'; | ||
export interface ToReactOptions extends BaseTranspilerOptions { | ||
stylesType: 'emotion' | 'styled-components' | 'styled-jsx' | 'react-native' | 'style-tag' | 'twrnc' | 'native-wind'; | ||
styleTagsPlacement?: 'top' | 'bottom'; | ||
stateType: 'useState' | 'mobx' | 'valtio' | 'solid' | 'builder' | 'variables'; | ||
@@ -5,0 +6,0 @@ format?: 'lite' | 'safe'; |
@@ -25,3 +25,3 @@ { | ||
}, | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"homepage": "https://github.com/BuilderIO/mitosis", | ||
@@ -28,0 +28,0 @@ "main": "./dist/src/index.js", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1195481
0.04%28272
0.03%3
-25%11
-8.33%