@builder.io/mitosis 0.0.56-9 → 0.0.56-92

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 (366) hide show
  1. package/dist/src/__tests__/angular.test.js +5 -67
  2. package/dist/src/__tests__/builder.test.js +3 -3
  3. package/dist/src/__tests__/data/advanced-ref.raw.d.ts +4 -0
  4. package/dist/src/__tests__/data/advanced-ref.raw.jsx +39 -0
  5. package/dist/src/__tests__/data/basic-child-component.raw.d.ts +1 -0
  6. package/dist/src/__tests__/data/basic-child-component.raw.jsx +21 -0
  7. package/dist/src/__tests__/data/basic-context.raw.d.ts +1 -0
  8. package/dist/src/__tests__/data/basic-context.raw.jsx +29 -0
  9. package/dist/src/__tests__/data/basic-custom-mitosis-package.raw.d.ts +1 -0
  10. package/dist/src/__tests__/data/basic-custom-mitosis-package.raw.jsx +10 -0
  11. package/dist/src/__tests__/data/basic-for-show.raw.d.ts +1 -1
  12. package/dist/src/__tests__/data/basic-for-show.raw.jsx +2 -3
  13. package/dist/src/__tests__/data/basic-for.raw.d.ts +1 -1
  14. package/dist/src/__tests__/data/basic-for.raw.jsx +2 -3
  15. package/dist/src/__tests__/data/basic-forwardRef-metadata.raw.d.ts +5 -0
  16. package/dist/src/__tests__/data/basic-forwardRef-metadata.raw.jsx +17 -0
  17. package/dist/src/__tests__/data/basic-forwardRef.raw.d.ts +5 -0
  18. package/dist/src/__tests__/data/basic-forwardRef.raw.jsx +14 -0
  19. package/dist/src/__tests__/data/basic-onChange.raw.d.ts +1 -0
  20. package/dist/src/__tests__/data/basic-onChange.raw.jsx +17 -0
  21. package/dist/src/__tests__/data/basic-onMount-update.raw.d.ts +5 -1
  22. package/dist/src/__tests__/data/basic-onMount-update.raw.jsx +4 -4
  23. package/dist/src/__tests__/data/basic-onUpdate-return.raw.d.ts +1 -0
  24. package/dist/src/__tests__/data/basic-onUpdate-return.raw.jsx +24 -0
  25. package/dist/src/__tests__/data/basic-outputs-meta.raw.d.ts +1 -0
  26. package/dist/src/__tests__/data/basic-outputs-meta.raw.jsx +17 -0
  27. package/dist/src/__tests__/data/basic-outputs.raw.d.ts +1 -1
  28. package/dist/src/__tests__/data/basic-outputs.raw.jsx +1 -4
  29. package/dist/src/__tests__/data/basic-preserve-export-or-local-statement.raw.d.ts +6 -0
  30. package/dist/src/__tests__/data/basic-preserve-export-or-local-statement.raw.jsx +14 -0
  31. package/dist/src/__tests__/data/basic-props-destructure.raw.d.ts +6 -0
  32. package/dist/src/__tests__/data/basic-props-destructure.raw.jsx +14 -0
  33. package/dist/src/__tests__/data/basic-props.raw.d.ts +6 -0
  34. package/dist/src/__tests__/data/basic-props.raw.jsx +13 -0
  35. package/dist/src/__tests__/data/basic-ref-assignment.raw.d.ts +4 -0
  36. package/dist/src/__tests__/data/basic-ref-assignment.raw.jsx +15 -0
  37. package/dist/src/__tests__/data/basic-ref-usePrevious.raw.d.ts +5 -0
  38. package/dist/src/__tests__/data/basic-ref-usePrevious.raw.jsx +35 -0
  39. package/dist/src/__tests__/data/basic-ref.raw.d.ts +4 -0
  40. package/dist/src/__tests__/data/basic-ref.raw.jsx +36 -0
  41. package/dist/src/__tests__/data/basic.raw.d.ts +6 -1
  42. package/dist/src/__tests__/data/basic.raw.jsx +13 -4
  43. package/dist/src/__tests__/data/blocks/button-with-metadata.raw.d.ts +1 -1
  44. package/dist/src/__tests__/data/blocks/button.raw.d.ts +1 -1
  45. package/dist/src/__tests__/data/blocks/classname-jsx.raw.d.ts +1 -0
  46. package/dist/src/__tests__/data/blocks/classname-jsx.raw.jsx +1 -1
  47. package/dist/src/__tests__/data/blocks/columns.raw.d.ts +1 -1
  48. package/dist/src/__tests__/data/blocks/columns.raw.jsx +1 -1
  49. package/dist/src/__tests__/data/blocks/content-slot-html.raw.d.ts +1 -0
  50. package/dist/src/__tests__/data/blocks/content-slot-jsx.raw.d.ts +1 -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 +2 -2
  58. package/dist/src/__tests__/data/blocks/image.raw.jsx +9 -10
  59. package/dist/src/__tests__/data/blocks/img-state.raw.d.ts +1 -1
  60. package/dist/src/__tests__/data/blocks/img-state.raw.jsx +1 -1
  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 -1
  68. package/dist/src/__tests__/data/blocks/onInit.raw.d.ts +8 -1
  69. package/dist/src/__tests__/data/blocks/onInit.raw.jsx +13 -3
  70. package/dist/src/__tests__/data/blocks/onMount.raw.d.ts +1 -1
  71. package/dist/src/__tests__/data/blocks/onUpdate.raw.d.ts +1 -1
  72. package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.d.ts +1 -1
  73. package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.jsx +1 -1
  74. package/dist/src/__tests__/data/blocks/raw-text.raw.d.ts +1 -1
  75. package/dist/src/__tests__/data/blocks/rootShow.raw.d.ts +1 -1
  76. package/dist/src/__tests__/data/blocks/section-state.raw.d.ts +1 -1
  77. package/dist/src/__tests__/data/blocks/section-state.raw.jsx +1 -1
  78. package/dist/src/__tests__/data/blocks/section.raw.d.ts +1 -1
  79. package/dist/src/__tests__/data/blocks/select.raw.d.ts +1 -1
  80. package/dist/src/__tests__/data/blocks/select.raw.jsx +1 -3
  81. package/dist/src/__tests__/data/blocks/self-referencing-component-with-children.raw.d.ts +1 -1
  82. package/dist/src/__tests__/data/blocks/self-referencing-component.raw.d.ts +1 -1
  83. package/dist/src/__tests__/data/blocks/shadow-dom.raw.d.ts +1 -1
  84. package/dist/src/__tests__/data/blocks/shadow-dom.raw.jsx +2 -4
  85. package/dist/src/__tests__/data/blocks/slot-html.raw.d.ts +1 -1
  86. package/dist/src/__tests__/data/blocks/slot-jsx.raw.d.ts +1 -1
  87. package/dist/src/__tests__/data/blocks/stamped-io.raw.d.ts +1 -1
  88. package/dist/src/__tests__/data/blocks/stamped-io.raw.jsx +4 -5
  89. package/dist/src/__tests__/data/blocks/submit-button.raw.d.ts +1 -1
  90. package/dist/src/__tests__/data/blocks/text.raw.d.ts +1 -1
  91. package/dist/src/__tests__/data/blocks/text.raw.jsx +3 -1
  92. package/dist/src/__tests__/data/blocks/textarea.raw.d.ts +1 -1
  93. package/dist/src/__tests__/data/blocks/video.raw.d.ts +1 -1
  94. package/dist/src/__tests__/data/blocks/video.raw.jsx +1 -1
  95. package/dist/src/__tests__/data/context/component-with-context.lite.d.ts +1 -1
  96. package/dist/src/__tests__/data/nested-styles.lite.d.ts +1 -0
  97. package/dist/src/__tests__/data/nested-styles.lite.jsx +20 -0
  98. package/dist/src/__tests__/data/show/nested-show.raw.d.ts +6 -0
  99. package/dist/src/__tests__/data/show/nested-show.raw.jsx +11 -0
  100. package/dist/src/__tests__/data/show/show-with-for.raw.d.ts +6 -0
  101. package/dist/src/__tests__/data/show/show-with-for.raw.jsx +9 -0
  102. package/dist/src/__tests__/data/styles/class-and-className.raw.d.ts +1 -0
  103. package/dist/src/__tests__/data/styles/class-and-className.raw.jsx +10 -0
  104. package/dist/src/__tests__/data/styles/class.raw.d.ts +1 -0
  105. package/dist/src/__tests__/data/styles/class.raw.jsx +10 -0
  106. package/dist/src/__tests__/data/styles/className.raw.d.ts +1 -0
  107. package/dist/src/__tests__/data/styles/className.raw.jsx +10 -0
  108. package/dist/src/__tests__/data/styles/classState.raw.d.ts +1 -0
  109. package/dist/src/__tests__/data/styles/classState.raw.jsx +13 -0
  110. package/dist/src/__tests__/data/types/component-props-interface.raw.d.ts +6 -0
  111. package/dist/src/__tests__/data/types/component-props-interface.raw.jsx +6 -0
  112. package/dist/src/__tests__/data/types/component-props-type.raw.d.ts +6 -0
  113. package/dist/src/__tests__/data/types/component-props-type.raw.jsx +6 -0
  114. package/dist/src/__tests__/data/types/foo-type.d.ts +1 -0
  115. package/dist/src/{jsx-types.js → __tests__/data/types/foo-type.js} +0 -0
  116. package/dist/src/__tests__/data/types/preserve-typing.raw.d.ts +8 -0
  117. package/dist/src/__tests__/data/types/preserve-typing.raw.jsx +6 -0
  118. package/dist/src/__tests__/data/types/type-dependency.raw.d.ts +7 -0
  119. package/dist/src/__tests__/data/types/type-dependency.raw.jsx +6 -0
  120. package/dist/src/__tests__/data/types/type-export.lite.d.ts +3 -0
  121. package/dist/src/__tests__/data/types/type-export.lite.jsx +6 -0
  122. package/dist/src/__tests__/hash-code.test.d.ts +1 -0
  123. package/dist/src/__tests__/hash-code.test.js +11 -0
  124. package/dist/src/__tests__/html.test.js +2 -139
  125. package/dist/src/__tests__/liquid.test.js +2 -103
  126. package/dist/src/__tests__/lit.test.d.ts +1 -0
  127. package/dist/src/__tests__/lit.test.js +7 -0
  128. package/dist/src/__tests__/marko.test.d.ts +1 -0
  129. package/dist/src/__tests__/marko.test.js +14 -0
  130. package/dist/src/__tests__/parse-jsx.test.js +22 -0
  131. package/dist/src/__tests__/qwik/convert-method-to-function.test.d.ts +1 -0
  132. package/dist/src/__tests__/qwik/convert-method-to-function.test.js +37 -0
  133. package/dist/src/__tests__/qwik/src-generator.test.d.ts +1 -0
  134. package/dist/src/__tests__/qwik/src-generator.test.js +65 -0
  135. package/dist/src/__tests__/qwik.directive.test.js +1 -0
  136. package/dist/src/__tests__/qwik.test.js +54 -23
  137. package/dist/src/__tests__/react-native.test.js +3 -136
  138. package/dist/src/__tests__/react.test.js +9 -172
  139. package/dist/src/__tests__/shared.d.ts +3 -0
  140. package/dist/src/__tests__/shared.js +305 -0
  141. package/dist/src/__tests__/solid.test.js +5 -103
  142. package/dist/src/__tests__/stencil.test.js +3 -98
  143. package/dist/src/__tests__/styles.test.d.ts +1 -0
  144. package/dist/src/__tests__/styles.test.js +23 -0
  145. package/dist/src/__tests__/svelte.test.js +3 -66
  146. package/dist/src/__tests__/vue.test.js +2 -134
  147. package/dist/src/__tests__/webcomponent.test.js +6 -159
  148. package/dist/src/constants/hooks.d.ts +6 -0
  149. package/dist/src/constants/hooks.js +9 -0
  150. package/dist/src/flow.d.ts +1 -0
  151. package/dist/src/flow.js +2 -2
  152. package/dist/src/generators/angular.d.ts +4 -1
  153. package/dist/src/generators/angular.js +164 -69
  154. package/dist/src/generators/builder.d.ts +2 -2
  155. package/dist/src/generators/builder.js +26 -29
  156. package/dist/src/generators/context/{react copy.d.ts → qwik.d.ts} +2 -2
  157. package/dist/src/generators/context/{react copy.js → qwik.js} +4 -5
  158. package/dist/src/generators/context/react.js +1 -1
  159. package/dist/src/generators/context/solid.js +1 -1
  160. package/dist/src/generators/context/svelte.d.ts +1 -1
  161. package/dist/src/generators/context/svelte.js +1 -1
  162. package/dist/src/generators/helpers/context.js +1 -2
  163. package/dist/src/generators/html.d.ts +1 -1
  164. package/dist/src/generators/html.js +262 -133
  165. package/dist/src/generators/liquid.d.ts +1 -1
  166. package/dist/src/generators/liquid.js +18 -25
  167. package/dist/src/generators/lit/collect-class-string.d.ts +2 -0
  168. package/dist/src/generators/lit/collect-class-string.js +43 -0
  169. package/dist/src/generators/lit/generate.d.ts +4 -0
  170. package/dist/src/generators/lit/generate.js +203 -0
  171. package/dist/src/generators/lit/index.d.ts +1 -0
  172. package/dist/src/generators/lit/index.js +17 -0
  173. package/dist/src/generators/marko/generate.d.ts +21 -0
  174. package/dist/src/generators/marko/generate.js +301 -0
  175. package/dist/src/generators/marko/index.d.ts +1 -0
  176. package/dist/src/generators/marko/index.js +17 -0
  177. package/dist/src/generators/mitosis.d.ts +1 -1
  178. package/dist/src/generators/mitosis.js +39 -34
  179. package/dist/src/generators/qwik/add-prevent-default.d.ts +7 -0
  180. package/dist/src/generators/qwik/add-prevent-default.js +32 -0
  181. package/dist/src/generators/qwik/component-generator.d.ts +4 -0
  182. package/dist/src/generators/qwik/component-generator.js +304 -0
  183. package/dist/src/generators/qwik/component.d.ts +1 -0
  184. package/dist/src/generators/qwik/component.js +68 -36
  185. package/dist/src/generators/qwik/convert-method-to-function.d.ts +1 -0
  186. package/dist/src/generators/qwik/convert-method-to-function.js +162 -0
  187. package/dist/src/generators/qwik/directives.js +43 -23
  188. package/dist/src/generators/qwik/handlers.js +6 -22
  189. package/dist/src/generators/qwik/index.d.ts +3 -1
  190. package/dist/src/generators/qwik/index.js +3 -1
  191. package/dist/src/generators/qwik/jsx.d.ts +12 -0
  192. package/dist/src/generators/qwik/jsx.js +81 -24
  193. package/dist/src/generators/qwik/src-generator.d.ts +21 -8
  194. package/dist/src/generators/qwik/src-generator.js +177 -43
  195. package/dist/src/generators/qwik/styles.js +3 -3
  196. package/dist/src/generators/react-native.d.ts +2 -2
  197. package/dist/src/generators/react-native.js +8 -10
  198. package/dist/src/generators/react.d.ts +7 -3
  199. package/dist/src/generators/react.js +151 -96
  200. package/dist/src/generators/solid.d.ts +3 -2
  201. package/dist/src/generators/solid.js +79 -52
  202. package/dist/src/generators/stencil/collect-class-string.d.ts +1 -1
  203. package/dist/src/generators/stencil/collect-class-string.js +10 -11
  204. package/dist/src/generators/stencil/generate.d.ts +1 -1
  205. package/dist/src/generators/stencil/generate.js +16 -31
  206. package/dist/src/generators/svelte.d.ts +2 -2
  207. package/dist/src/generators/svelte.js +149 -89
  208. package/dist/src/generators/swift-ui.d.ts +1 -1
  209. package/dist/src/generators/swift-ui.js +19 -20
  210. package/dist/src/generators/template.d.ts +1 -1
  211. package/dist/src/generators/template.js +11 -18
  212. package/dist/src/generators/vue.d.ts +17 -9
  213. package/dist/src/generators/vue.js +208 -99
  214. package/dist/src/helpers/babel-transform.js +6 -10
  215. package/dist/src/helpers/create-mitosis-component.d.ts +1 -1
  216. package/dist/src/helpers/create-mitosis-component.js +1 -1
  217. package/dist/src/helpers/create-mitosis-node.js +1 -1
  218. package/dist/src/helpers/fast-clone.js +1 -3
  219. package/dist/src/helpers/filter-empty-text-nodes.js +1 -2
  220. package/dist/src/helpers/get-bindings.d.ts +2 -0
  221. package/dist/src/helpers/get-bindings.js +18 -0
  222. package/dist/src/helpers/get-custom-imports.d.ts +15 -0
  223. package/dist/src/helpers/get-custom-imports.js +34 -0
  224. package/dist/src/helpers/get-prop-functions.d.ts +5 -0
  225. package/dist/src/helpers/get-prop-functions.js +29 -0
  226. package/dist/src/helpers/get-props-ref.d.ts +2 -0
  227. package/dist/src/helpers/get-props-ref.js +32 -0
  228. package/dist/src/helpers/get-refs.js +3 -2
  229. package/dist/src/helpers/get-state-object-string.d.ts +6 -4
  230. package/dist/src/helpers/get-state-object-string.js +37 -27
  231. package/dist/src/helpers/get-styles.js +4 -3
  232. package/dist/src/helpers/getters-to-functions.d.ts +1 -1
  233. package/dist/src/helpers/getters-to-functions.js +3 -2
  234. package/dist/src/helpers/handle-missing-state.js +1 -1
  235. package/dist/src/helpers/has-bindings-text.d.ts +2 -0
  236. package/dist/src/helpers/has-bindings-text.js +21 -0
  237. package/dist/src/helpers/has-stateful-dom.d.ts +2 -0
  238. package/dist/src/helpers/has-stateful-dom.js +21 -0
  239. package/dist/src/helpers/has.d.ts +9 -0
  240. package/dist/src/helpers/has.js +27 -0
  241. package/dist/src/helpers/is-children.js +3 -1
  242. package/dist/src/helpers/is-component.js +1 -3
  243. package/dist/src/helpers/is-html-attribute.d.ts +4 -0
  244. package/dist/src/helpers/is-html-attribute.js +380 -0
  245. package/dist/src/helpers/json.d.ts +3 -1
  246. package/dist/src/helpers/map-refs.js +39 -14
  247. package/dist/src/helpers/parsers.js +1 -2
  248. package/dist/src/helpers/process-http-requests.js +1 -1
  249. package/dist/src/helpers/render-imports.d.ts +20 -2
  250. package/dist/src/helpers/render-imports.js +101 -45
  251. package/dist/src/helpers/render-imports.test.d.ts +1 -0
  252. package/dist/src/helpers/render-imports.test.js +33 -0
  253. package/dist/src/helpers/replace-idenifiers.js +2 -5
  254. package/dist/src/helpers/slots.d.ts +2 -0
  255. package/dist/src/helpers/slots.js +8 -0
  256. package/dist/src/helpers/state.d.ts +4 -0
  257. package/dist/src/helpers/state.js +16 -0
  258. package/dist/src/helpers/strip-state-and-props-refs.d.ts +4 -1
  259. package/dist/src/helpers/strip-state-and-props-refs.js +36 -10
  260. package/dist/src/helpers/styles/collect-css.d.ts +6 -0
  261. package/dist/src/helpers/styles/collect-css.js +87 -0
  262. package/dist/src/helpers/styles/collect-css.test.d.ts +1 -0
  263. package/dist/src/helpers/styles/collect-css.test.js +18 -0
  264. package/dist/src/helpers/styles/collect-styled-components.d.ts +2 -0
  265. package/dist/src/helpers/styles/collect-styled-components.js +61 -0
  266. package/dist/src/helpers/styles/helpers.d.ts +32 -0
  267. package/dist/src/helpers/styles/helpers.js +80 -0
  268. package/dist/src/helpers/typescript.d.ts +5 -0
  269. package/dist/src/helpers/typescript.js +2 -0
  270. package/dist/src/index.d.ts +9 -4
  271. package/dist/src/index.js +26 -8
  272. package/dist/src/modules/plugins.d.ts +1 -1
  273. package/dist/src/parsers/angular.js +22 -34
  274. package/dist/src/parsers/builder.d.ts +28 -29
  275. package/dist/src/parsers/builder.js +99 -85
  276. package/dist/src/parsers/jsx/ast.d.ts +3 -0
  277. package/dist/src/parsers/jsx/ast.js +74 -0
  278. package/dist/src/parsers/jsx/component-types.d.ts +6 -0
  279. package/dist/src/parsers/jsx/component-types.js +88 -0
  280. package/dist/src/parsers/jsx/context.d.ts +6 -0
  281. package/dist/src/parsers/jsx/context.js +68 -0
  282. package/dist/src/parsers/jsx/helpers.d.ts +3 -0
  283. package/dist/src/parsers/jsx/helpers.js +36 -0
  284. package/dist/src/parsers/jsx/index.d.ts +4 -0
  285. package/dist/src/parsers/jsx/index.js +25 -0
  286. package/dist/src/parsers/jsx/jsx.d.ts +10 -0
  287. package/dist/src/parsers/{jsx.js → jsx/jsx.js} +227 -338
  288. package/dist/src/parsers/jsx/metadata.d.ts +12 -0
  289. package/dist/src/parsers/jsx/metadata.js +70 -0
  290. package/dist/src/parsers/jsx/props.d.ts +2 -0
  291. package/dist/src/parsers/jsx/props.js +72 -0
  292. package/dist/src/parsers/jsx/state.d.ts +13 -0
  293. package/dist/src/parsers/jsx/state.js +161 -0
  294. package/dist/src/parsers/jsx/types.d.ts +11 -0
  295. package/dist/src/parsers/jsx/types.js +2 -0
  296. package/dist/src/parsers/liquid.js +51 -149
  297. package/dist/src/plugins/compile-away-builder-components.js +161 -116
  298. package/dist/src/symbols/symbol-processor.d.ts +2 -0
  299. package/dist/src/symbols/symbol-processor.js +55 -17
  300. package/dist/src/targets.d.ts +11 -6
  301. package/dist/src/targets.js +13 -1
  302. package/dist/src/types/config.d.ts +37 -17
  303. package/dist/src/types/json.d.ts +5 -2
  304. package/dist/src/types/mitosis-component.d.ts +38 -11
  305. package/dist/src/types/mitosis-node.d.ts +7 -1
  306. package/dist/src/types/transpiler.d.ts +14 -0
  307. package/dist/src/types/transpiler.js +2 -0
  308. package/dist/test/qwik/Accordion/low.jsx +45 -12
  309. package/dist/test/qwik/Accordion/med.jsx +2 -8
  310. package/dist/test/qwik/For/low.jsx +46 -27
  311. package/dist/test/qwik/For/med.jsx +2 -8
  312. package/dist/test/qwik/Image/high.js +1 -1
  313. package/dist/test/qwik/Image/med.js +24 -18
  314. package/dist/test/qwik/Image.slow/high.js +1 -1
  315. package/dist/test/qwik/Image.slow/med.js +24 -18
  316. package/dist/test/qwik/bindings/low.cjs +16 -4
  317. package/dist/test/qwik/bindings/med.cjs +1 -10
  318. package/dist/test/qwik/button/high.js +1 -1
  319. package/dist/test/qwik/button/low.js +18 -4
  320. package/dist/test/qwik/button/med.js +4 -10
  321. package/dist/test/qwik/component/bindings/low.jsx +72 -11
  322. package/dist/test/qwik/component/bindings/med.jsx +3 -49
  323. package/dist/test/qwik/component/component/inputs/high.cjsx +1 -1
  324. package/dist/test/qwik/component/component/inputs/med.cjsx +18 -15
  325. package/dist/test/qwik/for-loop.bindings/high.cjs +0 -0
  326. package/dist/test/qwik/for-loop.bindings/low.cjs +56 -0
  327. package/dist/test/qwik/for-loop.bindings/med.cjs +5 -0
  328. package/dist/test/qwik/hello_world/stylesheet/low.jsx +17 -3
  329. package/dist/test/qwik/hello_world/stylesheet/med.jsx +2 -8
  330. package/dist/test/qwik/mount/high.cjs +0 -0
  331. package/dist/test/qwik/mount/low.cjs +47 -0
  332. package/dist/test/qwik/mount/med.cjs +3 -0
  333. package/dist/test/qwik/page-with-symbol/low.js +17 -3
  334. package/dist/test/qwik/page-with-symbol/med.js +2 -8
  335. package/dist/test/qwik/show-hide/high.jsx +1 -1
  336. package/dist/test/qwik/show-hide/med.jsx +28 -21
  337. package/dist/test/qwik/svg/low.js +22 -5
  338. package/dist/test/qwik/svg/med.js +2 -8
  339. package/dist/test/qwik/todo/Todo.cjs/high.cjs +6 -10
  340. package/dist/test/qwik/todo/Todo.cjs/med.cjs +18 -15
  341. package/dist/test/qwik/todo/Todo.js/high.js +7 -10
  342. package/dist/test/qwik/todo/Todo.js/med.js +17 -15
  343. package/dist/test/qwik/todo/Todo.tsx/high.tsx +7 -10
  344. package/dist/test/qwik/todo/Todo.tsx/med.tsx +17 -15
  345. package/dist/test/qwik/todos/Todo.tsx/high.tsx +1 -1
  346. package/dist/test/qwik/todos/Todo.tsx/low.tsx +18 -13
  347. package/dist/test/qwik/todos/Todo.tsx/med.tsx +1 -6
  348. package/dist/tsconfig.build.tsbuildinfo +1 -1
  349. package/dist/tsconfig.tsbuildinfo +1 -1
  350. package/jsx-runtime.d.ts +2133 -0
  351. package/package.json +20 -8
  352. package/README.md +0 -239
  353. package/dist/src/__tests__/data/blocks/content-slot.raw.d.ts +0 -6
  354. package/dist/src/__tests__/data/blocks/content-slot.raw.jsx +0 -13
  355. package/dist/src/__tests__/data/blocks/onUpdate.raw copy.d.ts +0 -1
  356. package/dist/src/__tests__/data/blocks/onUpdate.raw copy.jsx +0 -10
  357. package/dist/src/__tests__/data/blocks/slot.raw.d.ts +0 -5
  358. package/dist/src/__tests__/data/blocks/slot.raw.jsx +0 -6
  359. package/dist/src/__tests__/data/blocks/styles.raw.d.ts +0 -1
  360. package/dist/src/__tests__/data/blocks/styles.raw.jsx +0 -10
  361. package/dist/src/helpers/babel-transform copy.d.ts +0 -8
  362. package/dist/src/helpers/babel-transform copy.js +0 -138
  363. package/dist/src/helpers/collect-styles.d.ts +0 -35
  364. package/dist/src/helpers/collect-styles.js +0 -178
  365. package/dist/src/jsx-types.d.ts +0 -1171
  366. package/dist/src/parsers/jsx.d.ts +0 -20
@@ -1,72 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var angular_1 = require("../generators/angular");
4
- var jsx_1 = require("../parsers/jsx");
5
- var multipleOnUpdate = require('./data/blocks/multiple-onUpdate.raw');
6
- var onUpdate = require('./data/blocks/onUpdate.raw');
7
- var onMount = require('./data/blocks/onMount.raw');
8
- var onInitonMount = require('./data/blocks/onInit-onMount.raw');
9
- var onInit = require('./data/blocks/onInit.raw');
10
- var basicFor = require('./data/basic-for.raw');
11
- var basicOutputs = require('./data/basic-outputs.raw');
12
- var contentSlotHtml = require('./data/blocks/content-slot-html.raw');
13
- var contentSlotJsx = require('./data/blocks/content-slot-jsx.raw');
14
- var slotJsx = require('./data/blocks/slot-jsx.raw');
15
- // const slotHtml = require('./data/blocks/slot-html.raw');
4
+ var shared_1 = require("./shared");
16
5
  describe('Angular', function () {
17
- test('basic outputs', function () {
18
- var component = (0, jsx_1.parseJsx)(basicOutputs);
19
- var output = (0, angular_1.componentToAngular)()({ component: component });
20
- expect(output).toMatchSnapshot();
21
- });
22
- test('multiple onUpdate', function () {
23
- var component = (0, jsx_1.parseJsx)(multipleOnUpdate);
24
- var output = (0, angular_1.componentToAngular)()({ component: component });
25
- expect(output).toMatchSnapshot();
26
- });
27
- test('onUpdate', function () {
28
- var component = (0, jsx_1.parseJsx)(onUpdate);
29
- var output = (0, angular_1.componentToAngular)()({ component: component });
30
- expect(output).toMatchSnapshot();
31
- });
32
- test('onMount', function () {
33
- var component = (0, jsx_1.parseJsx)(onMount);
34
- var output = (0, angular_1.componentToAngular)()({ component: component });
35
- expect(output).toMatchSnapshot();
36
- });
37
- test('onInit and onMount', function () {
38
- var component = (0, jsx_1.parseJsx)(onInitonMount);
39
- var output = (0, angular_1.componentToAngular)()({ component: component });
40
- expect(output).toMatchSnapshot();
41
- });
42
- test('onInit', function () {
43
- var component = (0, jsx_1.parseJsx)(onInit);
44
- var output = (0, angular_1.componentToAngular)()({ component: component });
45
- expect(output).toMatchSnapshot();
46
- });
47
- test('BasicFor', function () {
48
- var component = (0, jsx_1.parseJsx)(basicFor);
49
- var output = (0, angular_1.componentToAngular)()({ component: component });
50
- expect(output).toMatchSnapshot();
51
- });
52
- test('ng-content and Slot', function () {
53
- var component = (0, jsx_1.parseJsx)(contentSlotHtml);
54
- var output = (0, angular_1.componentToAngular)()({ component: component });
55
- expect(output).toMatchSnapshot();
56
- });
57
- test('ng-content and Slot jsx-props', function () {
58
- var component = (0, jsx_1.parseJsx)(contentSlotJsx);
59
- var output = (0, angular_1.componentToAngular)()({ component: component });
60
- expect(output).toMatchSnapshot();
61
- });
62
- test('Slot Jsx', function () {
63
- var component = (0, jsx_1.parseJsx)(slotJsx);
64
- var output = (0, angular_1.componentToAngular)()({ component: component });
65
- expect(output).toMatchSnapshot();
66
- });
67
- // test('Slot Html', () => {
68
- // const component = parseJsx(slotHtml);
69
- // const output = componentToAngular()({ component });
70
- // expect(output).toMatchSnapshot();
71
- // });
6
+ (0, shared_1.runTestsForTarget)('angular', (0, angular_1.componentToAngular)());
7
+ (0, shared_1.runTestsForTarget)('angular', (0, angular_1.componentToAngular)({
8
+ standalone: true,
9
+ }));
72
10
  });
@@ -160,7 +160,7 @@ describe('Builder', function () {
160
160
  });
161
161
  }); });
162
162
  test('Regenerate Image', function () {
163
- var code = (0, dedent_1.default)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n import { useState } from \"@builder.io/mitosis\";\n import { Image } from \"@components\";\n\n export default function MyComponent(props) {\n const state = useState({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <div\n css={{\n padding: \"20px\",\n }}\n >\n <Image\n image=\"https://cdn.builder.io/api/v1/image/foobar\"\n sizes=\"100vw\"\n backgroundSize=\"contain\"\n css={{\n marignTop: \"50px\",\n display: \"block\",\n }}\n />\n </div>\n );\n }\n "], ["\n import { useState } from \"@builder.io/mitosis\";\n import { Image } from \"@components\";\n\n export default function MyComponent(props) {\n const state = useState({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <div\n css={{\n padding: \"20px\",\n }}\n >\n <Image\n image=\"https://cdn.builder.io/api/v1/image/foobar\"\n sizes=\"100vw\"\n backgroundSize=\"contain\"\n css={{\n marignTop: \"50px\",\n display: \"block\",\n }}\n />\n </div>\n );\n }\n "])));
163
+ var code = (0, dedent_1.default)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n import { useStore } from \"@builder.io/mitosis\";\n import { Image } from \"@components\";\n\n export default function MyComponent(props) {\n const state = useStore({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <div\n css={{\n padding: \"20px\",\n }}\n >\n <Image\n image=\"https://cdn.builder.io/api/v1/image/foobar\"\n sizes=\"100vw\"\n backgroundSize=\"contain\"\n css={{\n marignTop: \"50px\",\n display: \"block\",\n }}\n />\n </div>\n );\n }\n "], ["\n import { useStore } from \"@builder.io/mitosis\";\n import { Image } from \"@components\";\n\n export default function MyComponent(props) {\n const state = useStore({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <div\n css={{\n padding: \"20px\",\n }}\n >\n <Image\n image=\"https://cdn.builder.io/api/v1/image/foobar\"\n sizes=\"100vw\"\n backgroundSize=\"contain\"\n css={{\n marignTop: \"50px\",\n display: \"block\",\n }}\n />\n </div>\n );\n }\n "])));
164
164
  var component = (0, jsx_1.parseJsx)(code);
165
165
  var builderJson = (0, builder_1.componentToBuilder)()({ component: component });
166
166
  var backToMitosis = (0, builder_2.builderContentToMitosisComponent)(builderJson);
@@ -174,7 +174,7 @@ describe('Builder', function () {
174
174
  expect(react).toMatchSnapshot();
175
175
  });
176
176
  test('Regenerate Text', function () {
177
- var code = (0, dedent_1.default)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n import { useState } from \"@builder.io/mitosis\";\n\n export default function MyComponent(props) {\n const state = useState({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <div\n css={{\n padding: \"20px\",\n }}\n >\n <h2\n css={{\n marginBottom: \"20px\",\n }}\n >\n Hello!\n </h2>\n </div>\n );\n }\n "], ["\n import { useState } from \"@builder.io/mitosis\";\n\n export default function MyComponent(props) {\n const state = useState({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <div\n css={{\n padding: \"20px\",\n }}\n >\n <h2\n css={{\n marginBottom: \"20px\",\n }}\n >\n Hello!\n </h2>\n </div>\n );\n }\n "])));
177
+ var code = (0, dedent_1.default)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n import { useStore } from \"@builder.io/mitosis\";\n\n export default function MyComponent(props) {\n const state = useStore({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <div\n css={{\n padding: \"20px\",\n }}\n >\n <h2\n css={{\n marginBottom: \"20px\",\n }}\n >\n Hello!\n </h2>\n </div>\n );\n }\n "], ["\n import { useStore } from \"@builder.io/mitosis\";\n\n export default function MyComponent(props) {\n const state = useStore({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <div\n css={{\n padding: \"20px\",\n }}\n >\n <h2\n css={{\n marginBottom: \"20px\",\n }}\n >\n Hello!\n </h2>\n </div>\n );\n }\n "])));
178
178
  var component = (0, jsx_1.parseJsx)(code);
179
179
  var builderJson = (0, builder_1.componentToBuilder)()({ component: component });
180
180
  var backToMitosis = (0, builder_2.builderContentToMitosisComponent)(builderJson);
@@ -184,7 +184,7 @@ describe('Builder', function () {
184
184
  expect(mitosis.trim()).toEqual(code.trim());
185
185
  });
186
186
  test('Regenerate loop', function () {
187
- var code = (0, dedent_1.default)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n import { useState, For } from \"@builder.io/mitosis\";\n\n export default function MyComponent(props) {\n const state = useState({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <For each={state.people}>\n {(person, index) => (\n <div\n key={person}\n css={{\n padding: \"10px 0\",\n }}\n >\n <span>{person}</span>\n <span>{index}</span>\n </div>\n )}\n </For>\n );\n }\n "], ["\n import { useState, For } from \"@builder.io/mitosis\";\n\n export default function MyComponent(props) {\n const state = useState({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <For each={state.people}>\n {(person, index) => (\n <div\n key={person}\n css={{\n padding: \"10px 0\",\n }}\n >\n <span>{person}</span>\n <span>{index}</span>\n </div>\n )}\n </For>\n );\n }\n "])));
187
+ var code = (0, dedent_1.default)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n import { useStore, For } from \"@builder.io/mitosis\";\n\n export default function MyComponent(props) {\n const state = useStore({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <For each={state.people}>\n {(person, index) => (\n <div\n key={person}\n css={{\n padding: \"10px 0\",\n }}\n >\n <span>{person}</span>\n <span>{index}</span>\n </div>\n )}\n </For>\n );\n }\n "], ["\n import { useStore, For } from \"@builder.io/mitosis\";\n\n export default function MyComponent(props) {\n const state = useStore({ people: [\"Steve\", \"Sewell\"] });\n\n return (\n <For each={state.people}>\n {(person, index) => (\n <div\n key={person}\n css={{\n padding: \"10px 0\",\n }}\n >\n <span>{person}</span>\n <span>{index}</span>\n </div>\n )}\n </For>\n );\n }\n "])));
188
188
  var component = (0, jsx_1.parseJsx)(code);
189
189
  var builderJson = (0, builder_1.componentToBuilder)()({ component: component });
190
190
  var backToMitosis = (0, builder_2.builderContentToMitosisComponent)(builderJson);
@@ -0,0 +1,4 @@
1
+ export interface Props {
2
+ showInput: boolean;
3
+ }
4
+ export default function MyBasicRefComponent(props: Props): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mitosis_1 = require("@builder.io/mitosis");
4
+ function MyBasicRefComponent(props) {
5
+ var inputRef = (0, mitosis_1.useRef)(null);
6
+ var inputNoArgRef = (0, mitosis_1.useRef)(null);
7
+ var state = (0, mitosis_1.useStore)({
8
+ name: 'PatrickJS',
9
+ });
10
+ function onBlur() {
11
+ // Maintain focus
12
+ inputRef.focus();
13
+ }
14
+ function lowerCaseName() {
15
+ return state.name.toLowerCase();
16
+ }
17
+ (0, mitosis_1.onUpdate)(function () {
18
+ console.log('Received an update');
19
+ }, [inputRef, inputNoArgRef]);
20
+ return (<div>
21
+ {props.showInput && (<>
22
+ <input ref={inputRef} css={{
23
+ color: 'red',
24
+ }} value={state.name} onBlur={function (event) { return onBlur(); }} onChange={function (event) { return (state.name = event.target.value); }}/>
25
+
26
+ <label ref={inputNoArgRef} for="cars">
27
+ Choose a car:
28
+ </label>
29
+
30
+ <select name="cars" id="cars">
31
+ <option value="supra">GR Supra</option>
32
+ <option value="86">GR 86</option>
33
+ </select>
34
+ </>)}
35
+ Hello
36
+ {lowerCaseName()}! I can run in React, Qwik, Vue, Solid, or Web Component!
37
+ </div>);
38
+ }
39
+ exports.default = MyBasicRefComponent;
@@ -0,0 +1 @@
1
+ export default function MyBasicChildComponent(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var mitosis_1 = require("@builder.io/mitosis");
7
+ var basic_raw_1 = __importDefault(require("./basic.raw"));
8
+ var basic_onMount_update_raw_1 = __importDefault(require("./basic-onMount-update.raw"));
9
+ function MyBasicChildComponent() {
10
+ var state = (0, mitosis_1.useStore)({
11
+ name: 'Steve',
12
+ dev: 'PatrickJS',
13
+ });
14
+ return (<div>
15
+ <basic_raw_1.default id={state.dev}/>
16
+ <div>
17
+ <basic_onMount_update_raw_1.default hi={state.name} bye={state.dev}/>
18
+ </div>
19
+ </div>);
20
+ }
21
+ exports.default = MyBasicChildComponent;
@@ -0,0 +1 @@
1
+ export default function MyBasicComponent(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mitosis_1 = require("@builder.io/mitosis");
4
+ var injection_js_1 = require("@dummy/injection-js");
5
+ function MyBasicComponent() {
6
+ (0, mitosis_1.setContext)(injection_js_1.Injector, (0, injection_js_1.createInjector)());
7
+ var myService = (0, mitosis_1.useContext)(injection_js_1.MyService);
8
+ var state = (0, mitosis_1.useStore)({
9
+ name: 'PatrickJS',
10
+ });
11
+ (0, mitosis_1.onInit)(function () {
12
+ var hi = myService.method('hi');
13
+ console.log(hi);
14
+ });
15
+ (0, mitosis_1.onMount)(function () {
16
+ var bye = myService.method('hi');
17
+ console.log(bye);
18
+ });
19
+ function onChange() {
20
+ var change = myService.method('change');
21
+ console.log(change);
22
+ }
23
+ return (<div>
24
+ {myService.method('hello') + state.name}
25
+ Hello! I can run in React, Vue, Solid, or Liquid!
26
+ <input onChange={onChange}></input>
27
+ </div>);
28
+ }
29
+ exports.default = MyBasicComponent;
@@ -0,0 +1 @@
1
+ export default function MyBasicComponent(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var custom_mitosis_1 = require("@dummy/custom-mitosis");
4
+ function MyBasicComponent() {
5
+ var state = (0, custom_mitosis_1.useStore)({
6
+ name: 'PatrickJS',
7
+ });
8
+ return <div>Hello {state.name}! I can run in React, Qwik, Vue, Solid, or Liquid!</div>;
9
+ }
10
+ exports.default = MyBasicComponent;
@@ -1 +1 @@
1
- export default function MyBasicForShowComponent(): JSX.Element;
1
+ export default function MyBasicForShowComponent(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var mitosis_1 = require("@builder.io/mitosis");
4
4
  function MyBasicForShowComponent() {
5
- var state = (0, mitosis_1.useState)({
5
+ var state = (0, mitosis_1.useStore)({
6
6
  name: 'PatrickJS',
7
7
  names: ['Steve', 'PatrickJS'],
8
8
  });
@@ -12,8 +12,7 @@ function MyBasicForShowComponent() {
12
12
  <input value={state.name} onChange={function (event) {
13
13
  state.name = event.target.value + ' and ' + person;
14
14
  }}/>
15
- Hello {person}! I can run in Qwik, Web Component, React, Vue, Solid,
16
- or Liquid!
15
+ Hello {person}! I can run in Qwik, Web Component, React, Vue, Solid, or Liquid!
17
16
  </mitosis_1.Show>); }}
18
17
  </mitosis_1.For>
19
18
  </div>);
@@ -1 +1 @@
1
- export default function MyBasicForComponent(): JSX.Element;
1
+ export default function MyBasicForComponent(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var mitosis_1 = require("@builder.io/mitosis");
4
4
  function MyBasicForComponent() {
5
- var state = (0, mitosis_1.useState)({
5
+ var state = (0, mitosis_1.useStore)({
6
6
  name: 'PatrickJS',
7
7
  names: ['Steve', 'PatrickJS'],
8
8
  });
@@ -15,8 +15,7 @@ function MyBasicForComponent() {
15
15
  <input value={state.name} onChange={function (event) {
16
16
  state.name = event.target.value + ' and ' + person;
17
17
  }}/>
18
- Hello {person}! I can run in Qwik, Web Component, React, Vue, Solid,
19
- or Liquid!
18
+ Hello {person}! I can run in Qwik, Web Component, React, Vue, Solid, or Liquid!
20
19
  </>); }}
21
20
  </mitosis_1.For>
22
21
  </div>);
@@ -0,0 +1,5 @@
1
+ export interface Props {
2
+ showInput: boolean;
3
+ inputRef: HTMLInputElement;
4
+ }
5
+ export default function MyBasicForwardRefComponent(props: Props): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mitosis_1 = require("@builder.io/mitosis");
4
+ (0, mitosis_1.useMetadata)({
5
+ forwardRef: 'inputRef',
6
+ });
7
+ function MyBasicForwardRefComponent(props) {
8
+ var state = (0, mitosis_1.useStore)({
9
+ name: 'PatrickJS',
10
+ });
11
+ return (<div>
12
+ <input ref={props.inputRef} css={{
13
+ color: 'red',
14
+ }} value={state.name} onChange={function (event) { return (state.name = event.target.value); }}/>
15
+ </div>);
16
+ }
17
+ exports.default = MyBasicForwardRefComponent;
@@ -0,0 +1,5 @@
1
+ export interface Props {
2
+ showInput: boolean;
3
+ inputRef: HTMLInputElement;
4
+ }
5
+ export default function MyBasicForwardRefComponent(props: Props): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mitosis_1 = require("@builder.io/mitosis");
4
+ function MyBasicForwardRefComponent(props) {
5
+ var state = (0, mitosis_1.useStore)({
6
+ name: 'PatrickJS',
7
+ });
8
+ return (<div>
9
+ <input ref={props.inputRef} css={{
10
+ color: 'red',
11
+ }} value={state.name} onChange={function (event) { return (state.name = event.target.value); }}/>
12
+ </div>);
13
+ }
14
+ exports.default = MyBasicForwardRefComponent;
@@ -0,0 +1 @@
1
+ export default function MyBasicComponent(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mitosis_1 = require("@builder.io/mitosis");
4
+ function MyBasicComponent() {
5
+ var state = (0, mitosis_1.useStore)({
6
+ name: 'Steve',
7
+ });
8
+ return (<div class="test" css={{
9
+ padding: '10px',
10
+ }}>
11
+ <input value={state.name} onChange={function (myEvent) {
12
+ state.name = myEvent.target.value;
13
+ }}/>
14
+ Hello! I can run in React, Vue, Solid, or Liquid!
15
+ </div>);
16
+ }
17
+ exports.default = MyBasicComponent;
@@ -1 +1,5 @@
1
- export default function MyBasicOnMountUpdateComponent(): JSX.Element;
1
+ export interface Props {
2
+ hi: string;
3
+ bye: string;
4
+ }
5
+ export default function MyBasicOnMountUpdateComponent(props: Props): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var mitosis_1 = require("@builder.io/mitosis");
4
- function MyBasicOnMountUpdateComponent() {
5
- var state = (0, mitosis_1.useState)({
4
+ function MyBasicOnMountUpdateComponent(props) {
5
+ var state = (0, mitosis_1.useStore)({
6
6
  name: 'PatrickJS',
7
7
  names: ['Steve', 'PatrickJS'],
8
8
  });
9
9
  (0, mitosis_1.onInit)(function () {
10
- state.name = 'PatrickJS onInit';
10
+ state.name = 'PatrickJS onInit' + props.hi;
11
11
  });
12
12
  (0, mitosis_1.onMount)(function () {
13
- state.name = 'PatrickJS onMount';
13
+ state.name = 'PatrickJS onMount' + props.bye;
14
14
  });
15
15
  return <div>Hello {state.name}</div>;
16
16
  }
@@ -0,0 +1 @@
1
+ export default function MyBasicOnUpdateReturnComponent(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mitosis_1 = require("@builder.io/mitosis");
4
+ function MyBasicOnUpdateReturnComponent() {
5
+ var state = (0, mitosis_1.useStore)({
6
+ name: 'PatrickJS',
7
+ });
8
+ (0, mitosis_1.onUpdate)(function () {
9
+ var controller = new AbortController();
10
+ var signal = controller.signal;
11
+ fetch('https://patrickjs.com/api/resource.json', { signal: signal })
12
+ .then(function (response) { return response.json(); })
13
+ .then(function (data) {
14
+ state.name = data.name;
15
+ });
16
+ return function () {
17
+ if (!signal.aborted) {
18
+ controller.abort();
19
+ }
20
+ };
21
+ }, [state.name]);
22
+ return <div>Hello! {state.name}</div>;
23
+ }
24
+ exports.default = MyBasicOnUpdateReturnComponent;
@@ -0,0 +1 @@
1
+ export default function MyBasicOutputsComponent(props: any): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mitosis_1 = require("@builder.io/mitosis");
4
+ (0, mitosis_1.useMetadata)({
5
+ outputs: ['onMessage', 'onEvent'],
6
+ });
7
+ function MyBasicOutputsComponent(props) {
8
+ var state = (0, mitosis_1.useStore)({
9
+ name: 'PatrickJS',
10
+ });
11
+ (0, mitosis_1.onMount)(function () {
12
+ props.onMessage(state.name);
13
+ props.onEvent(props.message);
14
+ });
15
+ return <div></div>;
16
+ }
17
+ exports.default = MyBasicOutputsComponent;
@@ -1 +1 @@
1
- export default function MyBasicOutputsComponent(props: any): JSX.Element;
1
+ export default function MyBasicOutputsComponent(props: any): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var mitosis_1 = require("@builder.io/mitosis");
4
- (0, mitosis_1.useMetadata)({
5
- outputs: ['onMessage', 'onEvent'],
6
- });
7
4
  function MyBasicOutputsComponent(props) {
8
- var state = (0, mitosis_1.useState)({
5
+ var state = (0, mitosis_1.useStore)({
9
6
  name: 'PatrickJS',
10
7
  });
11
8
  (0, mitosis_1.onMount)(function () {
@@ -0,0 +1,6 @@
1
+ export declare const a = 3;
2
+ export declare const bar: () => void;
3
+ export declare function run<T>(value: T): void;
4
+ export default function MyBasicComponent(props: {
5
+ id: string;
6
+ }): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.run = exports.bar = exports.a = void 0;
4
+ var b = 3;
5
+ var foo = function () { };
6
+ exports.a = 3;
7
+ var bar = function () { };
8
+ exports.bar = bar;
9
+ function run(value) { }
10
+ exports.run = run;
11
+ function MyBasicComponent(props) {
12
+ return <div></div>;
13
+ }
14
+ exports.default = MyBasicComponent;
@@ -0,0 +1,6 @@
1
+ declare type Props = {
2
+ children: any;
3
+ type: string;
4
+ };
5
+ export default function MyBasicComponent({ children: c, type }: Props): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mitosis_1 = require("@builder.io/mitosis");
4
+ function MyBasicComponent(_a) {
5
+ var c = _a.children, type = _a.type;
6
+ var state = (0, mitosis_1.useStore)({
7
+ name: 'Decadef20',
8
+ });
9
+ return (<div>
10
+ {c} {type}
11
+ Hello! I can run in React, Vue, Solid, or Liquid!
12
+ </div>);
13
+ }
14
+ exports.default = MyBasicComponent;
@@ -0,0 +1,6 @@
1
+ declare type Props = {
2
+ children: any;
3
+ type: string;
4
+ };
5
+ export default function MyBasicComponent(props: Props): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mitosis_1 = require("@builder.io/mitosis");
4
+ function MyBasicComponent(props) {
5
+ var state = (0, mitosis_1.useStore)({
6
+ name: 'Decadef20',
7
+ });
8
+ return (<div>
9
+ {props.children} {props.type}
10
+ Hello! I can run in React, Vue, Solid, or Liquid!
11
+ </div>);
12
+ }
13
+ exports.default = MyBasicComponent;
@@ -0,0 +1,4 @@
1
+ export interface Props {
2
+ showInput: boolean;
3
+ }
4
+ export default function MyBasicRefAssignmentComponent(props: Props): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mitosis_1 = require("@builder.io/mitosis");
4
+ function MyBasicRefAssignmentComponent(props) {
5
+ var holdValueRef = (0, mitosis_1.useRef)('Patrick');
6
+ function handlerClick(event) {
7
+ event.preventDefault();
8
+ console.log('current value', holdValueRef);
9
+ holdValueRef = holdValueRef + 'JS';
10
+ }
11
+ return (<div>
12
+ <button onClick={function (evt) { return handlerClick(evt); }}>Click</button>
13
+ </div>);
14
+ }
15
+ exports.default = MyBasicRefAssignmentComponent;
@@ -0,0 +1,5 @@
1
+ export interface Props {
2
+ showInput: boolean;
3
+ }
4
+ export declare function usePrevious<T>(value: T): T;
5
+ export default function MyPreviousComponent(props: Props): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.usePrevious = void 0;
4
+ var mitosis_1 = require("@builder.io/mitosis");
5
+ function usePrevious(value) {
6
+ // The ref object is a generic container whose current property is mutable ...
7
+ // ... and can hold any value, similar to an instance property on a class
8
+ var ref = (0, mitosis_1.useRef)(null);
9
+ // Store current value in ref
10
+ (0, mitosis_1.onUpdate)(function () {
11
+ ref = value;
12
+ }, [value]); // Only re-run if value changes
13
+ // Return previous value (happens before update in useEffect above)
14
+ return ref;
15
+ }
16
+ exports.usePrevious = usePrevious;
17
+ function MyPreviousComponent(props) {
18
+ var state = (0, mitosis_1.useStore)({
19
+ count: 0,
20
+ });
21
+ var prevCount = (0, mitosis_1.useRef)(state.count);
22
+ (0, mitosis_1.onUpdate)(function () {
23
+ prevCount = state.count;
24
+ }, [state.count]); //
25
+ // Get the previous value (was passed into hook on last render)
26
+ // const prevCount = usePrevious(state.count);
27
+ // Display both current and previous count value
28
+ return (<div>
29
+ <h1>
30
+ Now: {state.count}, before: {prevCount}
31
+ </h1>
32
+ <button onClick={function () { return (state.count += 1); }}>Increment</button>
33
+ </div>);
34
+ }
35
+ exports.default = MyPreviousComponent;
@@ -0,0 +1,4 @@
1
+ export interface Props {
2
+ showInput: boolean;
3
+ }
4
+ export default function MyBasicRefComponent(props: Props): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mitosis_1 = require("@builder.io/mitosis");
4
+ function MyBasicRefComponent(props) {
5
+ var inputRef = (0, mitosis_1.useRef)(null);
6
+ var inputNoArgRef = (0, mitosis_1.useRef)(null);
7
+ var state = (0, mitosis_1.useStore)({
8
+ name: 'PatrickJS',
9
+ });
10
+ function onBlur() {
11
+ // Maintain focus
12
+ inputRef.focus();
13
+ }
14
+ function lowerCaseName() {
15
+ return state.name.toLowerCase();
16
+ }
17
+ return (<div>
18
+ {props.showInput && (<>
19
+ <input ref={inputRef} css={{
20
+ color: 'red',
21
+ }} value={state.name} onBlur={function (event) { return onBlur(); }} onChange={function (event) { return (state.name = event.target.value); }}/>
22
+
23
+ <label ref={inputNoArgRef} for="cars">
24
+ Choose a car:
25
+ </label>
26
+
27
+ <select name="cars" id="cars">
28
+ <option value="supra">GR Supra</option>
29
+ <option value="86">GR 86</option>
30
+ </select>
31
+ </>)}
32
+ Hello
33
+ {lowerCaseName()}! I can run in React, Qwik, Vue, Solid, or Web Component!
34
+ </div>);
35
+ }
36
+ exports.default = MyBasicRefComponent;