@builder.io/mitosis 0.0.56-13 → 0.0.56-16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/__tests__/angular.test.js +2 -104
- package/dist/src/__tests__/builder.test.js +3 -3
- package/dist/src/__tests__/data/basic-child-component.raw.jsx +1 -2
- package/dist/src/__tests__/data/basic-context.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-context.raw.jsx +29 -0
- package/dist/src/__tests__/data/basic-custom-mitosis-package.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-custom-mitosis-package.raw.jsx +10 -0
- package/dist/src/__tests__/data/basic-for-show.raw.jsx +2 -3
- package/dist/src/__tests__/data/basic-for.raw.jsx +2 -3
- package/dist/src/__tests__/data/basic-forwardRef-metadata.raw.d.ts +5 -0
- package/dist/src/__tests__/data/basic-forwardRef-metadata.raw.jsx +17 -0
- package/dist/src/__tests__/data/basic-forwardRef.raw.d.ts +5 -0
- package/dist/src/__tests__/data/basic-forwardRef.raw.jsx +14 -0
- package/dist/src/__tests__/data/basic-onChange.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-onChange.raw.jsx +17 -0
- package/dist/src/__tests__/data/basic-onMount-update.raw.jsx +1 -1
- package/dist/src/__tests__/data/basic-onUpdate-return.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-onUpdate-return.raw.jsx +24 -0
- package/dist/src/__tests__/data/basic-outputs-meta.raw.jsx +1 -1
- package/dist/src/__tests__/data/basic-outputs.raw.jsx +1 -1
- package/dist/src/__tests__/data/basic-preserve-export-or-local-statement.raw.d.ts +6 -0
- package/dist/src/__tests__/data/basic-preserve-export-or-local-statement.raw.jsx +14 -0
- package/dist/src/__tests__/data/basic-props-destructure.raw.d.ts +6 -0
- package/dist/src/__tests__/data/basic-props-destructure.raw.jsx +14 -0
- package/dist/src/__tests__/data/basic-props.raw.d.ts +6 -0
- package/dist/src/__tests__/data/basic-props.raw.jsx +13 -0
- package/dist/src/__tests__/data/basic-ref-assignment.raw.d.ts +4 -0
- package/dist/src/__tests__/data/basic-ref-assignment.raw.jsx +15 -0
- package/dist/src/__tests__/data/basic-ref-usePrevious.raw.d.ts +5 -0
- package/dist/src/__tests__/data/basic-ref-usePrevious.raw.jsx +35 -0
- package/dist/src/__tests__/data/basic-ref.raw.d.ts +4 -0
- package/dist/src/__tests__/data/basic-ref.raw.jsx +36 -0
- package/dist/src/__tests__/data/basic.raw.d.ts +6 -1
- package/dist/src/__tests__/data/basic.raw.jsx +10 -3
- package/dist/src/__tests__/data/blocks/classname-jsx.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/columns.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/custom-code.raw.jsx +3 -7
- package/dist/src/__tests__/data/blocks/embed.raw.jsx +3 -7
- package/dist/src/__tests__/data/blocks/form.raw.jsx +3 -3
- package/dist/src/__tests__/data/blocks/image.raw.jsx +8 -9
- package/dist/src/__tests__/data/blocks/img-state.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/input.raw.jsx +1 -3
- package/dist/src/__tests__/data/blocks/multiple-onUpdateWithDeps.raw.jsx +7 -1
- package/dist/src/__tests__/data/blocks/onInit.raw.d.ts +8 -1
- package/dist/src/__tests__/data/blocks/onInit.raw.jsx +13 -3
- package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/section-state.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/select.raw.jsx +1 -3
- package/dist/src/__tests__/data/blocks/shadow-dom.raw.jsx +2 -4
- package/dist/src/__tests__/data/blocks/stamped-io.raw.jsx +2 -4
- package/dist/src/__tests__/data/blocks/text.raw.jsx +2 -5
- package/dist/src/__tests__/data/styles/class-and-className.raw.jsx +1 -3
- package/dist/src/__tests__/data/styles/className.raw.jsx +1 -3
- package/dist/src/__tests__/data/styles/classState.raw.d.ts +1 -0
- package/dist/src/__tests__/data/styles/classState.raw.jsx +12 -0
- package/dist/src/__tests__/data/types/component-props-interface.raw.d.ts +6 -0
- package/dist/src/__tests__/data/types/component-props-interface.raw.jsx +6 -0
- package/dist/src/__tests__/data/types/component-props-type.raw.d.ts +6 -0
- package/dist/src/__tests__/data/types/component-props-type.raw.jsx +6 -0
- package/dist/src/__tests__/data/types/preserve-typing.raw.d.ts +8 -0
- package/dist/src/__tests__/data/types/preserve-typing.raw.jsx +6 -0
- package/dist/src/__tests__/html.test.js +2 -145
- package/dist/src/__tests__/liquid.test.js +2 -109
- package/dist/src/__tests__/parse-jsx.test.js +22 -0
- package/dist/src/__tests__/qwik/convertMethodToFunction.test.d.ts +1 -0
- package/dist/src/__tests__/qwik/convertMethodToFunction.test.js +34 -0
- package/dist/src/__tests__/qwik/src-generator.test.d.ts +1 -0
- package/dist/src/__tests__/qwik/src-generator.test.js +65 -0
- package/dist/src/__tests__/qwik.test.js +44 -21
- package/dist/src/__tests__/react-native.test.js +2 -135
- package/dist/src/__tests__/react.test.js +5 -177
- package/dist/src/__tests__/shared.d.ts +3 -0
- package/dist/src/__tests__/shared.js +224 -0
- package/dist/src/__tests__/solid.test.js +2 -103
- package/dist/src/__tests__/stencil.test.js +3 -98
- package/dist/src/__tests__/styles.test.js +9 -1
- package/dist/src/__tests__/svelte.test.js +6 -0
- package/dist/src/__tests__/vue.test.js +2 -134
- package/dist/src/__tests__/webcomponent.test.js +6 -165
- package/dist/src/constants/hooks.d.ts +6 -0
- package/dist/src/constants/hooks.js +9 -0
- package/dist/src/generators/angular.d.ts +1 -1
- package/dist/src/generators/angular.js +66 -34
- package/dist/src/generators/builder.d.ts +1 -1
- package/dist/src/generators/builder.js +6 -12
- package/dist/src/generators/context/{react copy.d.ts → qwik.d.ts} +2 -2
- package/dist/src/generators/context/{react copy.js → qwik.js} +4 -5
- package/dist/src/generators/context/svelte.d.ts +1 -1
- package/dist/src/generators/helpers/context.js +1 -2
- package/dist/src/generators/html.d.ts +1 -1
- package/dist/src/generators/html.js +206 -120
- package/dist/src/generators/liquid.d.ts +1 -1
- package/dist/src/generators/liquid.js +6 -14
- package/dist/src/generators/mitosis.d.ts +1 -1
- package/dist/src/generators/mitosis.js +30 -29
- package/dist/src/generators/qwik/component-generator.d.ts +4 -0
- package/dist/src/generators/qwik/component-generator.js +271 -0
- package/dist/src/generators/qwik/component.js +4 -5
- package/dist/src/generators/qwik/convertMethodToFunction.d.ts +1 -0
- package/dist/src/generators/qwik/convertMethodToFunction.js +161 -0
- package/dist/src/generators/qwik/directives.js +20 -18
- package/dist/src/generators/qwik/index.d.ts +3 -1
- package/dist/src/generators/qwik/index.js +3 -1
- package/dist/src/generators/qwik/jsx.js +10 -6
- package/dist/src/generators/qwik/src-generator.d.ts +19 -7
- package/dist/src/generators/qwik/src-generator.js +149 -31
- package/dist/src/generators/qwik/styles.js +1 -2
- package/dist/src/generators/react-native.d.ts +2 -2
- package/dist/src/generators/react-native.js +3 -6
- package/dist/src/generators/react.d.ts +4 -2
- package/dist/src/generators/react.js +88 -68
- package/dist/src/generators/solid.d.ts +1 -1
- package/dist/src/generators/solid.js +9 -12
- package/dist/src/generators/stencil/generate.d.ts +1 -1
- package/dist/src/generators/stencil/generate.js +5 -11
- package/dist/src/generators/svelte.d.ts +1 -1
- package/dist/src/generators/svelte.js +19 -26
- package/dist/src/generators/swift-ui.d.ts +1 -1
- package/dist/src/generators/swift-ui.js +6 -12
- package/dist/src/generators/template.d.ts +1 -1
- package/dist/src/generators/template.js +6 -14
- package/dist/src/generators/vue.d.ts +12 -6
- package/dist/src/generators/vue.js +62 -31
- package/dist/src/helpers/babel-transform.js +3 -8
- package/dist/src/helpers/create-mitosis-component.d.ts +1 -1
- package/dist/src/helpers/create-mitosis-component.js +1 -1
- package/dist/src/helpers/fast-clone.js +1 -3
- package/dist/src/helpers/filter-empty-text-nodes.js +1 -2
- package/dist/src/helpers/get-bindings.d.ts +2 -0
- package/dist/src/helpers/get-bindings.js +18 -0
- package/dist/src/helpers/get-props-ref.d.ts +2 -0
- package/dist/src/helpers/get-props-ref.js +32 -0
- package/dist/src/helpers/getters-to-functions.d.ts +1 -1
- package/dist/src/helpers/getters-to-functions.js +1 -1
- package/dist/src/helpers/has-bindings-text.d.ts +2 -0
- package/dist/src/helpers/has-bindings-text.js +21 -0
- package/dist/src/helpers/has-stateful-dom.d.ts +2 -0
- package/dist/src/helpers/has-stateful-dom.js +21 -0
- package/dist/src/helpers/is-children.js +1 -2
- package/dist/src/helpers/is-component.js +1 -3
- package/dist/src/helpers/is-html-attribute.d.ts +1 -1
- package/dist/src/helpers/is-html-attribute.js +4 -19
- package/dist/src/helpers/map-refs.js +4 -1
- package/dist/src/helpers/parsers.js +1 -2
- package/dist/src/helpers/render-imports.d.ts +18 -2
- package/dist/src/helpers/render-imports.js +86 -45
- package/dist/src/helpers/render-imports.test.d.ts +1 -0
- package/dist/src/helpers/render-imports.test.js +19 -0
- package/dist/src/helpers/replace-idenifiers.js +2 -5
- package/dist/src/helpers/strip-state-and-props-refs.d.ts +2 -1
- package/dist/src/helpers/strip-state-and-props-refs.js +5 -8
- package/dist/src/helpers/styles/collect-css.d.ts +6 -0
- package/dist/src/helpers/styles/collect-css.js +87 -0
- package/dist/src/helpers/styles/collect-css.test.d.ts +1 -0
- package/dist/src/helpers/styles/collect-css.test.js +18 -0
- package/dist/src/helpers/styles/collect-styled-components.d.ts +2 -0
- package/dist/src/helpers/styles/collect-styled-components.js +61 -0
- package/dist/src/helpers/styles/helpers.d.ts +30 -0
- package/dist/src/helpers/styles/helpers.js +61 -0
- package/dist/src/helpers/typescript.d.ts +2 -0
- package/dist/src/helpers/typescript.js +2 -0
- package/dist/src/index.d.ts +7 -4
- package/dist/src/index.js +24 -8
- package/dist/src/jsx-types.d.ts +1 -0
- package/dist/src/modules/plugins.d.ts +1 -1
- package/dist/src/parsers/angular.js +10 -28
- package/dist/src/parsers/builder.d.ts +23 -23
- package/dist/src/parsers/builder.js +15 -33
- package/dist/src/parsers/jsx.d.ts +2 -1
- package/dist/src/parsers/jsx.js +214 -64
- package/dist/src/parsers/liquid.js +51 -149
- package/dist/src/plugins/compile-away-builder-components.js +4 -10
- package/dist/src/symbols/symbol-processor.js +4 -6
- package/dist/src/targets.d.ts +5 -3
- package/dist/src/targets.js +7 -1
- package/dist/src/types/config.d.ts +37 -17
- package/dist/src/types/mitosis-component.d.ts +30 -10
- package/dist/src/types/transpiler.d.ts +14 -0
- package/dist/src/types/transpiler.js +2 -0
- package/dist/test/qwik/Accordion/low.jsx +1 -0
- package/dist/test/qwik/For/low.jsx +1 -0
- package/dist/test/qwik/Image/med.js +2 -1
- package/dist/test/qwik/Image.slow/med.js +2 -1
- package/dist/test/qwik/bindings/low.cjs +3 -2
- package/dist/test/qwik/button/low.js +1 -0
- package/dist/test/qwik/component/bindings/low.jsx +2 -1
- package/dist/test/qwik/component/component/inputs/med.cjsx +2 -1
- package/dist/test/qwik/for-loop.bindings/high.cjs +0 -0
- package/dist/test/qwik/for-loop.bindings/low.cjs +47 -0
- package/dist/test/qwik/for-loop.bindings/med.cjs +5 -0
- package/dist/test/qwik/hello_world/stylesheet/low.jsx +1 -0
- package/dist/test/qwik/mount/high.cjs +0 -0
- package/dist/test/qwik/mount/low.cjs +44 -0
- package/dist/test/qwik/mount/med.cjs +3 -0
- package/dist/test/qwik/page-with-symbol/low.js +1 -0
- package/dist/test/qwik/show-hide/med.jsx +2 -1
- package/dist/test/qwik/svg/low.js +1 -0
- package/dist/test/qwik/todo/Todo.cjs/med.cjs +1 -0
- package/dist/test/qwik/todo/Todo.js/med.js +1 -0
- package/dist/test/qwik/todo/Todo.tsx/med.tsx +1 -0
- package/dist/test/qwik/todos/Todo.tsx/low.tsx +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -3
- package/README.md +0 -239
- package/dist/src/__tests__/data/blocks/content-slot.raw.d.ts +0 -6
- package/dist/src/__tests__/data/blocks/content-slot.raw.jsx +0 -13
- package/dist/src/__tests__/data/blocks/onUpdate.raw copy.d.ts +0 -1
- package/dist/src/__tests__/data/blocks/onUpdate.raw copy.jsx +0 -10
- package/dist/src/__tests__/data/blocks/slot.raw.d.ts +0 -5
- package/dist/src/__tests__/data/blocks/slot.raw.jsx +0 -6
- package/dist/src/__tests__/data/blocks/styles.raw.d.ts +0 -1
- package/dist/src/__tests__/data/blocks/styles.raw.jsx +0 -10
- package/dist/src/helpers/babel-transform copy.d.ts +0 -8
- package/dist/src/helpers/babel-transform copy.js +0 -138
- package/dist/src/helpers/collect-styles.d.ts +0 -29
- package/dist/src/helpers/collect-styles.js +0 -176
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"engines": {
|
|
26
26
|
"npm": "99999999.9.9"
|
|
27
27
|
},
|
|
28
|
-
"version": "0.0.56-
|
|
28
|
+
"version": "0.0.56-16",
|
|
29
29
|
"homepage": "https://github.com/BuilderIO/mitosis",
|
|
30
30
|
"main": "./dist/src/index.js",
|
|
31
31
|
"exports": {
|
|
@@ -77,9 +77,12 @@
|
|
|
77
77
|
"prettier-plugin-svelte": "^1.4.1",
|
|
78
78
|
"svelte": "^3.30.0",
|
|
79
79
|
"traverse": "^0.6.6",
|
|
80
|
+
"typescript": "^4.7.3",
|
|
81
|
+
"vue": "^2",
|
|
80
82
|
"vue-template-compiler": "^2.6.12"
|
|
81
83
|
},
|
|
82
84
|
"devDependencies": {
|
|
85
|
+
"@babel/preset-env": "^7.6.0",
|
|
83
86
|
"@builder.io/sdk": "^1.1.26",
|
|
84
87
|
"@rollup/plugin-node-resolve": "^11.2.1",
|
|
85
88
|
"@rollup/plugin-virtual": "^2.1.0",
|
|
@@ -103,8 +106,8 @@
|
|
|
103
106
|
"rollup": "^2.70.1",
|
|
104
107
|
"ts-jest": "^26.4.4",
|
|
105
108
|
"ts-node": "^9.1.1",
|
|
106
|
-
"typescript": "4
|
|
109
|
+
"typescript": "^4",
|
|
107
110
|
"universalify": "^2.0.0"
|
|
108
111
|
},
|
|
109
|
-
"stableVersion": "0.0.56-
|
|
112
|
+
"stableVersion": "0.0.56-15"
|
|
110
113
|
}
|
package/README.md
DELETED
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
<p align="center"><img width="400" src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fbd8709e610d44cde8f623ebcc960e7dd"></p>
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
Write components once, run everywhere. Compiles to Vue, React, Solid, Angular, Svelte, and Liquid.
|
|
5
|
-
</p>
|
|
6
|
-
|
|
7
|
-
<p align="center">
|
|
8
|
-
<a href="https://github.com/prettier/prettier"><img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg" /></a>
|
|
9
|
-
<a href="https://github.com/BuilderIO/mitosis/pulls"><img alt="PRs Welcome" src="https://img.shields.io/badghttps://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fbd8709e610d44cde8f623ebcc960e7dde/PRs-welcome-brightgreen.svg" /></a>
|
|
10
|
-
<a href="https://github.com/BuilderIO/mitosis"><img alt="License" src="https://img.shields.io/github/license/BuilderIO/mitosis" /></a>
|
|
11
|
-
<a href="https://www.npmjs.com/package/@builder.io/mitosis"><img alt="Types" src="https://img.shields.io/npm/types/@builder.io/mitosis" /></a>
|
|
12
|
-
<a href="https://www.npmjs.com/package/@builder.io/mitosis" rel="nofollow"><img src="https://img.shields.io/npm/v/@builder.io/mitosis.svg?sanitize=true"></a>
|
|
13
|
-
</p>
|
|
14
|
-
|
|
15
|
-
<br />
|
|
16
|
-
<h3 align="center">Try it out</h2>
|
|
17
|
-
|
|
18
|
-
<table>
|
|
19
|
-
<tbody>
|
|
20
|
-
<tr>
|
|
21
|
-
<td>
|
|
22
|
-
<p> </p> <!-- spacer -->
|
|
23
|
-
<p align="center">
|
|
24
|
-
<img height="50" src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffb77e93c28e044178e4694cc939bf4cf" />
|
|
25
|
-
</p>
|
|
26
|
-
<p align="center">
|
|
27
|
-
Use our <a href="https://github.com/builderio/figma-html"><b>Figma plugin</b></a> to turn designs into code!
|
|
28
|
-
</p>
|
|
29
|
-
</td>
|
|
30
|
-
<td>
|
|
31
|
-
<p> </p> <!-- spacer -->
|
|
32
|
-
<p align="center">
|
|
33
|
-
<img height="50" src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F467c9b604d4e486abfc39d27a2fddc12" />
|
|
34
|
-
</p>
|
|
35
|
-
<p align="center">
|
|
36
|
-
Try our <a href="https://jsx-lite.builder.io/"><b>interactive fiddle</b></a>
|
|
37
|
-
</p>
|
|
38
|
-
</td>
|
|
39
|
-
</tr>
|
|
40
|
-
<tr>
|
|
41
|
-
<td>
|
|
42
|
-
<a href="https://github.com/builderio/figma-html"><img width="400" alt="Figma plugin" src="https://i.imgur.com/BoKsLFs.gif" /></a>
|
|
43
|
-
</td>
|
|
44
|
-
<td>
|
|
45
|
-
<a href="https://jsx-lite.builder.io/"><img width="400" alt="Fiddle" src="https://imgur.com/H1WTtGe.gif" /></a>
|
|
46
|
-
</td>
|
|
47
|
-
</tr>
|
|
48
|
-
<tr>
|
|
49
|
-
<td>
|
|
50
|
-
<p> </p> <!-- spacer -->
|
|
51
|
-
<p align="center">
|
|
52
|
-
<img height="50" src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ff83e94a9c504427cbc8a557f682efec3" />
|
|
53
|
-
</p>
|
|
54
|
-
<p align="center">
|
|
55
|
-
Try our <a href="https://github.com/BuilderIO/vscode"><b>VS Code extension</b></a> for in-IDE visual coding
|
|
56
|
-
</p>
|
|
57
|
-
</td>
|
|
58
|
-
<td>
|
|
59
|
-
<p> </p> <!-- spacer -->
|
|
60
|
-
<p align="center">
|
|
61
|
-
<img height="50" src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F0f577e84eb4e4aa4a69d602dd376aa11" />
|
|
62
|
-
</p>
|
|
63
|
-
<p align="center">
|
|
64
|
-
Try our <a href="https://apps.shopify.com/builder-2"><b>Shopify app</b></a> for visual Shopify store building
|
|
65
|
-
</td>
|
|
66
|
-
</tr>
|
|
67
|
-
<tr>
|
|
68
|
-
<td>
|
|
69
|
-
<a href="https://github.com/BuilderIO/vscode"><img width="400" alt="Vscode plugin" src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F1d59909e2a214c79ad2b1e8ad3fb8245" /></a>
|
|
70
|
-
</td>
|
|
71
|
-
<td>
|
|
72
|
-
<a href="https://apps.shopify.com/builder-2"><img width="400" alt="Vscode plugin" src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F97c87a29d88e463b9c1ad22b0329b2f7" /></a>
|
|
73
|
-
</td>
|
|
74
|
-
</tr>
|
|
75
|
-
<tr>
|
|
76
|
-
<td>
|
|
77
|
-
<p> </p> <!-- spacer -->
|
|
78
|
-
<p align="center">
|
|
79
|
-
<img height="50" src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F084b1ebc3de4422185f9d36a409f3a24" />
|
|
80
|
-
</p>
|
|
81
|
-
<p align="center">
|
|
82
|
-
Try our <a href="https://github.com/builderio/builder"><b>headless CMS</b></a> for no-code APIs for all sites and apps
|
|
83
|
-
</p>
|
|
84
|
-
</td>
|
|
85
|
-
<td>
|
|
86
|
-
<p> </p> <!-- spacer -->
|
|
87
|
-
<p align="center">
|
|
88
|
-
<img height="50" src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F2025f53be0ab472ca8fbb87381bfbc00" />
|
|
89
|
-
</p>
|
|
90
|
-
<p align="center">
|
|
91
|
-
View our upcoming ecommerce integrations
|
|
92
|
-
</p>
|
|
93
|
-
</td>
|
|
94
|
-
</tr>
|
|
95
|
-
<tr>
|
|
96
|
-
<td>
|
|
97
|
-
<a href="https://github.com/builderio/builder"><img width="400" alt="Vscode plugin" src="https://cdn.builder.io/api/v1/image/assets%2F444142b2cae54a19aeb8b5ba245feffe%2F8c2699f47fea48b296b43dbb422336e8" /></a>
|
|
98
|
-
</td>
|
|
99
|
-
<td>
|
|
100
|
-
<a href="https://headlessapp.store"><img width="400" alt="Vscode plugin" src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fd416b330ae7543089f70af8b930d8d85" /></a>
|
|
101
|
-
</td>
|
|
102
|
-
</tr>
|
|
103
|
-
</tbody>
|
|
104
|
-
</table>
|
|
105
|
-
|
|
106
|
-
## Why
|
|
107
|
-
|
|
108
|
-
### Component libraries
|
|
109
|
-
|
|
110
|
-
Managing support for libraries that provide UI components across frameworks is a _pain_, esp when webcomponents are not an option (e.g. for server side rendering, best performance, etc). With Mitosis you can write once, and run everywhere with full compatibilty
|
|
111
|
-
|
|
112
|
-
### Modern workflows for all platforms
|
|
113
|
-
|
|
114
|
-
JSX lite allows you to incrementally adopt modern and familiar workflows for many different platforms, for for Shopify instance you can server side render to liquid and hydrate with React
|
|
115
|
-
|
|
116
|
-
### JS framework fatigue
|
|
117
|
-
|
|
118
|
-
If you have ever had to migrate a huge codebase from one framework to another, it's an absolute nightmare. Writing at a higher level of abstraction allows you to move from one to another with ease
|
|
119
|
-
|
|
120
|
-
### Design to code
|
|
121
|
-
|
|
122
|
-
With JSX lite, you can convert designs from [Figma](https://github.com/BuilderIO/html-to-figma) or Sketch and convert it to clean code for the framework of your choice. You can even use [Builder.io](https://github.com/builderio/builder) to visually drag/drop to build UIs and edit the code _side by side_
|
|
123
|
-
|
|
124
|
-
<p align="center">
|
|
125
|
-
<img src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F28066781f8584569b131fb4bffd893eb" />
|
|
126
|
-
</p>
|
|
127
|
-
|
|
128
|
-
## How does it work
|
|
129
|
-
|
|
130
|
-
Mitosis uses a static subset of JSX, inspired by [Solid](https://github.com/ryansolid/solid/blob/master/documentation/rendering.md). This means we can parse it to a simple JSON structure that it is easy easy to build stringifers off of for various frameworks and implementations
|
|
131
|
-
|
|
132
|
-
```tsx
|
|
133
|
-
export function MyComponent() {
|
|
134
|
-
const state = useState({
|
|
135
|
-
name: 'Steve',
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
return (
|
|
139
|
-
<div>
|
|
140
|
-
<input
|
|
141
|
-
value={state.name}
|
|
142
|
-
onChange={(e) => (state.name = e.target.value)}
|
|
143
|
-
/>
|
|
144
|
-
</div>
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
becomes:
|
|
150
|
-
|
|
151
|
-
```json
|
|
152
|
-
{
|
|
153
|
-
"@type": "@builder.io/mitosis/component",
|
|
154
|
-
"state": {
|
|
155
|
-
"name": "Steve"
|
|
156
|
-
},
|
|
157
|
-
"nodes": [
|
|
158
|
-
{
|
|
159
|
-
"@type": "@builder.io/mitosis/node",
|
|
160
|
-
"name": "div",
|
|
161
|
-
"children": [
|
|
162
|
-
{
|
|
163
|
-
"@type": "@builder.io/mitosis/node",
|
|
164
|
-
"bindings": {
|
|
165
|
-
"value": "state.name",
|
|
166
|
-
"onChange": "state.name = event.target.value"
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
]
|
|
170
|
-
}
|
|
171
|
-
]
|
|
172
|
-
}
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
Which can be reserialized into many languges and framworks. For instance, to support angular, we just make a serializer that loops over the json and produces:
|
|
176
|
-
|
|
177
|
-
```ts
|
|
178
|
-
@Component({
|
|
179
|
-
template: `
|
|
180
|
-
<div>
|
|
181
|
-
<input [value]="name" (change)="name = $event.target.value" />
|
|
182
|
-
</div>
|
|
183
|
-
`,
|
|
184
|
-
})
|
|
185
|
-
class MyComponent {
|
|
186
|
-
name = 'Steve';
|
|
187
|
-
}
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
Adding framework support is surprisingly easy with our plugins (docs coming soon!)
|
|
191
|
-
|
|
192
|
-
## No-code tooling
|
|
193
|
-
|
|
194
|
-
Mitosis's static JSON format also enables no-code tooling for visual code editing and importing, for instance with [Builder.io](https://github.com/builderio/builder) or [Figma](https://github.com/BuilderIO/html-to-figma)
|
|
195
|
-
|
|
196
|
-
<img src="https://imgur.com/3TjfY2H.gif" >
|
|
197
|
-
|
|
198
|
-
<img src="https://i.imgur.com/vsAKt7f.gif" >
|
|
199
|
-
|
|
200
|
-
## Formatting options
|
|
201
|
-
|
|
202
|
-
Mitosis supports settings for generating code to match your preferred formatting, libraries, etc. These output options will be customizable and extensible with plugins soon too
|
|
203
|
-
|
|
204
|
-
<img src="https://imgur.com/hWXfNF3.gif "/>
|
|
205
|
-
|
|
206
|
-
## Who uses it
|
|
207
|
-
|
|
208
|
-
- [Builder.io](https://github.com/builderio/builder)
|
|
209
|
-
- [Snap](https://github.com/builderio/snap)
|
|
210
|
-
- [HTML <> Figma](https://github.com/builderio/html-to-figma)
|
|
211
|
-
- [Build.](https://github.com/builderio/build.) (coming soon)
|
|
212
|
-
|
|
213
|
-
## Status
|
|
214
|
-
|
|
215
|
-
| Framework | Status |
|
|
216
|
-
| ------------- | ------------ |
|
|
217
|
-
| React | Alpha |
|
|
218
|
-
| Vue | Alpha |
|
|
219
|
-
| Liquid | Alpha |
|
|
220
|
-
| Builder.io | Alpha |
|
|
221
|
-
| Solid | Alpha |
|
|
222
|
-
| Figma | Alpha |
|
|
223
|
-
| Angular | Alpha |
|
|
224
|
-
| Svelte | Alpha |
|
|
225
|
-
| HTML/CSS/JS | Alpha |
|
|
226
|
-
| Webcomponents | Alpha |
|
|
227
|
-
| React Native | Alpha |
|
|
228
|
-
| SwiftUI | Experimental |
|
|
229
|
-
|
|
230
|
-
## Coming soon
|
|
231
|
-
|
|
232
|
-
- Stable (v1) release
|
|
233
|
-
- Plugin API docs for custom syntaxes and extensions
|
|
234
|
-
- VS code plugin
|
|
235
|
-
|
|
236
|
-
<br />
|
|
237
|
-
<p align="center">
|
|
238
|
-
Made with ❤️ by <a target="_blank" href="https://www.builder.io/">Builder.io</a>
|
|
239
|
-
</p>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
-
function ContentSlotCode(props) {
|
|
5
|
-
return (<div>
|
|
6
|
-
<mitosis_1.Slot name={props.slotTesting}/>
|
|
7
|
-
<div>
|
|
8
|
-
<hr />
|
|
9
|
-
</div>
|
|
10
|
-
<div>{props.children}</div>
|
|
11
|
-
</div>);
|
|
12
|
-
}
|
|
13
|
-
exports.default = ContentSlotCode;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function OnUpdate(): JSX.Element;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
-
function OnUpdate() {
|
|
5
|
-
(0, mitosis_1.onUpdate)(function () {
|
|
6
|
-
console.log('Runs on every update/rerender');
|
|
7
|
-
});
|
|
8
|
-
return <div />;
|
|
9
|
-
}
|
|
10
|
-
exports.default = OnUpdate;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function OnUpdate(): JSX.Element;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var mitosis_1 = require("@builder.io/mitosis");
|
|
4
|
-
function OnUpdate() {
|
|
5
|
-
(0, mitosis_1.onUpdate)(function () {
|
|
6
|
-
console.log('Runs on every update/rerender');
|
|
7
|
-
});
|
|
8
|
-
return <div />;
|
|
9
|
-
}
|
|
10
|
-
exports.default = OnUpdate;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as babel from '@babel/core';
|
|
2
|
-
declare type Visitor<ContextType = any> = {
|
|
3
|
-
[key: string]: (path: any, context: ContextType) => void;
|
|
4
|
-
};
|
|
5
|
-
export declare const babelTransform: <VisitorContextType = any>(code: string, visitor?: Visitor<VisitorContextType> | undefined) => babel.BabelFileResult | null;
|
|
6
|
-
export declare const babelTransformCode: <VisitorContextType = any>(code: string, visitor?: Visitor<VisitorContextType> | undefined) => string;
|
|
7
|
-
export declare const babelTransformExpression: <VisitorContextType = any>(code: string, visitor: Visitor<VisitorContextType>, type?: 'expression' | 'unknown' | 'block' | 'functionBody') => string;
|
|
8
|
-
export {};
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
26
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
27
|
-
if (ar || !(i in from)) {
|
|
28
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
29
|
-
ar[i] = from[i];
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.babelTransformExpression = exports.babelTransformCode = exports.babelTransform = void 0;
|
|
36
|
-
var babel = __importStar(require("@babel/core"));
|
|
37
|
-
var lodash_1 = require("lodash");
|
|
38
|
-
var jsxPlugin = require('@babel/plugin-syntax-jsx');
|
|
39
|
-
var tsPreset = require('@babel/preset-typescript');
|
|
40
|
-
var decorators = require('@babel/plugin-syntax-decorators');
|
|
41
|
-
var babelTransform = function (code, visitor) {
|
|
42
|
-
return babel.transform(code, {
|
|
43
|
-
sourceFileName: 'file.tsx',
|
|
44
|
-
configFile: false,
|
|
45
|
-
babelrc: false,
|
|
46
|
-
presets: [[tsPreset, { isTSX: true, allExtensions: true }]],
|
|
47
|
-
plugins: __spreadArray([
|
|
48
|
-
[decorators, { legacy: true }],
|
|
49
|
-
jsxPlugin
|
|
50
|
-
], (visitor ? [function () { return ({ visitor: visitor }); }] : []), true),
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
exports.babelTransform = babelTransform;
|
|
54
|
-
var babelTransformCode = function (code, visitor) {
|
|
55
|
-
var _a;
|
|
56
|
-
return ((_a = (0, exports.babelTransform)(code, visitor)) === null || _a === void 0 ? void 0 : _a.code) || '';
|
|
57
|
-
};
|
|
58
|
-
exports.babelTransformCode = babelTransformCode;
|
|
59
|
-
var babelTransformExpression = function (code, visitor, type) {
|
|
60
|
-
var _a;
|
|
61
|
-
if (type === void 0) { type = 'unknown'; }
|
|
62
|
-
if (!code) {
|
|
63
|
-
return '';
|
|
64
|
-
}
|
|
65
|
-
// match for object literal like { foo: ... }
|
|
66
|
-
if (type === 'unknown' && code.trim().match(/^\s*{\s*[a-z0-9]+:/i)) {
|
|
67
|
-
type = 'expression';
|
|
68
|
-
}
|
|
69
|
-
// For Builder content
|
|
70
|
-
if (type === 'unknown' &&
|
|
71
|
-
(code.includes('return _virtual_index') ||
|
|
72
|
-
code.trim().startsWith('return ')) &&
|
|
73
|
-
!code.trim().startsWith('function')) {
|
|
74
|
-
type = 'functionBody';
|
|
75
|
-
}
|
|
76
|
-
var useCode = code;
|
|
77
|
-
if (type === 'functionBody') {
|
|
78
|
-
useCode = "function(){".concat(useCode, "}");
|
|
79
|
-
}
|
|
80
|
-
var result = type === 'expression'
|
|
81
|
-
? null
|
|
82
|
-
: (0, lodash_1.attempt)(function () {
|
|
83
|
-
var _a;
|
|
84
|
-
var result = ((_a = (0, exports.babelTransform)(useCode, visitor)) === null || _a === void 0 ? void 0 : _a.code) || '';
|
|
85
|
-
if (type === 'functionBody') {
|
|
86
|
-
return result.replace(/^function\(\)\{/, '').replace(/\};$/, '');
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
// Babel addes trailing semicolons, but for expressions we need those gone
|
|
90
|
-
// TODO: maybe detect if the original code ended with one, and keep it if so, for the case
|
|
91
|
-
// of appending several fragements
|
|
92
|
-
return result.replace(/;$/, '');
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
if ((0, lodash_1.isError)(result) || type === 'expression') {
|
|
96
|
-
try {
|
|
97
|
-
// If it can't, e.g. this is an expression or code fragment, modify the code below and try again
|
|
98
|
-
// Detect method fragments. These get passed sometimes and otherwise
|
|
99
|
-
// generate compile errors. They are of the form `foo() { ... }`
|
|
100
|
-
var isMethod = Boolean(!code.startsWith('function') &&
|
|
101
|
-
code.match(/^[a-z0-9]+\s*\([^\)]*\)\s*[\{:]/i));
|
|
102
|
-
if (isMethod) {
|
|
103
|
-
useCode = "function ".concat(useCode);
|
|
104
|
-
}
|
|
105
|
-
// Parse the code as an expression (instead of the default, a block) by giving it a fake variable assignment
|
|
106
|
-
// e.g. if the code parsed is { ... } babel will treat that as a block by deafult, unless processed as an expression
|
|
107
|
-
// that is an object
|
|
108
|
-
useCode = "let _ = ".concat(useCode);
|
|
109
|
-
result = (((_a = (0, exports.babelTransform)(useCode, visitor)) === null || _a === void 0 ? void 0 : _a.code) || '')
|
|
110
|
-
// Babel addes trailing semicolons, but for expressions we need those gone
|
|
111
|
-
.replace(/;$/, '')
|
|
112
|
-
// Remove our fake variable assignment
|
|
113
|
-
.replace(/let _ =\s/, '');
|
|
114
|
-
if (isMethod) {
|
|
115
|
-
result = result.replace('function', '');
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
catch (err) {
|
|
119
|
-
console.error('Error parsing code:\n', code, '\n', result);
|
|
120
|
-
try {
|
|
121
|
-
return (0, exports.babelTransformExpression)(code, visitor, 'functionBody');
|
|
122
|
-
}
|
|
123
|
-
catch (err) {
|
|
124
|
-
throw err;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
if (type === 'functionBody') {
|
|
129
|
-
return result.replace(/^function\s*\(\)\s*\{/, '').replace(/\};?$/, '');
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
// Babel addes trailing semicolons, but for expressions we need those gone
|
|
133
|
-
// TODO: maybe detect if the original code ended with one, and keep it if so, for the case
|
|
134
|
-
// of appending several fragements
|
|
135
|
-
return result.replace(/;$/, '');
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
exports.babelTransformExpression = babelTransformExpression;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as CSS from 'csstype';
|
|
2
|
-
import { MitosisComponent } from '../types/mitosis-component';
|
|
3
|
-
export declare const hasStyles: (component: MitosisComponent) => boolean;
|
|
4
|
-
/**
|
|
5
|
-
* e.g.:
|
|
6
|
-
* {
|
|
7
|
-
* display: 'none',
|
|
8
|
-
* '@media (max-width: 500px)': {
|
|
9
|
-
* '& .sub-class': {
|
|
10
|
-
* display: 'block'
|
|
11
|
-
* }
|
|
12
|
-
* }
|
|
13
|
-
* }
|
|
14
|
-
*/
|
|
15
|
-
declare type StyleMap = {
|
|
16
|
-
[className: string]: CSS.Properties | StyleMap;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* { 'my-class': { display: 'block', '&.foo': { display: 'none' } }}
|
|
20
|
-
*/
|
|
21
|
-
export declare type ClassStyleMap = {
|
|
22
|
-
[key: string]: StyleMap;
|
|
23
|
-
};
|
|
24
|
-
declare type CollectStyleOptions = {
|
|
25
|
-
prefix?: string;
|
|
26
|
-
};
|
|
27
|
-
export declare const collectStyledComponents: (json: MitosisComponent) => string;
|
|
28
|
-
export declare const collectCss: (json: MitosisComponent, options?: CollectStyleOptions) => string;
|
|
29
|
-
export {};
|