@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
@@ -35,6 +35,7 @@ function createFileSet(options) {
35
35
  isModule: opts.output != 'cjs',
36
36
  isTypeScript: opts.output == 'ts',
37
37
  isJSX: opts.jsx,
38
+ isBuilder: true,
38
39
  };
39
40
  var fileSet = {
40
41
  high: new src_generator_1.File('high.' + extension, srcOptions, opts.qwikLib, opts.qrlPrefix),
@@ -63,48 +64,42 @@ function addComponent(fileSet, component, opts) {
63
64
  var isStatic = Array.from(handlers.keys()).reduce(function (p, v) { return p && v.indexOf('state') == -1; }, true);
64
65
  var onRenderFile = isStatic ? fileSet.low : fileSet.med;
65
66
  var componentFile = fileSet.med;
66
- var styles = _opts.shareStyles
67
- ? getCommonStyles(fileSet).styles
68
- : new Map();
67
+ var styles = _opts.shareStyles ? getCommonStyles(fileSet).styles : new Map();
69
68
  (0, styles_1.collectStyles)(component.children, styles);
70
69
  var useStyles = function () { return null; };
71
70
  if (_opts.shareStyles) {
72
71
  if (_opts.isRoot) {
73
72
  var symbolName = componentName + '_styles';
74
73
  getCommonStyles(fileSet).symbolName = symbolName;
75
- useStyles = generateStyles(componentFile, fileSet.low, symbolName, false);
74
+ useStyles = generateStyles(onRenderFile, fileSet.low, symbolName, false);
76
75
  }
77
76
  }
78
77
  else {
79
78
  if (styles.size) {
80
79
  var symbolName = componentName + '_styles';
81
80
  onRenderFile.exportConst(symbolName, (0, styles_1.renderStyles)(styles));
82
- useStyles = generateStyles(componentFile, onRenderFile, symbolName, true);
81
+ useStyles = generateStyles(onRenderFile, onRenderFile, symbolName, true);
83
82
  }
84
83
  }
85
- addComponentOnMount(componentFile, onRenderFile, componentName, component, useStyles);
86
- componentFile.exportConst(componentName, (0, src_generator_1.invoke)(componentFile.import(componentFile.qwikModule, 'componentQrl'), [generateQrl(componentFile, componentName + '_onMount')], ['any', 'any']));
87
84
  var directives = new Map();
88
- onRenderFile.exportConst(componentName + '_onRender', (0, src_generator_1.arrowFnBlock)([], [
89
- renderUseLexicalScope(onRenderFile),
90
- function () {
91
- return this.emit('return ', (0, jsx_1.renderJSXNodes)(onRenderFile, directives, handlers, component.children, styles, {}), ';');
92
- },
93
- ]));
85
+ addComponentOnMount(onRenderFile, function () {
86
+ return this.emit('return ', (0, jsx_1.renderJSXNodes)(onRenderFile, directives, handlers, component.children, styles, {}), ';');
87
+ }, componentName, component, useStyles);
88
+ componentFile.exportConst(componentName, (0, src_generator_1.invoke)(componentFile.import(componentFile.qwikModule, 'componentQrl'), [generateQrl(componentFile, onRenderFile, componentName + '_onMount')], ['any', 'any']));
94
89
  directives.forEach(function (code, name) {
95
90
  fileSet.med.import(fileSet.med.qwikModule, 'h');
96
91
  fileSet.med.exportConst(name, code, true);
97
92
  });
98
93
  }
99
94
  exports.addComponent = addComponent;
100
- function generateStyles(componentFile, styleFile, symbol, scoped) {
95
+ function generateStyles(fromFile, dstFile, symbol, scoped) {
101
96
  return function () {
102
- this.emit((0, src_generator_1.invoke)(componentFile.import(componentFile.qwikModule, scoped ? 'withScopedStylesQrl' : 'useStylesQrl'), [generateQrl(styleFile, symbol)]), ';');
97
+ this.emit((0, src_generator_1.invoke)(fromFile.import(fromFile.qwikModule, scoped ? 'withScopedStylesQrl' : 'useStylesQrl'), [generateQrl(fromFile, dstFile, symbol)]), ';');
103
98
  };
104
99
  }
105
100
  function renderUseLexicalScope(file) {
106
101
  return function () {
107
- return this.emit('const state=', file.import(file.qwikModule, 'useLexicalScope').name, '()[0]');
102
+ return this.emit('const state=', file.import(file.qwikModule, 'useLexicalScope').localName, '()[0]');
108
103
  };
109
104
  }
110
105
  exports.renderUseLexicalScope = renderUseLexicalScope;
@@ -116,32 +111,33 @@ function addCommonStyles(fileSet) {
116
111
  }
117
112
  }
118
113
  exports.addCommonStyles = addCommonStyles;
119
- function addComponentOnMount(componentFile, onRenderFile, componentName, component, useStyles) {
114
+ function addComponentOnMount(componentFile, onRenderEmit, componentName, component, useStyles) {
120
115
  var inputInitializer = [];
121
116
  if (component.inputs) {
122
117
  component.inputs.forEach(function (input) {
123
118
  input.defaultValue !== undefined &&
124
- inputInitializer.push('if(state.', input.name, '===undefined)state.', input.name, '=', JSON.stringify(input.defaultValue), ';');
119
+ inputInitializer.push('if(!state.hasOwnProperty("', input.name, '"))state.', input.name, '=', JSON.stringify(input.defaultValue), ';');
125
120
  });
126
121
  }
127
122
  componentFile.exportConst(componentName + '_onMount', function () {
128
123
  var _this = this;
129
124
  this.emit((0, src_generator_1.arrowFnValue)(['state'], function () {
130
125
  var _a;
131
- return _this.emit.apply(_this, __spreadArray(__spreadArray(['{'], inputInitializer, false), ['typeof __STATE__==="object"&&Object.assign(state,__STATE__[state.serverStateId]);',
126
+ return _this.emit.apply(_this, __spreadArray(__spreadArray(['{',
127
+ 'if(!state.__INIT__){',
128
+ 'state.__INIT__=true;'], inputInitializer, false), ['typeof __STATE__==="object"&&Object.assign(state,__STATE__[state.serverStateId]);',
132
129
  (0, src_generator_1.iif)((_a = component.hooks.onMount) === null || _a === void 0 ? void 0 : _a.code),
133
- ';',
130
+ '}',
134
131
  useStyles,
135
- 'return ',
136
- generateQrl(onRenderFile, componentName + '_onRender', ['state']),
132
+ onRenderEmit,
137
133
  ';}'], false));
138
134
  }));
139
135
  });
140
136
  }
141
- function generateQrl(componentFile, componentName, capture) {
137
+ function generateQrl(fromFile, dstFile, componentName, capture) {
142
138
  if (capture === void 0) { capture = []; }
143
- return (0, src_generator_1.invoke)(componentFile.import(componentFile.qwikModule, 'qrl'), [
144
- componentFile.toQrlChunk(),
139
+ return (0, src_generator_1.invoke)(fromFile.import(fromFile.qwikModule, 'qrl'), [
140
+ dstFile.toQrlChunk(),
145
141
  (0, src_generator_1.quote)(componentName),
146
142
  "[".concat(capture.join(','), "]"),
147
143
  ]);
@@ -0,0 +1 @@
1
+ export declare function convertMethodToFunction(code: string, methods: Record<string, 'method' | 'getter'>, lexicalArgs: string[]): string;
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertMethodToFunction = void 0;
4
+ function convertMethodToFunction(code, methods, lexicalArgs) {
5
+ var out = [];
6
+ var idx = 0;
7
+ var lastIdx = idx;
8
+ var end = code.length;
9
+ var templateDepth = 0;
10
+ var mode = "code" /* Mode.code */;
11
+ var braceDepth = 0;
12
+ var stringEndBraceDepth = -1;
13
+ var stringEndBraceDepthQueue = [];
14
+ var lastCh = null;
15
+ while (idx < end) {
16
+ var ch = code.charCodeAt(idx++);
17
+ // console.log(mode, code[idx - 1]);
18
+ switch (mode) {
19
+ case "code" /* Mode.code */:
20
+ if (ch === QUOTE_DOUBLE) {
21
+ mode = "stringDouble" /* Mode.stringDouble */;
22
+ }
23
+ else if (ch === QUOTE_SINGLE) {
24
+ mode = "stringSingle" /* Mode.stringSingle */;
25
+ }
26
+ else if (ch === QUOTE_BACK_TICK) {
27
+ mode = "stringTemplate" /* Mode.stringTemplate */;
28
+ templateDepth++;
29
+ }
30
+ else if (ch === OPEN_BRACE) {
31
+ braceDepth++;
32
+ }
33
+ else if (lastCh == FORWARD_SLASH && ch == FORWARD_SLASH) {
34
+ mode = "commentSingleline" /* Mode.commentSingleline */;
35
+ }
36
+ else if (lastCh == FORWARD_SLASH && ch == STAR) {
37
+ mode = "commentMultiline" /* Mode.commentMultiline */;
38
+ }
39
+ else if (ch === CLOSE_BRACE) {
40
+ braceDepth--;
41
+ if (braceDepth === stringEndBraceDepth) {
42
+ stringEndBraceDepth = stringEndBraceDepthQueue.pop();
43
+ templateDepth--;
44
+ mode = "stringTemplate" /* Mode.stringTemplate */;
45
+ }
46
+ }
47
+ else if (isWord(ch, code, idx, 'this') || isWord(ch, code, idx, 'state')) {
48
+ idx--;
49
+ flush();
50
+ consumeIdent();
51
+ if (code.charCodeAt(idx) == DOT) {
52
+ idx++;
53
+ var propEndIdx = findIdentEnd();
54
+ var identifier = code.substring(idx, propEndIdx);
55
+ if (identifier in methods) {
56
+ var isGetter = code.charCodeAt(propEndIdx) !== OPEN_PAREN;
57
+ lastIdx = idx = propEndIdx + (isGetter ? 0 : 1);
58
+ if (isGetter) {
59
+ out.push(identifier, "(".concat(lexicalArgs.join(','), ")"));
60
+ }
61
+ else {
62
+ out.push(identifier, "(".concat(lexicalArgs.join(','), ","));
63
+ }
64
+ }
65
+ else {
66
+ flush();
67
+ }
68
+ }
69
+ }
70
+ break;
71
+ case "commentSingleline" /* Mode.commentSingleline */:
72
+ if (ch == EOL)
73
+ mode = "code" /* Mode.code */;
74
+ break;
75
+ case "commentMultiline" /* Mode.commentMultiline */:
76
+ if (lastCh == STAR && ch == FORWARD_SLASH)
77
+ mode = "code" /* Mode.code */;
78
+ break;
79
+ case "stringSingle" /* Mode.stringSingle */:
80
+ if (lastCh !== BACKSLASH && ch == QUOTE_SINGLE)
81
+ mode = "code" /* Mode.code */;
82
+ break;
83
+ case "stringDouble" /* Mode.stringDouble */:
84
+ if (lastCh !== BACKSLASH && ch == QUOTE_DOUBLE)
85
+ mode = "code" /* Mode.code */;
86
+ break;
87
+ case "stringTemplate" /* Mode.stringTemplate */:
88
+ if (lastCh !== BACKSLASH && ch == QUOTE_BACK_TICK) {
89
+ mode = "code" /* Mode.code */;
90
+ templateDepth--;
91
+ }
92
+ else if (lastCh === DOLLAR && ch == OPEN_BRACE) {
93
+ templateDepth++;
94
+ mode = "code" /* Mode.code */;
95
+ stringEndBraceDepthQueue.push(stringEndBraceDepth);
96
+ stringEndBraceDepth = braceDepth;
97
+ braceDepth++;
98
+ }
99
+ break;
100
+ }
101
+ lastCh = ch;
102
+ }
103
+ flush();
104
+ return out.join('');
105
+ function flush() {
106
+ out.push(code.substring(lastIdx, idx));
107
+ lastIdx = idx;
108
+ }
109
+ function findIdentEnd() {
110
+ var scanIdx = idx;
111
+ while (isIdentCh(code.charCodeAt(scanIdx)) && scanIdx < end) {
112
+ scanIdx++;
113
+ }
114
+ return scanIdx;
115
+ }
116
+ function consumeIdent() {
117
+ while (isIdentCh(code.charCodeAt(idx))) {
118
+ idx++;
119
+ }
120
+ }
121
+ }
122
+ exports.convertMethodToFunction = convertMethodToFunction;
123
+ function isIdentCh(ch) {
124
+ return ((CHAR_0 <= ch && ch <= CHAR_9) ||
125
+ (CHAR_a <= ch && ch <= CHAR_z) ||
126
+ (CHAR_A <= ch && ch <= CHAR_Z) ||
127
+ ch === UNDERSCORE ||
128
+ ch === DOLLAR);
129
+ }
130
+ function isWord(ch, code, idx, word) {
131
+ if (ch !== word.charCodeAt(0))
132
+ return false;
133
+ for (var i = 1; i < word.length; i++) {
134
+ if (code.charCodeAt(idx + i - 1) !== word.charCodeAt(i)) {
135
+ return false;
136
+ }
137
+ }
138
+ if (isIdentCh(code.charCodeAt(idx + word.length - 1))) {
139
+ return false;
140
+ }
141
+ return true;
142
+ }
143
+ var QUOTE_DOUBLE = '"'.charCodeAt(0);
144
+ var QUOTE_SINGLE = "'".charCodeAt(0);
145
+ var QUOTE_BACK_TICK = '`'.charCodeAt(0);
146
+ var BACKSLASH = "\\".charCodeAt(0);
147
+ var FORWARD_SLASH = "/".charCodeAt(0);
148
+ var EOL = "\n".charCodeAt(0);
149
+ var STAR = "*".charCodeAt(0);
150
+ var CHAR_0 = "0".charCodeAt(0);
151
+ var CHAR_9 = "9".charCodeAt(0);
152
+ var CHAR_a = "a".charCodeAt(0);
153
+ var CHAR_z = "z".charCodeAt(0);
154
+ var CHAR_A = "A".charCodeAt(0);
155
+ var CHAR_Z = "Z".charCodeAt(0);
156
+ var UNDERSCORE = "_".charCodeAt(0);
157
+ var DOLLAR = "$".charCodeAt(0);
158
+ var DOT = ".".charCodeAt(0);
159
+ var OPEN_PAREN = '('.charCodeAt(0);
160
+ var OPEN_BRACE = '{'.charCodeAt(0);
161
+ var CLOSE_BRACE = '}'.charCodeAt(0);
@@ -10,24 +10,32 @@ var src_generator_1 = require("./src-generator");
10
10
  exports.DIRECTIVES = {
11
11
  Show: function (node, blockFn) {
12
12
  return function () {
13
- var expr = node.bindings.when;
14
- this.isJSX && this.emit('{');
15
- this.emit(expr, '?');
16
- blockFn();
17
- this.emit(':null');
18
- this.isJSX && this.emit('}');
13
+ var _this = this;
14
+ var _a;
15
+ var expr = (_a = node.bindings.when) === null || _a === void 0 ? void 0 : _a.code;
16
+ this.jsxExpression(function () {
17
+ _this.emit(expr, '?');
18
+ blockFn();
19
+ _this.emit(':null');
20
+ });
19
21
  };
20
22
  },
21
23
  For: function (node, blockFn) {
22
24
  return function () {
23
- var expr = node.bindings.each;
24
- this.isJSX && this.emit('{');
25
- this.emit('(', expr, '||[]).map(', '(function(__value__){');
26
- this.emit('var state=Object.assign({},this,{', (0, src_generator_1.iteratorProperty)(expr), ':__value__==null?{}:__value__});');
27
- this.emit('return(');
28
- blockFn();
29
- this.emit(');}).bind(state))');
30
- this.isJSX && this.emit('}');
25
+ var _this = this;
26
+ var _a;
27
+ var expr = (_a = node.bindings.each) === null || _a === void 0 ? void 0 : _a.code;
28
+ this.jsxExpression(function () {
29
+ var forName = node.properties._forName || '_';
30
+ var indexName = node.properties._indexName;
31
+ _this.emit('(', expr, '||[]).map(', '((', forName, indexName ? ',' : '', indexName ? indexName : '', ') => {');
32
+ if (_this.isBuilder) {
33
+ _this.emit('var state=Object.assign({},this,{', (0, src_generator_1.iteratorProperty)(expr), ':', forName, '==null?{}:', forName, '});');
34
+ }
35
+ _this.emit('return(');
36
+ blockFn();
37
+ _this.emit(');}))');
38
+ });
31
39
  };
32
40
  },
33
41
  Image: (0, minify_1.minify)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["", ""], ["", ""])), Image),
@@ -43,10 +51,7 @@ function Image(props) {
43
51
  var isPixel = (_a = props.builderBlock) === null || _a === void 0 ? void 0 : _a.id.startsWith('builder-pixel-');
44
52
  var imgProps = {
45
53
  src: props.image,
46
- style: "object-fit:".concat(props.backgroundSize || 'cover', ";object-position:").concat(props.backgroundPosition || 'center', ";") +
47
- (props.aspectRatio
48
- ? 'position:absolute;height:100%;width:100%;top:0;left:0'
49
- : ''),
54
+ style: "object-fit:".concat(props.backgroundSize || 'cover', ";object-position:").concat(props.backgroundPosition || 'center', ";") + (props.aspectRatio ? 'position:absolute;height:100%;width:100%;top:0;left:0' : ''),
50
55
  sizes: props.sizes,
51
56
  alt: props.altText,
52
57
  role: !props.altText ? 'presentation' : undefined,
@@ -54,12 +59,13 @@ function Image(props) {
54
59
  srcset: undefined,
55
60
  };
56
61
  if (isBuilderIoImage) {
57
- image = updateQueryParam(image, 'format', 'webp');
62
+ var webpImage_1 = updateQueryParam(image, 'format', 'webp');
58
63
  var srcset = ['100', '200', '400', '800', '1200', '1600', '2000']
59
64
  .concat(props.srcsetSizes ? String(props.srcsetSizes).split(' ') : [])
60
65
  .map(function (size) {
61
- return updateQueryParam(image, 'width', size) + ' ' + size + 'w';
66
+ return updateQueryParam(webpImage_1, 'width', size) + ' ' + size + 'w';
62
67
  })
68
+ .concat([image])
63
69
  .join(', ');
64
70
  imgProps.srcset = srcset;
65
71
  jsx = jsx = [
@@ -72,8 +78,7 @@ function Image(props) {
72
78
  else {
73
79
  jsx = [h('img', imgProps, jsx)];
74
80
  }
75
- if (props.aspectRatio &&
76
- !(props.fitContent && props.children && props.children.length)) {
81
+ if (props.aspectRatio && !(props.fitContent && props.children && props.children.length)) {
77
82
  var sizingDiv = h('div', {
78
83
  class: 'builder-image-sizer',
79
84
  style: "width:100%;padding-top:".concat((props.aspectRatio || 1) * 100, "%;pointer-events:none;font-size:0"),
@@ -38,7 +38,7 @@ function renderHandlers(file, componentName, children) {
38
38
  var bindings = node.bindings;
39
39
  for (var key in bindings) {
40
40
  if (Object.prototype.hasOwnProperty.call(bindings, key)) {
41
- var binding = bindings[key];
41
+ var binding = bindings[key].code;
42
42
  if (binding != null) {
43
43
  if (key.startsWith('on')) {
44
44
  var block = extractJSBlock(binding) || binding;
@@ -55,31 +55,15 @@ function renderHandlers(file, componentName, children) {
55
55
  }
56
56
  exports.renderHandlers = renderHandlers;
57
57
  function renderHandler(file, symbol, code) {
58
- var body = [wrapWithUse(file, code)];
58
+ var body = [code];
59
59
  var shouldRenderStateRestore = code.indexOf('state') !== -1;
60
60
  if (shouldRenderStateRestore) {
61
61
  body.unshift((0, component_1.renderUseLexicalScope)(file));
62
62
  }
63
63
  file.exportConst(symbol, function () {
64
- this.emit([(0, src_generator_1.arrowFnBlock)([], body)]);
64
+ this.emit([(0, src_generator_1.arrowFnBlock)(['event'], body)]);
65
65
  });
66
66
  }
67
- function wrapWithUse(file, code) {
68
- var needsEvent = !!code.match(/\bevent\b/);
69
- if (needsEvent) {
70
- return function () {
71
- this.emit('{');
72
- needsEvent &&
73
- this.emit('const event=', (0, src_generator_1.invoke)(file.import(file.qwikModule, 'useEvent'), []), ';');
74
- var blockContent = stripBlock(code);
75
- this.emit(blockContent);
76
- this.emit('}');
77
- };
78
- }
79
- else {
80
- return code;
81
- }
82
- }
83
67
  function stripBlock(block) {
84
68
  return block.substring(1, block.length - 1).trim();
85
69
  }
@@ -1,2 +1,4 @@
1
- export { addCommonStyles, addComponent, createFileSet, FileSet, QwikOptions, } from './component';
1
+ export { addCommonStyles, addComponent, createFileSet } from './component';
2
+ export type { FileSet, QwikOptions } from './component';
3
+ export { componentToQwik } from './component-generator';
2
4
  export { File } from './src-generator';
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.File = exports.createFileSet = exports.addComponent = exports.addCommonStyles = void 0;
3
+ exports.File = exports.componentToQwik = exports.createFileSet = exports.addComponent = exports.addCommonStyles = void 0;
4
4
  var component_1 = require("./component");
5
5
  Object.defineProperty(exports, "addCommonStyles", { enumerable: true, get: function () { return component_1.addCommonStyles; } });
6
6
  Object.defineProperty(exports, "addComponent", { enumerable: true, get: function () { return component_1.addComponent; } });
7
7
  Object.defineProperty(exports, "createFileSet", { enumerable: true, get: function () { return component_1.createFileSet; } });
8
+ var component_generator_1 = require("./component-generator");
9
+ Object.defineProperty(exports, "componentToQwik", { enumerable: true, get: function () { return component_generator_1.componentToQwik; } });
8
10
  var src_generator_1 = require("./src-generator");
9
11
  Object.defineProperty(exports, "File", { enumerable: true, get: function () { return src_generator_1.File; } });
@@ -21,6 +21,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.renderJSXNodes = void 0;
24
+ var is_mitosis_node_1 = require("../../helpers/is-mitosis-node");
24
25
  var directives_1 = require("./directives");
25
26
  var src_generator_1 = require("./src-generator");
26
27
  function renderJSXNodes(file, directives, handlers, children, styles, parentSymbolBindings, root) {
@@ -31,18 +32,26 @@ function renderJSXNodes(file, directives, handlers, children, styles, parentSymb
31
32
  return;
32
33
  if (root)
33
34
  this.emit('(');
34
- var needsFragment = root && children.length > 1;
35
+ var needsFragment = root && (children.length > 1 || isInlinedDirective(children[0]));
35
36
  file.import(file.qwikModule, 'h');
37
+ var fragmentSymbol = file.import(file.qwikModule, 'Fragment');
36
38
  if (needsFragment) {
37
- file.import(file.qwikModule, 'Fragment');
38
- this.jsxBeginFragment(file.import(file.qwikModule, 'Fragment'));
39
+ this.jsxBeginFragment(fragmentSymbol);
39
40
  }
40
41
  children.forEach(function (child) {
42
+ var _a, _b;
41
43
  if (isEmptyTextNode(child))
42
44
  return;
43
45
  if (isTextNode(child)) {
44
- if (child.bindings._text !== undefined) {
45
- _this.jsxTextBinding(child.bindings._text);
46
+ if (((_a = child.bindings._text) === null || _a === void 0 ? void 0 : _a.code) !== undefined) {
47
+ if (child.bindings._text.code == 'props.children') {
48
+ _this.file.import(_this.file.qwikModule, 'Slot');
49
+ _this.jsxBegin('Slot', {}, {});
50
+ _this.jsxEnd('Slot');
51
+ }
52
+ else {
53
+ _this.jsxTextBinding(child.bindings._text.code);
54
+ }
46
55
  }
47
56
  else {
48
57
  _this.isJSX
@@ -55,8 +64,13 @@ function renderJSXNodes(file, directives, handlers, children, styles, parentSymb
55
64
  var directive = directives_1.DIRECTIVES[childName];
56
65
  if (typeof directive == 'function') {
57
66
  _this.emit(directive(child, function () {
58
- return renderJSXNodes(file, directives, handlers, child.children, styles, {}, false).call(_this);
67
+ var children = child.children.filter(function (c) { return !isEmptyTextNode(c); });
68
+ var needsFragment = children.length > 1 || isTextNode(children[0]);
69
+ needsFragment && _this.jsxBeginFragment(fragmentSymbol);
70
+ renderJSXNodes(file, directives, handlers, children, styles, {}, false).call(_this);
71
+ needsFragment && _this.jsxEndFragment();
59
72
  }));
73
+ !_this.isJSX && _this.emit(',');
60
74
  }
61
75
  else {
62
76
  if (typeof directive == 'string') {
@@ -66,20 +80,20 @@ function renderJSXNodes(file, directives, handlers, children, styles, parentSymb
66
80
  var code = directives_1.DIRECTIVES[name];
67
81
  typeof code == 'string' && directives.set(name, code);
68
82
  });
69
- if (file.module !== 'med') {
83
+ if (file.module !== 'med' && file.imports.hasImport(childName)) {
70
84
  file.import('./med.js', childName);
71
85
  }
72
86
  }
73
87
  if (isSymbol(childName)) {
74
88
  // TODO(misko): We are hard coding './med.js' which is not right.
75
- file.import('./med.js', childName);
89
+ !file.imports.hasImport(childName) && file.import('./med.js', childName);
76
90
  var exportedChildName = file.exports.get(childName);
77
91
  if (exportedChildName) {
78
92
  childName = exportedChildName;
79
93
  }
80
94
  }
81
95
  var props = child.properties;
82
- var css = child.bindings.css;
96
+ var css = (_b = child.bindings.css) === null || _b === void 0 ? void 0 : _b.code;
83
97
  var specialBindings = {};
84
98
  if (css) {
85
99
  props = __assign({}, props);
@@ -89,7 +103,9 @@ function renderJSXNodes(file, directives, handlers, children, styles, parentSymb
89
103
  // special case for Images. We want to make sure that we include the maxWidth in a srcset
90
104
  specialBindings.srcsetSizes = Number.parseInt(imageMaxWidth);
91
105
  }
92
- props.class = addClass(styleProps.CLASS_NAME, props.class);
106
+ if (styleProps === null || styleProps === void 0 ? void 0 : styleProps.CLASS_NAME) {
107
+ props.class = addClass(styleProps.CLASS_NAME, props.class);
108
+ }
93
109
  }
94
110
  var symbolBindings = {};
95
111
  var bindings = rewriteHandlers(file, handlers, child.bindings, symbolBindings);
@@ -118,7 +134,8 @@ function isEmptyTextNode(child) {
118
134
  return ((_a = child.properties._text) === null || _a === void 0 ? void 0 : _a.trim()) == '';
119
135
  }
120
136
  function isTextNode(child) {
121
- return (child.properties._text !== undefined || child.bindings._text !== undefined);
137
+ var _a;
138
+ return child.properties._text !== undefined || ((_a = child.bindings._text) === null || _a === void 0 ? void 0 : _a.code) !== undefined;
122
139
  }
123
140
  /**
124
141
  * Rewrites bindings:
@@ -136,7 +153,7 @@ function rewriteHandlers(file, handlers, bindings, symbolBindings) {
136
153
  var outBindings = {};
137
154
  for (var key in bindings) {
138
155
  if (Object.prototype.hasOwnProperty.call(bindings, key)) {
139
- var binding = bindings[key];
156
+ var binding = bindings[key].code;
140
157
  var handlerBlock = void 0;
141
158
  if (binding != null) {
142
159
  if (key == 'css') {
@@ -153,9 +170,12 @@ function rewriteHandlers(file, handlers, bindings, symbolBindings) {
153
170
  else if (symbolBindings && key.startsWith('symbol.data.')) {
154
171
  symbolBindings[(0, src_generator_1.lastProperty)(key)] = binding;
155
172
  }
156
- outBindings[key] = binding;
173
+ outBindings[key] = { code: binding };
157
174
  }
158
175
  }
159
176
  }
160
177
  return outBindings;
161
178
  }
179
+ function isInlinedDirective(node) {
180
+ return ((0, is_mitosis_node_1.isMitosisNode)(node) && node.name == 'Show') || node.name == 'For';
181
+ }
@@ -3,6 +3,7 @@ export interface SrcBuilderOptions {
3
3
  isTypeScript: boolean;
4
4
  isModule: boolean;
5
5
  isJSX: boolean;
6
+ isBuilder: boolean;
6
7
  }
7
8
  export declare type EmitFn = (this: SrcBuilder) => void;
8
9
  export declare class File {
@@ -17,24 +18,34 @@ export declare class File {
17
18
  get path(): string;
18
19
  get contents(): string;
19
20
  constructor(filename: string, options: SrcBuilderOptions, qwikModule: string, qrlPrefix: string);
20
- import(module: string, symbol: string): Symbol;
21
+ import(module: string, symbol: string, as?: string): Symbol;
21
22
  toQrlChunk(): string;
22
23
  exportConst(name: string, value?: any, locallyVisible?: boolean): void;
24
+ exportDefault(symbolName: any): void;
23
25
  toString(): string;
24
26
  }
25
27
  export declare class SrcBuilder {
28
+ file: File;
26
29
  isTypeScript: boolean;
27
30
  isModule: boolean;
28
31
  isJSX: boolean;
29
32
  buf: string[];
30
- constructor(options: SrcBuilderOptions);
31
- import(module: string, symbols: string[]): this;
33
+ jsxDepth: number;
34
+ /**
35
+ * Used to signal that we are generating code for Builder.
36
+ *
37
+ * In builder the `<For/>` iteration places the value on the state.
38
+ */
39
+ isBuilder: any;
40
+ constructor(file: File, options: SrcBuilderOptions);
41
+ import(module: string, symbols: Symbol[]): this;
32
42
  emit(...values: any[]): this;
33
43
  private push;
34
44
  emitList(values: any[], sep?: string): this;
35
45
  const(name: string, value?: any, export_?: boolean, locallyVisible?: boolean): this;
36
46
  type(def: string): this;
37
47
  typeParameters(typeParameters: string[] | undefined): void;
48
+ jsxExpression(expression: EmitFn): void;
38
49
  jsxBegin(symbol: Symbol | string, props: Record<string, any>, bindings: Record<string, any>): void;
39
50
  jsxEnd(symbol: Symbol | string): void;
40
51
  jsxBeginFragment(symbol: Symbol): void;
@@ -43,12 +54,14 @@ export declare class SrcBuilder {
43
54
  toString(): string;
44
55
  }
45
56
  export declare class Symbol {
46
- name: string;
47
- constructor(name: string);
57
+ importName: string;
58
+ localName: string;
59
+ constructor(importName: string, localName: string);
48
60
  }
49
61
  export declare class Imports {
50
62
  imports: Map<string, Map<string, Symbol>>;
51
- get(moduleName: string, symbolName: string): Symbol;
63
+ get(moduleName: string, symbolName: string, as?: string): Symbol;
64
+ hasImport(localName: string): boolean;
52
65
  }
53
66
  export declare class Block {
54
67
  imports: Imports;
@@ -56,9 +69,9 @@ export declare class Block {
56
69
  }
57
70
  export declare function quote(text: string): string;
58
71
  export declare function invoke(symbol: Symbol | string, args: any[], typeParameters?: string[]): (this: SrcBuilder) => void;
59
- export declare function arrowFnBlock(args: string[], statements: any[]): (this: SrcBuilder) => void;
72
+ export declare function arrowFnBlock(args: string[], statements: any[], argTypes?: string[]): (this: SrcBuilder) => void;
60
73
  export declare function arrowFnValue(args: string[], expression: any): (this: SrcBuilder) => void;
61
- export declare function iif(code: any): (this: SrcBuilder) => void;
74
+ export declare function iif(code: any): ((this: SrcBuilder) => void) | undefined;
62
75
  /**
63
76
  * Returns `true` if the code is a statement (rather than expression).
64
77
  *