@builder.io/mitosis 0.0.56-2 → 0.0.56-22

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.
Files changed (298) hide show
  1. package/dist/src/__tests__/angular.test.js +2 -13
  2. package/dist/src/__tests__/builder.test.js +3 -3
  3. package/dist/src/__tests__/data/basic-child-component.raw.d.ts +1 -0
  4. package/dist/src/__tests__/data/basic-child-component.raw.jsx +21 -0
  5. package/dist/src/__tests__/data/basic-context.raw.d.ts +1 -0
  6. package/dist/src/__tests__/data/basic-context.raw.jsx +29 -0
  7. package/dist/src/__tests__/data/basic-custom-mitosis-package.raw.d.ts +1 -0
  8. package/dist/src/__tests__/data/basic-custom-mitosis-package.raw.jsx +10 -0
  9. package/dist/src/__tests__/data/basic-for-show.raw.d.ts +1 -0
  10. package/dist/src/__tests__/data/basic-for-show.raw.jsx +20 -0
  11. package/dist/src/__tests__/data/basic-for.raw.d.ts +1 -0
  12. package/dist/src/__tests__/data/basic-for.raw.jsx +23 -0
  13. package/dist/src/__tests__/data/basic-forwardRef-metadata.raw.d.ts +5 -0
  14. package/dist/src/__tests__/data/basic-forwardRef-metadata.raw.jsx +17 -0
  15. package/dist/src/__tests__/data/basic-forwardRef.raw.d.ts +5 -0
  16. package/dist/src/__tests__/data/basic-forwardRef.raw.jsx +14 -0
  17. package/dist/src/__tests__/data/basic-onChange.raw.d.ts +1 -0
  18. package/dist/src/__tests__/data/basic-onChange.raw.jsx +17 -0
  19. package/dist/src/__tests__/data/basic-onMount-update.raw.d.ts +5 -0
  20. package/dist/src/__tests__/data/basic-onMount-update.raw.jsx +17 -0
  21. package/dist/src/__tests__/data/basic-onUpdate-return.raw.d.ts +1 -0
  22. package/dist/src/__tests__/data/basic-onUpdate-return.raw.jsx +24 -0
  23. package/dist/src/__tests__/data/basic-outputs-meta.raw.d.ts +1 -0
  24. package/dist/src/__tests__/data/basic-outputs-meta.raw.jsx +17 -0
  25. package/dist/src/__tests__/data/basic-outputs.raw.d.ts +1 -0
  26. package/dist/src/__tests__/data/basic-outputs.raw.jsx +14 -0
  27. package/dist/src/__tests__/data/basic-preserve-export-or-local-statement.raw.d.ts +6 -0
  28. package/dist/src/__tests__/data/basic-preserve-export-or-local-statement.raw.jsx +14 -0
  29. package/dist/src/__tests__/data/basic-props-destructure.raw.d.ts +6 -0
  30. package/dist/src/__tests__/data/basic-props-destructure.raw.jsx +14 -0
  31. package/dist/src/__tests__/data/basic-props.raw.d.ts +6 -0
  32. package/dist/src/__tests__/data/basic-props.raw.jsx +13 -0
  33. package/dist/src/__tests__/data/basic-ref-assignment.raw.d.ts +4 -0
  34. package/dist/src/__tests__/data/basic-ref-assignment.raw.jsx +15 -0
  35. package/dist/src/__tests__/data/basic-ref-usePrevious.raw.d.ts +5 -0
  36. package/dist/src/__tests__/data/basic-ref-usePrevious.raw.jsx +35 -0
  37. package/dist/src/__tests__/data/basic-ref.raw.d.ts +4 -0
  38. package/dist/src/__tests__/data/basic-ref.raw.jsx +36 -0
  39. package/dist/src/__tests__/data/basic.raw.d.ts +6 -1
  40. package/dist/src/__tests__/data/basic.raw.jsx +13 -4
  41. package/dist/src/__tests__/data/blocks/button-with-metadata.raw.d.ts +1 -1
  42. package/dist/src/__tests__/data/blocks/button.raw.d.ts +1 -1
  43. package/dist/src/__tests__/data/blocks/classname-jsx.raw.d.ts +7 -0
  44. package/dist/src/__tests__/data/blocks/classname-jsx.raw.jsx +15 -0
  45. package/dist/src/__tests__/data/blocks/columns.raw.d.ts +1 -1
  46. package/dist/src/__tests__/data/blocks/columns.raw.jsx +1 -1
  47. package/dist/src/__tests__/data/blocks/content-slot-html.raw.d.ts +7 -0
  48. package/dist/src/__tests__/data/blocks/content-slot-html.raw.jsx +15 -0
  49. package/dist/src/__tests__/data/blocks/content-slot-jsx.raw.d.ts +6 -0
  50. package/dist/src/__tests__/data/blocks/content-slot-jsx.raw.jsx +12 -0
  51. package/dist/src/__tests__/data/blocks/custom-code.raw.d.ts +1 -1
  52. package/dist/src/__tests__/data/blocks/custom-code.raw.jsx +3 -7
  53. package/dist/src/__tests__/data/blocks/embed.raw.d.ts +1 -1
  54. package/dist/src/__tests__/data/blocks/embed.raw.jsx +3 -7
  55. package/dist/src/__tests__/data/blocks/form.raw.d.ts +1 -1
  56. package/dist/src/__tests__/data/blocks/form.raw.jsx +3 -3
  57. package/dist/src/__tests__/data/blocks/image.raw.d.ts +1 -1
  58. package/dist/src/__tests__/data/blocks/image.raw.jsx +8 -9
  59. package/dist/src/__tests__/data/blocks/img-state.raw.d.ts +1 -0
  60. package/dist/src/__tests__/data/blocks/img-state.raw.jsx +17 -0
  61. package/dist/src/__tests__/data/blocks/img.raw.d.ts +1 -1
  62. package/dist/src/__tests__/data/blocks/input.raw.d.ts +1 -1
  63. package/dist/src/__tests__/data/blocks/input.raw.jsx +1 -3
  64. package/dist/src/__tests__/data/blocks/multiple-onUpdate.raw.d.ts +1 -1
  65. package/dist/src/__tests__/data/blocks/multiple-onUpdateWithDeps.raw.d.ts +1 -1
  66. package/dist/src/__tests__/data/blocks/multiple-onUpdateWithDeps.raw.jsx +7 -1
  67. package/dist/src/__tests__/data/blocks/onInit-onMount.raw.d.ts +1 -0
  68. package/dist/src/__tests__/data/blocks/onInit-onMount.raw.jsx +13 -0
  69. package/dist/src/__tests__/data/blocks/onInit.raw.d.ts +8 -0
  70. package/dist/src/__tests__/data/blocks/onInit.raw.jsx +20 -0
  71. package/dist/src/__tests__/data/blocks/onMount.raw.d.ts +1 -1
  72. package/dist/src/__tests__/data/blocks/onUpdate.raw.d.ts +1 -1
  73. package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.d.ts +1 -1
  74. package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.jsx +1 -1
  75. package/dist/src/__tests__/data/blocks/raw-text.raw.d.ts +1 -1
  76. package/dist/src/__tests__/data/blocks/rootShow.raw.d.ts +1 -1
  77. package/dist/src/__tests__/data/blocks/section-state.raw.d.ts +6 -0
  78. package/dist/src/__tests__/data/blocks/section-state.raw.jsx +17 -0
  79. package/dist/src/__tests__/data/blocks/section.raw.d.ts +1 -1
  80. package/dist/src/__tests__/data/blocks/select.raw.d.ts +1 -1
  81. package/dist/src/__tests__/data/blocks/select.raw.jsx +1 -3
  82. package/dist/src/__tests__/data/blocks/self-referencing-component-with-children.raw.d.ts +1 -1
  83. package/dist/src/__tests__/data/blocks/self-referencing-component.raw.d.ts +1 -1
  84. package/dist/src/__tests__/data/blocks/shadow-dom.raw.d.ts +1 -1
  85. package/dist/src/__tests__/data/blocks/shadow-dom.raw.jsx +2 -4
  86. package/dist/src/__tests__/data/blocks/slot-html.raw.d.ts +5 -0
  87. package/dist/src/__tests__/data/blocks/slot-html.raw.jsx +15 -0
  88. package/dist/src/__tests__/data/blocks/slot-jsx.raw.d.ts +5 -0
  89. package/dist/src/__tests__/data/blocks/slot-jsx.raw.jsx +12 -0
  90. package/dist/src/__tests__/data/blocks/stamped-io.raw.d.ts +1 -1
  91. package/dist/src/__tests__/data/blocks/stamped-io.raw.jsx +2 -4
  92. package/dist/src/__tests__/data/blocks/submit-button.raw.d.ts +1 -1
  93. package/dist/src/__tests__/data/blocks/text.raw.d.ts +1 -1
  94. package/dist/src/__tests__/data/blocks/text.raw.jsx +3 -1
  95. package/dist/src/__tests__/data/blocks/textarea.raw.d.ts +1 -1
  96. package/dist/src/__tests__/data/blocks/video.raw.d.ts +1 -1
  97. package/dist/src/__tests__/data/blocks/video.raw.jsx +1 -1
  98. package/dist/src/__tests__/data/context/component-with-context.lite.d.ts +3 -1
  99. package/dist/src/__tests__/data/context/component-with-context.lite.jsx +7 -2
  100. package/dist/src/__tests__/data/styles/class-and-className.raw.d.ts +1 -0
  101. package/dist/src/__tests__/data/styles/class-and-className.raw.jsx +10 -0
  102. package/dist/src/__tests__/data/styles/class.raw.d.ts +1 -0
  103. package/dist/src/__tests__/data/styles/class.raw.jsx +10 -0
  104. package/dist/src/__tests__/data/styles/className.raw.d.ts +1 -0
  105. package/dist/src/__tests__/data/styles/className.raw.jsx +10 -0
  106. package/dist/src/__tests__/data/styles/classState.raw.d.ts +1 -0
  107. package/dist/src/__tests__/data/styles/classState.raw.jsx +12 -0
  108. package/dist/src/__tests__/data/types/component-props-interface.raw.d.ts +6 -0
  109. package/dist/src/__tests__/data/types/component-props-interface.raw.jsx +6 -0
  110. package/dist/src/__tests__/data/types/component-props-type.raw.d.ts +6 -0
  111. package/dist/src/__tests__/data/types/component-props-type.raw.jsx +6 -0
  112. package/dist/src/__tests__/data/types/preserve-typing.raw.d.ts +8 -0
  113. package/dist/src/__tests__/data/types/preserve-typing.raw.jsx +6 -0
  114. package/dist/src/__tests__/html.test.js +2 -13
  115. package/dist/src/__tests__/liquid.test.js +2 -103
  116. package/dist/src/__tests__/parse-jsx.test.js +22 -0
  117. package/dist/src/__tests__/qwik/convertMethodToFunction.test.d.ts +1 -0
  118. package/dist/src/__tests__/qwik/convertMethodToFunction.test.js +34 -0
  119. package/dist/src/__tests__/qwik/src-generator.test.d.ts +1 -0
  120. package/dist/src/__tests__/qwik/src-generator.test.js +65 -0
  121. package/dist/src/__tests__/qwik.directive.test.js +1 -0
  122. package/dist/src/__tests__/qwik.test.js +54 -23
  123. package/dist/src/__tests__/react-native.test.js +3 -136
  124. package/dist/src/__tests__/react.test.js +5 -135
  125. package/dist/src/__tests__/shared.d.ts +3 -0
  126. package/dist/src/__tests__/shared.js +232 -0
  127. package/dist/src/__tests__/solid.test.js +2 -97
  128. package/dist/src/__tests__/stencil.test.js +3 -98
  129. package/dist/src/__tests__/styles.test.d.ts +1 -0
  130. package/dist/src/__tests__/styles.test.js +23 -0
  131. package/dist/src/__tests__/svelte.test.js +2 -31
  132. package/dist/src/__tests__/vue.test.js +2 -134
  133. package/dist/src/__tests__/webcomponent.test.js +8 -5
  134. package/dist/src/constants/hooks.d.ts +6 -0
  135. package/dist/src/constants/hooks.js +9 -0
  136. package/dist/src/flow.d.ts +6 -0
  137. package/dist/src/flow.js +6 -2
  138. package/dist/src/generators/angular.d.ts +8 -2
  139. package/dist/src/generators/angular.js +202 -44
  140. package/dist/src/generators/builder.d.ts +2 -2
  141. package/dist/src/generators/builder.js +19 -26
  142. package/dist/src/generators/context/{react copy.d.ts → qwik.d.ts} +2 -2
  143. package/dist/src/generators/context/{react copy.js → qwik.js} +4 -5
  144. package/dist/src/generators/context/svelte.d.ts +1 -1
  145. package/dist/src/generators/helpers/context.js +1 -2
  146. package/dist/src/generators/html.d.ts +1 -1
  147. package/dist/src/generators/html.js +365 -108
  148. package/dist/src/generators/liquid.d.ts +1 -1
  149. package/dist/src/generators/liquid.js +18 -25
  150. package/dist/src/generators/mitosis.d.ts +1 -1
  151. package/dist/src/generators/mitosis.js +37 -35
  152. package/dist/src/generators/qwik/component-generator.d.ts +4 -0
  153. package/dist/src/generators/qwik/component-generator.js +276 -0
  154. package/dist/src/generators/qwik/component.js +21 -25
  155. package/dist/src/generators/qwik/convertMethodToFunction.d.ts +1 -0
  156. package/dist/src/generators/qwik/convertMethodToFunction.js +161 -0
  157. package/dist/src/generators/qwik/directives.js +27 -22
  158. package/dist/src/generators/qwik/handlers.js +3 -19
  159. package/dist/src/generators/qwik/index.d.ts +3 -1
  160. package/dist/src/generators/qwik/index.js +3 -1
  161. package/dist/src/generators/qwik/jsx.js +33 -13
  162. package/dist/src/generators/qwik/src-generator.d.ts +21 -8
  163. package/dist/src/generators/qwik/src-generator.js +163 -42
  164. package/dist/src/generators/qwik/styles.js +3 -3
  165. package/dist/src/generators/react-native.d.ts +2 -2
  166. package/dist/src/generators/react-native.js +8 -10
  167. package/dist/src/generators/react.d.ts +4 -2
  168. package/dist/src/generators/react.js +152 -80
  169. package/dist/src/generators/solid.d.ts +1 -1
  170. package/dist/src/generators/solid.js +41 -35
  171. package/dist/src/generators/stencil/collect-class-string.js +5 -8
  172. package/dist/src/generators/stencil/generate.d.ts +1 -1
  173. package/dist/src/generators/stencil/generate.js +16 -21
  174. package/dist/src/generators/svelte.d.ts +2 -2
  175. package/dist/src/generators/svelte.js +97 -43
  176. package/dist/src/generators/swift-ui.d.ts +1 -1
  177. package/dist/src/generators/swift-ui.js +17 -19
  178. package/dist/src/generators/template.d.ts +1 -1
  179. package/dist/src/generators/template.js +11 -18
  180. package/dist/src/generators/vue.d.ts +12 -8
  181. package/dist/src/generators/vue.js +111 -63
  182. package/dist/src/helpers/babel-transform.js +3 -8
  183. package/dist/src/helpers/create-mitosis-component.d.ts +1 -1
  184. package/dist/src/helpers/create-mitosis-component.js +1 -1
  185. package/dist/src/helpers/create-mitosis-node.js +1 -1
  186. package/dist/src/helpers/fast-clone.js +1 -3
  187. package/dist/src/helpers/filter-empty-text-nodes.js +1 -2
  188. package/dist/src/helpers/get-bindings.d.ts +2 -0
  189. package/dist/src/helpers/get-bindings.js +18 -0
  190. package/dist/src/helpers/get-prop-functions.d.ts +5 -0
  191. package/dist/src/helpers/get-prop-functions.js +29 -0
  192. package/dist/src/helpers/get-props-ref.d.ts +2 -0
  193. package/dist/src/helpers/get-props-ref.js +32 -0
  194. package/dist/src/helpers/get-refs.js +3 -2
  195. package/dist/src/helpers/get-state-object-string.d.ts +4 -3
  196. package/dist/src/helpers/get-state-object-string.js +23 -20
  197. package/dist/src/helpers/get-styles.js +4 -3
  198. package/dist/src/helpers/getters-to-functions.d.ts +1 -1
  199. package/dist/src/helpers/getters-to-functions.js +1 -1
  200. package/dist/src/helpers/has-bindings-text.d.ts +2 -0
  201. package/dist/src/helpers/has-bindings-text.js +21 -0
  202. package/dist/src/helpers/has-stateful-dom.d.ts +2 -0
  203. package/dist/src/helpers/has-stateful-dom.js +21 -0
  204. package/dist/src/helpers/is-children.js +2 -1
  205. package/dist/src/helpers/is-component.js +1 -3
  206. package/dist/src/helpers/is-html-attribute.d.ts +4 -0
  207. package/dist/src/helpers/is-html-attribute.js +380 -0
  208. package/dist/src/helpers/map-refs.js +17 -3
  209. package/dist/src/helpers/parsers.js +1 -2
  210. package/dist/src/helpers/render-imports.d.ts +18 -2
  211. package/dist/src/helpers/render-imports.js +100 -54
  212. package/dist/src/helpers/render-imports.test.d.ts +1 -0
  213. package/dist/src/helpers/render-imports.test.js +19 -0
  214. package/dist/src/helpers/replace-idenifiers.js +5 -7
  215. package/dist/src/helpers/strip-state-and-props-refs.d.ts +4 -1
  216. package/dist/src/helpers/strip-state-and-props-refs.js +24 -6
  217. package/dist/src/helpers/styles/collect-css.d.ts +6 -0
  218. package/dist/src/helpers/styles/collect-css.js +87 -0
  219. package/dist/src/helpers/styles/collect-css.test.d.ts +1 -0
  220. package/dist/src/helpers/styles/collect-css.test.js +18 -0
  221. package/dist/src/helpers/styles/collect-styled-components.d.ts +2 -0
  222. package/dist/src/helpers/styles/collect-styled-components.js +61 -0
  223. package/dist/src/helpers/{collect-styles.d.ts → styles/helpers.d.ts} +5 -10
  224. package/dist/src/helpers/styles/helpers.js +61 -0
  225. package/dist/src/helpers/typescript.d.ts +2 -0
  226. package/dist/src/{jsx-types.js → helpers/typescript.js} +0 -0
  227. package/dist/src/index.d.ts +7 -4
  228. package/dist/src/index.js +24 -8
  229. package/dist/src/modules/plugins.d.ts +1 -1
  230. package/dist/src/parsers/angular.js +22 -34
  231. package/dist/src/parsers/builder.d.ts +25 -23
  232. package/dist/src/parsers/builder.js +59 -67
  233. package/dist/src/parsers/jsx.d.ts +2 -1
  234. package/dist/src/parsers/jsx.js +300 -93
  235. package/dist/src/parsers/liquid.js +51 -149
  236. package/dist/src/plugins/compile-away-builder-components.js +158 -115
  237. package/dist/src/symbols/symbol-processor.js +10 -7
  238. package/dist/src/targets.d.ts +7 -5
  239. package/dist/src/targets.js +7 -1
  240. package/dist/src/types/config.d.ts +42 -13
  241. package/dist/src/types/mitosis-component.d.ts +31 -10
  242. package/dist/src/types/mitosis-node.d.ts +15 -9
  243. package/dist/src/types/transpiler.d.ts +14 -0
  244. package/dist/src/types/transpiler.js +2 -0
  245. package/dist/test/qwik/Accordion/low.jsx +9 -3
  246. package/dist/test/qwik/Accordion/med.jsx +2 -8
  247. package/dist/test/qwik/For/low.jsx +29 -25
  248. package/dist/test/qwik/For/med.jsx +2 -8
  249. package/dist/test/qwik/Image/high.js +1 -1
  250. package/dist/test/qwik/Image/med.js +15 -13
  251. package/dist/test/qwik/Image.slow/high.js +1 -1
  252. package/dist/test/qwik/Image.slow/med.js +15 -13
  253. package/dist/test/qwik/bindings/low.cjs +12 -3
  254. package/dist/test/qwik/bindings/med.cjs +1 -10
  255. package/dist/test/qwik/button/high.js +1 -1
  256. package/dist/test/qwik/button/low.js +9 -3
  257. package/dist/test/qwik/button/med.js +2 -8
  258. package/dist/test/qwik/component/bindings/low.jsx +48 -5
  259. package/dist/test/qwik/component/bindings/med.jsx +3 -49
  260. package/dist/test/qwik/component/component/inputs/high.cjsx +1 -1
  261. package/dist/test/qwik/component/component/inputs/med.cjsx +8 -9
  262. package/dist/test/qwik/for-loop.bindings/high.cjs +0 -0
  263. package/dist/test/qwik/for-loop.bindings/low.cjs +46 -0
  264. package/dist/test/qwik/for-loop.bindings/med.cjs +5 -0
  265. package/dist/test/qwik/hello_world/stylesheet/low.jsx +9 -3
  266. package/dist/test/qwik/hello_world/stylesheet/med.jsx +2 -8
  267. package/dist/test/qwik/mount/high.cjs +0 -0
  268. package/dist/test/qwik/mount/low.cjs +45 -0
  269. package/dist/test/qwik/mount/med.cjs +3 -0
  270. package/dist/test/qwik/page-with-symbol/low.js +9 -3
  271. package/dist/test/qwik/page-with-symbol/med.js +2 -8
  272. package/dist/test/qwik/show-hide/high.jsx +1 -1
  273. package/dist/test/qwik/show-hide/med.jsx +15 -13
  274. package/dist/test/qwik/svg/low.js +9 -3
  275. package/dist/test/qwik/svg/med.js +2 -8
  276. package/dist/test/qwik/todo/Todo.cjs/high.cjs +6 -10
  277. package/dist/test/qwik/todo/Todo.cjs/med.cjs +9 -9
  278. package/dist/test/qwik/todo/Todo.js/high.js +7 -10
  279. package/dist/test/qwik/todo/Todo.js/med.js +9 -9
  280. package/dist/test/qwik/todo/Todo.tsx/high.tsx +7 -10
  281. package/dist/test/qwik/todo/Todo.tsx/med.tsx +9 -9
  282. package/dist/test/qwik/todos/Todo.tsx/high.tsx +1 -1
  283. package/dist/test/qwik/todos/Todo.tsx/low.tsx +15 -12
  284. package/dist/test/qwik/todos/Todo.tsx/med.tsx +1 -6
  285. package/dist/tsconfig.build.tsbuildinfo +1 -1
  286. package/dist/tsconfig.tsbuildinfo +1 -1
  287. package/package.json +11 -6
  288. package/README.md +0 -239
  289. package/dist/src/__tests__/data/blocks/onUpdate.raw copy.d.ts +0 -1
  290. package/dist/src/__tests__/data/blocks/onUpdate.raw copy.jsx +0 -10
  291. package/dist/src/__tests__/data/blocks/slot.raw.d.ts +0 -5
  292. package/dist/src/__tests__/data/blocks/slot.raw.jsx +0 -6
  293. package/dist/src/__tests__/data/blocks/styles.raw.d.ts +0 -1
  294. package/dist/src/__tests__/data/blocks/styles.raw.jsx +0 -10
  295. package/dist/src/helpers/babel-transform copy.d.ts +0 -8
  296. package/dist/src/helpers/babel-transform copy.js +0 -138
  297. package/dist/src/helpers/collect-styles.js +0 -178
  298. package/dist/src/jsx-types.d.ts +0 -1171
@@ -99,7 +99,8 @@ exports.components = {
99
99
  }), components);
100
100
  },
101
101
  BuilderAccordion: function (node, context, components) {
102
- var itemsJSON = node.bindings.items || '[]';
102
+ var _a;
103
+ var itemsJSON = ((_a = node.bindings.items) === null || _a === void 0 ? void 0 : _a.code) || '[]';
103
104
  var accordionItems = JSON5.parse(itemsJSON);
104
105
  var children = accordionItems.map(function (accordionItem) {
105
106
  var titleChildren = accordionItem.title.map(function (element) {
@@ -169,36 +170,41 @@ exports.components = {
169
170
  }), components);
170
171
  },
171
172
  CoreSection: function (node, context, components) {
173
+ var _a, _b;
172
174
  return wrapOutput(node, (0, create_mitosis_node_1.createMitosisNode)({
173
175
  name: 'section',
174
- properties: __assign(__assign(__assign({}, node.properties), { $name: 'section' }), (node.bindings.lazyLoad === 'true' && {
176
+ properties: __assign(__assign(__assign({}, node.properties), { $name: 'section' }), (((_a = node.bindings.lazyLoad) === null || _a === void 0 ? void 0 : _a.code) === 'true' && {
175
177
  lazyLoad: 'true',
176
178
  })),
177
179
  bindings: {
178
- css: JSON.stringify({
179
- width: '100%',
180
- alignSelf: 'stretch',
181
- flexGrow: '1',
182
- boxSizing: 'border-box',
183
- maxWidth: "".concat((node.bindings.maxWidth && Number(node.bindings.maxWidth)) || 1200, "px"),
184
- display: 'flex',
185
- flexDirection: 'column',
186
- alignItems: 'stretch',
187
- marginLeft: 'auto',
188
- marginRight: 'auto',
189
- }),
180
+ css: {
181
+ code: JSON.stringify({
182
+ width: '100%',
183
+ alignSelf: 'stretch',
184
+ flexGrow: '1',
185
+ boxSizing: 'border-box',
186
+ maxWidth: "".concat((((_b = node.bindings.maxWidth) === null || _b === void 0 ? void 0 : _b.code) && Number(node.bindings.maxWidth.code)) || 1200, "px"),
187
+ display: 'flex',
188
+ flexDirection: 'column',
189
+ alignItems: 'stretch',
190
+ marginLeft: 'auto',
191
+ marginRight: 'auto',
192
+ }),
193
+ },
190
194
  },
191
195
  children: node.children,
192
196
  }), components);
193
197
  },
194
198
  Columns: function (node, context, components) {
195
199
  var _a;
196
- var columns = node.children.filter(filter_empty_text_nodes_1.filterEmptyTextNodes).map(function (item) { return ({
197
- width: parseFloat(item.properties.width || item.bindings.width || '0') || 0,
198
- children: item.children,
199
- }); });
200
- var gutterSize = (node.properties.getterSize && parseFloat(node.properties.getterSize)) ||
201
- 20;
200
+ var columns = node.children.filter(filter_empty_text_nodes_1.filterEmptyTextNodes).map(function (item) {
201
+ var _a;
202
+ return ({
203
+ width: parseFloat(item.properties.width || ((_a = item.bindings.width) === null || _a === void 0 ? void 0 : _a.code) || '0') || 0,
204
+ children: item.children,
205
+ });
206
+ });
207
+ var gutterSize = (node.properties.getterSize && parseFloat(node.properties.getterSize)) || 20;
202
208
  function getWidth(index) {
203
209
  return (columns[index] && columns[index].width) || 100 / columns.length;
204
210
  }
@@ -213,16 +219,18 @@ exports.components = {
213
219
  class: 'builder-columns',
214
220
  },
215
221
  bindings: {
216
- css: JSON.stringify(__assign({ display: 'flex' }, (properties.stackColumnsAt === 'never'
217
- ? {}
218
- : (_a = {},
219
- _a["@media (max-width: ".concat(properties.stackColumnsAt !== 'tablet' ? 639 : 999, "px)")] = {
220
- flexDirection: properties.reverseColumnsWhenStacked === 'true'
221
- ? 'column-reverse'
222
- : 'column',
223
- alignItems: 'stretch',
224
- },
225
- _a)))),
222
+ css: {
223
+ code: JSON.stringify(__assign({ display: 'flex' }, (properties.stackColumnsAt === 'never'
224
+ ? {}
225
+ : (_a = {},
226
+ _a["@media (max-width: ".concat(properties.stackColumnsAt !== 'tablet' ? 639 : 999, "px)")] = {
227
+ flexDirection: properties.reverseColumnsWhenStacked === 'true'
228
+ ? 'column-reverse'
229
+ : 'column',
230
+ alignItems: 'stretch',
231
+ },
232
+ _a)))),
233
+ },
226
234
  },
227
235
  children: columns.map(function (col, index) {
228
236
  var _a;
@@ -233,14 +241,16 @@ exports.components = {
233
241
  class: 'builder-column',
234
242
  },
235
243
  bindings: {
236
- css: JSON.stringify(__assign({ display: 'flex', flexDirection: 'column', alignItems: 'stretch', lineHeight: 'normal', width: "".concat(getColumnWidth(index)), marginLeft: "".concat(index === 0 ? 0 : gutterSize, "px") }, (properties.stackColumnsAt === 'never'
237
- ? {}
238
- : (_a = {},
239
- _a["@media (max-width: ".concat(properties.stackColumnsAt !== 'tablet' ? 639 : 999, "px)")] = {
240
- width: '100%',
241
- marginLeft: 0,
242
- },
243
- _a)))),
244
+ css: {
245
+ code: JSON.stringify(__assign({ display: 'flex', flexDirection: 'column', alignItems: 'stretch', lineHeight: 'normal', width: "".concat(getColumnWidth(index)), marginLeft: "".concat(index === 0 ? 0 : gutterSize, "px") }, (properties.stackColumnsAt === 'never'
246
+ ? {}
247
+ : (_a = {},
248
+ _a["@media (max-width: ".concat(properties.stackColumnsAt !== 'tablet' ? 639 : 999, "px)")] = {
249
+ width: '100%',
250
+ marginLeft: 0,
251
+ },
252
+ _a)))),
253
+ },
244
254
  },
245
255
  children: col.children,
246
256
  });
@@ -248,17 +258,18 @@ exports.components = {
248
258
  }), components);
249
259
  },
250
260
  Image: function (node, context, components) {
251
- var _a = node.properties, backgroundSize = _a.backgroundSize, backgroundPosition = _a.backgroundPosition;
261
+ var _a, _b, _c, _d, _e, _f, _g;
262
+ var _h = node.properties, backgroundSize = _h.backgroundSize, backgroundPosition = _h.backgroundPosition;
252
263
  var srcset = node.properties.srcset;
253
- var aspectRatio = node.bindings.aspectRatio
254
- ? parseFloat(node.bindings.aspectRatio)
264
+ var aspectRatio = ((_a = node.bindings.aspectRatio) === null || _a === void 0 ? void 0 : _a.code)
265
+ ? parseFloat(node.bindings.aspectRatio.code)
255
266
  : null;
256
267
  if (typeof aspectRatio === 'number' && isNaN(aspectRatio)) {
257
268
  aspectRatio = null;
258
269
  }
259
270
  var image = node.properties.image;
260
271
  var srcSet = srcset || generateBuilderIoSrcSet(image);
261
- var source = node.bindings.noWebp !== 'true' &&
272
+ var source = ((_b = node.bindings.noWebp) === null || _b === void 0 ? void 0 : _b.code) !== 'true' &&
262
273
  (0, create_mitosis_node_1.createMitosisNode)({
263
274
  name: 'source',
264
275
  properties: {
@@ -270,24 +281,25 @@ exports.components = {
270
281
  name: 'img',
271
282
  properties: noUndefined({
272
283
  $name: 'image',
273
- loading: node.properties.lazy ? 'lazy' : undefined,
284
+ loading: 'lazy',
274
285
  src: node.properties.image,
275
286
  sizes: node.properties.sizes,
276
287
  srcset: srcSet || null,
277
288
  }),
278
289
  bindings: noUndefined({
279
- loading: node.bindings.lazy ? '"lazy"' : undefined,
280
- src: node.bindings.image,
281
- sizes: node.bindings.sizes,
282
- css: JSON.stringify(__assign({ objectFit: backgroundSize || 'cover', objectPosition: backgroundPosition || 'cover' }, (aspectRatio
283
- ? {
284
- position: 'absolute',
285
- height: '100%',
286
- width: '100%',
287
- top: '0',
288
- left: '0',
289
- }
290
- : {}))),
290
+ src: ((_c = node.bindings.image) === null || _c === void 0 ? void 0 : _c.code) && { code: (_d = node.bindings.image) === null || _d === void 0 ? void 0 : _d.code },
291
+ sizes: ((_e = node.bindings.sizes) === null || _e === void 0 ? void 0 : _e.code) && { code: (_f = node.bindings.sizes) === null || _f === void 0 ? void 0 : _f.code },
292
+ css: {
293
+ code: JSON.stringify(__assign({ objectFit: backgroundSize || 'cover', objectPosition: backgroundPosition || 'cover' }, (aspectRatio
294
+ ? {
295
+ position: 'absolute',
296
+ height: '100%',
297
+ width: '100%',
298
+ top: '0',
299
+ left: '0',
300
+ }
301
+ : {}))),
302
+ },
291
303
  }),
292
304
  });
293
305
  var picture = (0, create_mitosis_node_1.createMitosisNode)({
@@ -302,12 +314,14 @@ exports.components = {
302
314
  class: 'builder-image-sizer',
303
315
  },
304
316
  bindings: {
305
- css: JSON.stringify({
306
- width: '100%',
307
- paddingTop: aspectRatio * 100 + '%',
308
- pointerEvents: 'none',
309
- fontSize: '0',
310
- }),
317
+ css: {
318
+ code: JSON.stringify({
319
+ width: '100%',
320
+ paddingTop: aspectRatio * 100 + '%',
321
+ pointerEvents: 'none',
322
+ fontSize: '0',
323
+ }),
324
+ },
311
325
  },
312
326
  });
313
327
  var children = node.children &&
@@ -318,16 +332,18 @@ exports.components = {
318
332
  $name: 'image-contents',
319
333
  },
320
334
  bindings: {
321
- css: JSON.stringify({
322
- display: 'flex',
323
- flexDirection: 'column',
324
- alignItems: 'stretch',
325
- position: 'absolute',
326
- top: '0',
327
- left: '0',
328
- width: '100%',
329
- height: '100%',
330
- }),
335
+ css: {
336
+ code: JSON.stringify({
337
+ display: 'flex',
338
+ flexDirection: 'column',
339
+ alignItems: 'stretch',
340
+ position: 'absolute',
341
+ top: '0',
342
+ left: '0',
343
+ width: '100%',
344
+ height: '100%',
345
+ }),
346
+ },
331
347
  },
332
348
  children: node.children,
333
349
  });
@@ -335,16 +351,18 @@ exports.components = {
335
351
  imgSizer && imageNodes.push(imgSizer);
336
352
  children && imageNodes.push(children);
337
353
  var href = node.properties.href;
338
- var hrefBinding = node.bindings.href;
354
+ var hrefBinding = (_g = node.bindings.href) === null || _g === void 0 ? void 0 : _g.code;
339
355
  if (href || hrefBinding) {
340
356
  var aHref = (0, create_mitosis_node_1.createMitosisNode)({
341
357
  name: 'a',
342
358
  properties: {
343
359
  href: href,
344
360
  },
345
- bindings: {
346
- href: hrefBinding,
347
- },
361
+ bindings: hrefBinding
362
+ ? {
363
+ href: { code: hrefBinding },
364
+ }
365
+ : undefined,
348
366
  children: imageNodes,
349
367
  });
350
368
  return wrapOutput(node, aHref, components);
@@ -354,8 +372,9 @@ exports.components = {
354
372
  }
355
373
  },
356
374
  Video: function (node, context, components) {
357
- var aspectRatio = node.bindings.aspectRatio
358
- ? parseFloat(node.bindings.aspectRatio)
375
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
376
+ var aspectRatio = ((_a = node.bindings.aspectRatio) === null || _a === void 0 ? void 0 : _a.code)
377
+ ? parseFloat(node.bindings.aspectRatio.code)
359
378
  : null;
360
379
  if (typeof aspectRatio === 'number' && isNaN(aspectRatio)) {
361
380
  aspectRatio = null;
@@ -374,20 +393,32 @@ exports.components = {
374
393
  preload: node.properties.lazy ? 'none' : undefined,
375
394
  }),
376
395
  bindings: noUndefined({
377
- poster: node.bindings.posterImage,
378
- autoplay: node.bindings.autoPlay,
379
- muted: node.bindings.muted,
380
- controls: node.bindings.controls,
381
- playsinline: node.bindings.playsInline,
382
- loop: node.bindings.loop,
383
- css: JSON.stringify({
384
- width: '100%',
385
- height: '100%',
386
- objectFit: node.properties.fit,
387
- objectPosition: node.properties.position,
388
- borderRadius: '1',
389
- position: aspectRatio ? 'absolute' : '',
390
- }),
396
+ poster: ((_b = node.bindings.posterImage) === null || _b === void 0 ? void 0 : _b.code) && {
397
+ code: (_c = node.bindings.posterImage) === null || _c === void 0 ? void 0 : _c.code,
398
+ },
399
+ autoplay: ((_d = node.bindings.autoPlay) === null || _d === void 0 ? void 0 : _d.code) && {
400
+ code: (_e = node.bindings.autoPlay) === null || _e === void 0 ? void 0 : _e.code,
401
+ },
402
+ muted: ((_f = node.bindings.muted) === null || _f === void 0 ? void 0 : _f.code) && {
403
+ code: (_g = node.bindings.muted) === null || _g === void 0 ? void 0 : _g.code,
404
+ },
405
+ controls: ((_h = node.bindings.controls) === null || _h === void 0 ? void 0 : _h.code) && {
406
+ code: (_j = node.bindings.controls) === null || _j === void 0 ? void 0 : _j.code,
407
+ },
408
+ playsinline: ((_k = node.bindings.playsInline) === null || _k === void 0 ? void 0 : _k.code) && {
409
+ code: (_l = node.bindings.playsInline) === null || _l === void 0 ? void 0 : _l.code,
410
+ },
411
+ loop: ((_m = node.bindings.loop) === null || _m === void 0 ? void 0 : _m.code) && { code: (_o = node.bindings.loop) === null || _o === void 0 ? void 0 : _o.code },
412
+ css: {
413
+ code: JSON.stringify({
414
+ width: '100%',
415
+ height: '100%',
416
+ objectFit: node.properties.fit,
417
+ objectPosition: node.properties.position,
418
+ borderRadius: '1',
419
+ position: aspectRatio ? 'absolute' : '',
420
+ }),
421
+ },
391
422
  }),
392
423
  children: [
393
424
  (0, create_mitosis_node_1.createMitosisNode)({
@@ -396,9 +427,11 @@ exports.components = {
396
427
  type: 'video/mp4',
397
428
  src: node.properties.video,
398
429
  },
399
- bindings: {
400
- src: node.bindings.video,
401
- },
430
+ bindings: noUndefined({
431
+ src: ((_p = node.bindings.video) === null || _p === void 0 ? void 0 : _p.code) && {
432
+ code: (_q = node.bindings.video) === null || _q === void 0 ? void 0 : _q.code,
433
+ },
434
+ }),
402
435
  }),
403
436
  ],
404
437
  }));
@@ -409,12 +442,14 @@ exports.components = {
409
442
  $name: 'builder-video-sizer',
410
443
  },
411
444
  bindings: {
412
- css: JSON.stringify({
413
- width: '100%',
414
- paddingTop: aspectRatio * 100 + '%',
415
- pointerEvents: 'none',
416
- fontSize: '0',
417
- }),
445
+ css: {
446
+ code: JSON.stringify({
447
+ width: '100%',
448
+ paddingTop: aspectRatio * 100 + '%',
449
+ pointerEvents: 'none',
450
+ fontSize: '0',
451
+ }),
452
+ },
418
453
  },
419
454
  }));
420
455
  node.children &&
@@ -425,16 +460,18 @@ exports.components = {
425
460
  $name: 'image-contents',
426
461
  },
427
462
  bindings: {
428
- css: JSON.stringify({
429
- display: 'flex',
430
- flexDirection: 'column',
431
- alignItems: 'stretch',
432
- position: 'absolute',
433
- top: '0',
434
- left: '0',
435
- width: '100%',
436
- height: '100%',
437
- }),
463
+ css: {
464
+ code: JSON.stringify({
465
+ display: 'flex',
466
+ flexDirection: 'column',
467
+ alignItems: 'stretch',
468
+ position: 'absolute',
469
+ top: '0',
470
+ left: '0',
471
+ width: '100%',
472
+ height: '100%',
473
+ }),
474
+ },
438
475
  },
439
476
  children: node.children,
440
477
  }));
@@ -444,7 +481,7 @@ exports.components = {
444
481
  $name: 'video-container',
445
482
  },
446
483
  bindings: {
447
- css: JSON.stringify({ position: 'relative' }),
484
+ css: { code: JSON.stringify({ position: 'relative' }) },
448
485
  },
449
486
  children: videoContainerNodes,
450
487
  });
@@ -496,9 +533,7 @@ function generateBuilderIoSrcSet(image) {
496
533
  var isBuilderIo = !!(image || '').match(/builder\.io/);
497
534
  return isBuilderIo
498
535
  ? [100, 200, 400, 800, 1200, 1600, 2000]
499
- .map(function (size) {
500
- return "".concat(updateQueryParam(image, 'width', String(size)), " ").concat(size, "w");
501
- })
536
+ .map(function (size) { return "".concat(updateQueryParam(image, 'width', String(size)), " ").concat(size, "w"); })
502
537
  .concat([image])
503
538
  .join(', ')
504
539
  : '';
@@ -509,7 +544,15 @@ function noUndefined(obj) {
509
544
  if (Object.prototype.hasOwnProperty.call(obj, key)) {
510
545
  var value = obj[key];
511
546
  if (value != null) {
512
- cleanObj[key] = value;
547
+ if (typeof value == 'object') {
548
+ var ret = noUndefined(value);
549
+ if (Object.keys(ret).length) {
550
+ cleanObj[key] = ret;
551
+ }
552
+ }
553
+ else {
554
+ cleanObj[key] = value;
555
+ }
513
556
  }
514
557
  }
515
558
  }
@@ -28,9 +28,7 @@ function ensureAllSymbolsHaveIds(content) {
28
28
  var ids = new Set();
29
29
  (0, traverse_1.forEach)(content, function (el) {
30
30
  var _a, _b, _c;
31
- if (this.key === 'jsCode' &&
32
- isString(el) &&
33
- el.endsWith('return _virtual_index')) {
31
+ if (this.key === 'jsCode' && isString(el) && el.endsWith('return _virtual_index')) {
34
32
  // Sometimes rollup adds a final `return _virtual_index` but that causes VM evaluation to fail.
35
33
  // Instead of a return on the last line, it needs a plain expression on the last line. Luckily
36
34
  // because the rollup compile behavior is consistent this works pretty reliably
@@ -63,7 +61,12 @@ exports.ensureAllSymbolsHaveIds = ensureAllSymbolsHaveIds;
63
61
  //TODO(misko): needs test
64
62
  function convertBuilderContentToSymbolHierarchy(content, _a) {
65
63
  var _b;
66
- var _c = _a === void 0 ? {} : _a, collectComponentStyles = _c.collectComponentStyles, collectComponentState = _c.collectComponentState;
64
+ var _c, _d;
65
+ var _e = _a === void 0 ? {} : _a, collectComponentStyles = _e.collectComponentStyles, collectComponentState = _e.collectComponentState;
66
+ if (collectComponentState && ((_c = content.data) === null || _c === void 0 ? void 0 : _c.state)) {
67
+ var state = (_d = content.data) === null || _d === void 0 ? void 0 : _d.state;
68
+ collectComponentState['ROOT_COMPONENT_STATE'] = state;
69
+ }
67
70
  var path = [-1, content.id];
68
71
  var hierarchy = (_b = {
69
72
  depthFirstSymbols: []
@@ -76,7 +79,7 @@ function convertBuilderContentToSymbolHierarchy(content, _a) {
76
79
  if (cssCode) {
77
80
  collectComponentStyles && collectComponentStyles.push((0, minify_1.minify)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["", ""], ["", ""])), cssCode));
78
81
  }
79
- while (path[0 /* DEPTH */] >= this.path.length) {
82
+ while (path[0 /* Path.DEPTH */] >= this.path.length) {
80
83
  path.shift();
81
84
  path.shift();
82
85
  }
@@ -92,10 +95,10 @@ function convertBuilderContentToSymbolHierarchy(content, _a) {
92
95
  collectComponentState[id] = state;
93
96
  }
94
97
  }
95
- if (path[0 /* DEPTH */] < this.path.length) {
98
+ if (path[0 /* Path.DEPTH */] < this.path.length) {
96
99
  var id = getIdFromSymbol(el);
97
100
  hierarchy[id] = [];
98
- addIfMissing(hierarchy[path[1 /* ID */]], id);
101
+ addIfMissing(hierarchy[path[1 /* Path.ID */]], id);
99
102
  path.unshift(this.path.length, id);
100
103
  }
101
104
  // TODO(misko): This should be `el.content` not `el`
@@ -2,7 +2,7 @@ export declare const targets: {
2
2
  angular: (options?: import("./generators/angular").ToAngularOptions) => import(".").Transpiler;
3
3
  builder: (options?: import("./generators/builder").ToBuilderOptions) => ({ component }: import(".").TranspilerArgs) => {
4
4
  data: {
5
- httpRequests: any;
5
+ httpRequests: import("./types/json").JSON;
6
6
  jsCode: string;
7
7
  tsCode: string;
8
8
  blocks: import("@builder.io/sdk").BuilderElement[];
@@ -15,11 +15,13 @@ export declare const targets: {
15
15
  react: (reactOptions?: import("./generators/react").ToReactOptions) => import(".").Transpiler;
16
16
  reactNative: (options?: import("./generators/react-native").ToReactNativeOptions) => import(".").Transpiler;
17
17
  solid: (options?: import("./generators/solid").ToSolidOptions) => import(".").Transpiler;
18
- svelte: (options?: import("./generators/svelte").ToSvelteOptions) => import(".").Transpiler;
18
+ svelte: ({ plugins, ...options }?: import("./generators/svelte").ToSvelteOptions) => import(".").Transpiler;
19
19
  swift: (options?: import("./generators/swift-ui").ToSwiftOptions) => import(".").Transpiler;
20
20
  template: (options?: import("./generators/template").ToTemplateOptions) => import(".").Transpiler;
21
21
  webcomponent: (options?: import("./generators/html").ToHtmlOptions) => import(".").Transpiler;
22
- vue: (userOptions?: import("./generators/vue").ToVueOptions) => ({ component, path }: import(".").TranspilerArgs & {
23
- path: string;
24
- }) => string;
22
+ vue: (vueOptions?: Omit<import("./generators/vue").ToVueOptions, "vueVersion"> | undefined) => import(".").Transpiler;
23
+ vue2: (vueOptions?: Omit<import("./generators/vue").ToVueOptions, "vueVersion"> | undefined) => import(".").Transpiler;
24
+ vue3: (vueOptions?: Omit<import("./generators/vue").ToVueOptions, "vueVersion"> | undefined) => import(".").Transpiler;
25
+ stencil: (options?: import("./generators/stencil").ToStencilOptions) => import(".").Transpiler;
26
+ qwik: (userOptions?: import("./generators/qwik/component-generator").ToQwikOptions) => import(".").Transpiler;
25
27
  };
@@ -13,6 +13,8 @@ var svelte_1 = require("./generators/svelte");
13
13
  var swift_ui_1 = require("./generators/swift-ui");
14
14
  var template_1 = require("./generators/template");
15
15
  var vue_1 = require("./generators/vue");
16
+ var stencil_1 = require("./generators/stencil");
17
+ var qwik_1 = require("./generators/qwik");
16
18
  exports.targets = {
17
19
  angular: angular_1.componentToAngular,
18
20
  builder: builder_1.componentToBuilder,
@@ -27,5 +29,9 @@ exports.targets = {
27
29
  swift: swift_ui_1.componentToSwift,
28
30
  template: template_1.componentToTemplate,
29
31
  webcomponent: html_1.componentToCustomElement,
30
- vue: vue_1.componentToVue,
32
+ vue: vue_1.componentToVue3,
33
+ vue2: vue_1.componentToVue2,
34
+ vue3: vue_1.componentToVue3,
35
+ stencil: stencil_1.componentToStencil,
36
+ qwik: qwik_1.componentToQwik,
31
37
  };
@@ -1,25 +1,54 @@
1
- import { MitosisComponent } from '..';
2
- import { Plugin } from './plugins';
1
+ export declare type Format = 'esm' | 'cjs';
2
+ export declare type Language = 'js' | 'ts';
3
+ interface TranspilerOptions {
4
+ format?: Format;
5
+ languages?: Language[];
6
+ }
3
7
  declare type Targets = typeof import('../targets').targets;
4
8
  export declare type Target = keyof Targets;
5
9
  export declare type GeneratorOptions = {
6
- [K in keyof Targets]: NonNullable<Parameters<Targets[K]>[0]>;
10
+ [K in Target]: NonNullable<Parameters<Targets[K]>[0]> & {
11
+ transpiler?: TranspilerOptions;
12
+ };
7
13
  };
8
- export interface TranspilerArgs {
9
- path?: string;
10
- component: MitosisComponent;
11
- }
12
- export declare type Transpiler = (args: TranspilerArgs) => string;
13
- export interface BaseTranspilerOptions {
14
- prettier?: boolean;
15
- plugins?: Plugin[];
16
- }
17
14
  export declare type MitosisConfig = {
18
- type?: 'library';
15
+ /**
16
+ * List of targets to compile to.
17
+ */
19
18
  targets: Target[];
19
+ /**
20
+ * The output directory. Defaults to `output`.
21
+ */
20
22
  dest?: string;
23
+ /**
24
+ * globs of files to transpile. Defaults to `src/*`.
25
+ */
21
26
  files?: string | string[];
27
+ /**
28
+ * The directory where overrides are stored. The structure of the override directory must match that of the source code,
29
+ * with each target having its own sub-directory: `${overridesDir}/${target}/*`
30
+ * Defaults to `overrides`.
31
+ */
22
32
  overridesDir?: string;
33
+ /**
34
+ * Dictionary of per-target configuration. For each target, the available options can be inspected by going to
35
+ * `packages/core/src/targets.ts` and looking at the first argument of the desired generator.
36
+ *
37
+ * Example:
38
+ *
39
+ * ```js
40
+ * options: {
41
+ * vue: {
42
+ * prettier: false,
43
+ * namePrefix: (path) => path + '-my-vue-code',
44
+ * },
45
+ * react: {
46
+ * stateType: 'builder';
47
+ * stylesType: 'styled-jsx'
48
+ * }
49
+ * }
50
+ * ```
51
+ */
23
52
  options: Partial<GeneratorOptions>;
24
53
  };
25
54
  export {};
@@ -27,9 +27,20 @@ export interface MitosisImport {
27
27
  [key: string]: string | undefined;
28
28
  };
29
29
  }
30
- declare type ContextInfo = {
30
+ export interface ContextGetInfo {
31
31
  name: string;
32
32
  path: string;
33
+ }
34
+ export interface ContextSetInfo {
35
+ name: string;
36
+ value?: JSONObject;
37
+ ref?: string;
38
+ }
39
+ export declare type ContextGet = {
40
+ [key: string]: ContextGetInfo;
41
+ };
42
+ export declare type ContextSet = {
43
+ [key: string]: ContextSetInfo;
33
44
  };
34
45
  export declare type extendedHook = {
35
46
  code: string;
@@ -39,28 +50,36 @@ export declare type MitosisComponentInput = {
39
50
  name: string;
40
51
  defaultValue: any;
41
52
  };
53
+ export declare type MitosisExport = {
54
+ [name: string]: {
55
+ code: string;
56
+ usedInLocal?: boolean;
57
+ isFunction?: boolean;
58
+ };
59
+ };
42
60
  export declare type MitosisComponent = {
43
61
  '@type': '@builder.io/mitosis/component';
44
62
  name: string;
45
63
  imports: MitosisImport[];
64
+ exports?: MitosisExport;
46
65
  meta: JSONObject & {
47
66
  useMetadata?: JSONObject;
48
67
  };
49
68
  inputs: MitosisComponentInput[];
50
69
  state: JSONObject;
51
70
  context: {
52
- get: {
53
- [key: string]: ContextInfo;
54
- };
55
- set: {
56
- [key: string]: {
57
- name: string;
58
- value?: JSONObject;
59
- };
71
+ get: ContextGet;
72
+ set: ContextSet;
73
+ };
74
+ refs: {
75
+ [useRef: string]: {
76
+ typeParameter?: string;
77
+ argument: string;
60
78
  };
61
79
  };
62
80
  hooks: {
63
81
  init?: extendedHook;
82
+ onInit?: extendedHook;
64
83
  onMount?: extendedHook;
65
84
  onUnMount?: extendedHook;
66
85
  preComponent?: extendedHook;
@@ -69,5 +88,7 @@ export declare type MitosisComponent = {
69
88
  };
70
89
  children: MitosisNode[];
71
90
  subComponents: MitosisComponent[];
91
+ types?: string[];
92
+ interfaces?: string[];
93
+ propsTypeRef?: string;
72
94
  };
73
- export {};