@builder.io/mitosis 0.0.56-99 → 0.0.56

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 (240) hide show
  1. package/dist/src/__tests__/data/blocks/content-slot-jsx.raw.jsx +4 -1
  2. package/dist/src/__tests__/data/blocks/form.raw.jsx +5 -5
  3. package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.d.ts +5 -1
  4. package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.jsx +3 -3
  5. package/dist/src/__tests__/data/jsx-json.spec.d.ts +2 -0
  6. package/dist/src/__tests__/data/jsx-json.spec.js +10226 -0
  7. package/dist/src/__tests__/shared.d.ts +7 -2
  8. package/dist/src/__tests__/shared.js +66 -9
  9. package/dist/src/constants/method-literal-prefix.d.ts +0 -1
  10. package/dist/src/constants/method-literal-prefix.js +0 -3
  11. package/dist/src/generators/angular.d.ts +2 -2
  12. package/dist/src/generators/angular.js +5 -3
  13. package/dist/src/generators/builder.d.ts +4 -11
  14. package/dist/src/generators/builder.js +3 -2
  15. package/dist/src/generators/context/svelte.d.ts +3 -0
  16. package/dist/src/generators/context/svelte.js +3 -0
  17. package/dist/src/generators/helpers/functions.d.ts +2 -0
  18. package/dist/src/generators/helpers/functions.js +28 -0
  19. package/dist/src/generators/html.d.ts +3 -3
  20. package/dist/src/generators/html.js +9 -7
  21. package/dist/src/generators/liquid.d.ts +2 -2
  22. package/dist/src/generators/liquid.js +4 -4
  23. package/dist/src/generators/lit/generate.d.ts +2 -2
  24. package/dist/src/generators/lit/generate.js +3 -2
  25. package/dist/src/generators/marko/generate.d.ts +2 -2
  26. package/dist/src/generators/marko/generate.js +10 -8
  27. package/dist/src/generators/mitosis.d.ts +3 -4
  28. package/dist/src/generators/mitosis.js +3 -2
  29. package/dist/src/generators/qwik/component-generator.d.ts +2 -2
  30. package/dist/src/generators/qwik/component-generator.js +49 -55
  31. package/dist/src/generators/qwik/component.d.ts +0 -1
  32. package/dist/src/generators/qwik/component.js +22 -19
  33. package/dist/src/generators/qwik/directives.d.ts +1 -0
  34. package/dist/src/generators/qwik/directives.js +11 -14
  35. package/dist/src/generators/qwik/jsx.d.ts +1 -1
  36. package/dist/src/generators/qwik/jsx.js +9 -5
  37. package/dist/src/generators/qwik/src-generator.js +9 -3
  38. package/dist/src/generators/qwik/stable-serialize.d.ts +6 -0
  39. package/dist/src/generators/qwik/stable-serialize.js +51 -0
  40. package/dist/src/generators/react/generator.d.ts +6 -0
  41. package/dist/src/generators/{react.js → react/generator.js} +58 -150
  42. package/dist/src/generators/react/helpers.d.ts +2 -0
  43. package/dist/src/generators/react/helpers.js +14 -0
  44. package/dist/src/generators/react/index.d.ts +2 -0
  45. package/dist/src/generators/react/index.js +18 -0
  46. package/dist/src/generators/react/state.d.ts +9 -0
  47. package/dist/src/generators/react/state.js +107 -0
  48. package/dist/src/generators/react/types.d.ts +10 -0
  49. package/dist/src/generators/react/types.js +2 -0
  50. package/dist/src/generators/react-native.d.ts +2 -2
  51. package/dist/src/generators/solid/index.d.ts +3 -0
  52. package/dist/src/generators/{solid.js → solid/index.js} +80 -40
  53. package/dist/src/generators/solid/state.d.ts +19 -0
  54. package/dist/src/generators/solid/state.js +144 -0
  55. package/dist/src/generators/solid/types.d.ts +6 -0
  56. package/dist/src/generators/solid/types.js +2 -0
  57. package/dist/src/generators/stencil/generate.d.ts +2 -2
  58. package/dist/src/generators/stencil/generate.js +5 -2
  59. package/dist/src/generators/svelte.d.ts +6 -7
  60. package/dist/src/generators/svelte.js +43 -40
  61. package/dist/src/generators/swift-ui.d.ts +3 -5
  62. package/dist/src/generators/swift-ui.js +3 -2
  63. package/dist/src/generators/template.d.ts +2 -2
  64. package/dist/src/generators/template.js +3 -2
  65. package/dist/src/generators/vue.d.ts +5 -3
  66. package/dist/src/generators/vue.js +256 -113
  67. package/dist/src/helpers/babel-transform.d.ts +3 -1
  68. package/dist/src/helpers/babel-transform.js +52 -56
  69. package/dist/src/helpers/get-bindings.js +3 -5
  70. package/dist/src/helpers/get-state-object-string.js +24 -21
  71. package/dist/src/helpers/getters-to-functions.js +1 -11
  72. package/dist/src/helpers/map-refs.js +25 -25
  73. package/dist/src/helpers/nodes/for.d.ts +4 -0
  74. package/dist/src/helpers/nodes/for.js +13 -0
  75. package/dist/src/helpers/nullable.d.ts +2 -0
  76. package/dist/src/helpers/nullable.js +7 -0
  77. package/dist/src/helpers/parse-reactive-script.js +66 -78
  78. package/dist/src/helpers/patterns.d.ts +2 -0
  79. package/dist/src/helpers/patterns.js +5 -1
  80. package/dist/src/helpers/render-imports.js +3 -3
  81. package/dist/src/helpers/replace-identifiers.d.ts +5 -0
  82. package/dist/src/helpers/{replace-idenifiers.js → replace-identifiers.js} +2 -1
  83. package/dist/src/helpers/slots.d.ts +2 -0
  84. package/dist/src/helpers/slots.js +15 -1
  85. package/dist/src/helpers/state.d.ts +0 -2
  86. package/dist/src/helpers/state.js +1 -10
  87. package/dist/src/helpers/strip-state-and-props-refs.d.ts +1 -1
  88. package/dist/src/helpers/strip-state-and-props-refs.js +43 -31
  89. package/dist/src/helpers/styles/helpers.d.ts +3 -2
  90. package/dist/src/parsers/angular.js +2 -2
  91. package/dist/src/parsers/builder.d.ts +2 -2
  92. package/dist/src/parsers/builder.js +61 -43
  93. package/dist/src/parsers/constants/outdated-prefixes.d.ts +10 -0
  94. package/dist/src/parsers/constants/outdated-prefixes.js +13 -0
  95. package/dist/src/parsers/context.js +2 -2
  96. package/dist/src/parsers/helpers/state.d.ts +3 -0
  97. package/dist/src/parsers/helpers/state.js +30 -0
  98. package/dist/src/parsers/jsx/component-types.d.ts +1 -1
  99. package/dist/src/parsers/jsx/component-types.js +15 -2
  100. package/dist/src/parsers/jsx/context.js +1 -1
  101. package/dist/src/parsers/jsx/element-parser.d.ts +6 -0
  102. package/dist/src/parsers/jsx/element-parser.js +243 -0
  103. package/dist/src/parsers/jsx/exports.d.ts +3 -0
  104. package/dist/src/parsers/jsx/exports.js +78 -0
  105. package/dist/src/parsers/jsx/function-parser.d.ts +7 -0
  106. package/dist/src/parsers/jsx/function-parser.js +291 -0
  107. package/dist/src/parsers/jsx/helpers.d.ts +2 -0
  108. package/dist/src/parsers/jsx/helpers.js +30 -1
  109. package/dist/src/parsers/jsx/imports.d.ts +7 -0
  110. package/dist/src/parsers/jsx/imports.js +65 -0
  111. package/dist/src/parsers/jsx/index.d.ts +1 -1
  112. package/dist/src/parsers/jsx/index.js +1 -2
  113. package/dist/src/parsers/jsx/jsx.js +29 -516
  114. package/dist/src/parsers/jsx/state.d.ts +2 -3
  115. package/dist/src/parsers/jsx/state.js +15 -22
  116. package/dist/src/plugins/compile-away-builder-components.js +6 -0
  117. package/dist/src/symbols/symbol-processor.js +3 -0
  118. package/dist/src/targets.d.ts +21 -28
  119. package/dist/src/targets.js +2 -2
  120. package/dist/src/types/config.d.ts +11 -1
  121. package/dist/src/types/mitosis-component.d.ts +12 -6
  122. package/dist/src/types/mitosis-component.js +11 -0
  123. package/dist/src/types/mitosis-context.d.ts +2 -2
  124. package/dist/src/types/mitosis-node.d.ts +14 -5
  125. package/dist/src/types/mitosis-node.js +3 -0
  126. package/dist/src/types/transpiler.d.ts +6 -1
  127. package/dist/tsconfig.build.tsbuildinfo +1 -1
  128. package/package.json +13 -9
  129. package/dist/src/__tests__/angular.test.d.ts +0 -1
  130. package/dist/src/__tests__/angular.test.js +0 -10
  131. package/dist/src/__tests__/builder.test.d.ts +0 -1
  132. package/dist/src/__tests__/builder.test.js +0 -235
  133. package/dist/src/__tests__/context.test.d.ts +0 -1
  134. package/dist/src/__tests__/context.test.js +0 -35
  135. package/dist/src/__tests__/hash-code.test.d.ts +0 -1
  136. package/dist/src/__tests__/hash-code.test.js +0 -11
  137. package/dist/src/__tests__/html.test.d.ts +0 -1
  138. package/dist/src/__tests__/html.test.js +0 -7
  139. package/dist/src/__tests__/liquid.test.d.ts +0 -1
  140. package/dist/src/__tests__/liquid.test.js +0 -7
  141. package/dist/src/__tests__/lit.test.d.ts +0 -1
  142. package/dist/src/__tests__/lit.test.js +0 -7
  143. package/dist/src/__tests__/marko.test.d.ts +0 -1
  144. package/dist/src/__tests__/marko.test.js +0 -14
  145. package/dist/src/__tests__/parse-jsx.test.d.ts +0 -1
  146. package/dist/src/__tests__/parse-jsx.test.js +0 -37
  147. package/dist/src/__tests__/qwik/convert-method-to-function.test.d.ts +0 -1
  148. package/dist/src/__tests__/qwik/convert-method-to-function.test.js +0 -37
  149. package/dist/src/__tests__/qwik/src-generator.test.d.ts +0 -1
  150. package/dist/src/__tests__/qwik/src-generator.test.js +0 -65
  151. package/dist/src/__tests__/qwik.directive.test.d.ts +0 -1
  152. package/dist/src/__tests__/qwik.directive.test.js +0 -108
  153. package/dist/src/__tests__/qwik.test.d.ts +0 -1
  154. package/dist/src/__tests__/qwik.test.js +0 -465
  155. package/dist/src/__tests__/react-native.test.d.ts +0 -1
  156. package/dist/src/__tests__/react-native.test.js +0 -7
  157. package/dist/src/__tests__/react.test.d.ts +0 -1
  158. package/dist/src/__tests__/react.test.js +0 -20
  159. package/dist/src/__tests__/solid.test.d.ts +0 -1
  160. package/dist/src/__tests__/solid.test.js +0 -10
  161. package/dist/src/__tests__/stencil.test.d.ts +0 -1
  162. package/dist/src/__tests__/stencil.test.js +0 -7
  163. package/dist/src/__tests__/styles.test.d.ts +0 -1
  164. package/dist/src/__tests__/styles.test.js +0 -23
  165. package/dist/src/__tests__/svelte.test.d.ts +0 -1
  166. package/dist/src/__tests__/svelte.test.js +0 -7
  167. package/dist/src/__tests__/vue.test.d.ts +0 -1
  168. package/dist/src/__tests__/vue.test.js +0 -7
  169. package/dist/src/__tests__/webcomponent.test.d.ts +0 -1
  170. package/dist/src/__tests__/webcomponent.test.js +0 -15
  171. package/dist/src/constants/function-literal-prefix.d.ts +0 -1
  172. package/dist/src/constants/function-literal-prefix.js +0 -4
  173. package/dist/src/generators/react.d.ts +0 -14
  174. package/dist/src/generators/solid.d.ts +0 -5
  175. package/dist/src/helpers/babel-transform.test.d.ts +0 -1
  176. package/dist/src/helpers/babel-transform.test.js +0 -7
  177. package/dist/src/helpers/generic-format.test.d.ts +0 -1
  178. package/dist/src/helpers/generic-format.test.js +0 -8
  179. package/dist/src/helpers/remove-surrounding-block.test.d.ts +0 -1
  180. package/dist/src/helpers/remove-surrounding-block.test.js +0 -9
  181. package/dist/src/helpers/render-imports.test.d.ts +0 -1
  182. package/dist/src/helpers/render-imports.test.js +0 -33
  183. package/dist/src/helpers/replace-idenifiers.d.ts +0 -1
  184. package/dist/src/helpers/styles/collect-css.test.d.ts +0 -1
  185. package/dist/src/helpers/styles/collect-css.test.js +0 -18
  186. package/dist/test/qwik/Accordion/high.jsx +0 -0
  187. package/dist/test/qwik/Accordion/low.jsx +0 -240
  188. package/dist/test/qwik/Accordion/med.jsx +0 -4
  189. package/dist/test/qwik/For/high.jsx +0 -0
  190. package/dist/test/qwik/For/low.jsx +0 -52
  191. package/dist/test/qwik/For/med.jsx +0 -4
  192. package/dist/test/qwik/Image/high.js +0 -9
  193. package/dist/test/qwik/Image/low.js +0 -0
  194. package/dist/test/qwik/Image/med.js +0 -155
  195. package/dist/test/qwik/Image.slow/high.js +0 -9
  196. package/dist/test/qwik/Image.slow/low.js +0 -0
  197. package/dist/test/qwik/Image.slow/med.js +0 -155
  198. package/dist/test/qwik/bindings/high.cjs +0 -0
  199. package/dist/test/qwik/bindings/low.cjs +0 -45
  200. package/dist/test/qwik/bindings/med.cjs +0 -3
  201. package/dist/test/qwik/button/high.js +0 -3
  202. package/dist/test/qwik/button/low.js +0 -25
  203. package/dist/test/qwik/button/med.js +0 -31
  204. package/dist/test/qwik/component/bindings/high.jsx +0 -0
  205. package/dist/test/qwik/component/bindings/low.jsx +0 -104
  206. package/dist/test/qwik/component/bindings/med.jsx +0 -7
  207. package/dist/test/qwik/component/component/inputs/high.cjsx +0 -9
  208. package/dist/test/qwik/component/component/inputs/low.cjsx +0 -0
  209. package/dist/test/qwik/component/component/inputs/med.cjsx +0 -68
  210. package/dist/test/qwik/for-loop.bindings/high.cjs +0 -0
  211. package/dist/test/qwik/for-loop.bindings/low.cjs +0 -56
  212. package/dist/test/qwik/for-loop.bindings/med.cjs +0 -5
  213. package/dist/test/qwik/hello_world/stylesheet/high.jsx +0 -0
  214. package/dist/test/qwik/hello_world/stylesheet/low.jsx +0 -26
  215. package/dist/test/qwik/hello_world/stylesheet/med.jsx +0 -4
  216. package/dist/test/qwik/mount/high.cjs +0 -0
  217. package/dist/test/qwik/mount/low.cjs +0 -47
  218. package/dist/test/qwik/mount/med.cjs +0 -3
  219. package/dist/test/qwik/page-with-symbol/high.js +0 -0
  220. package/dist/test/qwik/page-with-symbol/low.js +0 -33
  221. package/dist/test/qwik/page-with-symbol/med.js +0 -4
  222. package/dist/test/qwik/show-hide/high.jsx +0 -9
  223. package/dist/test/qwik/show-hide/low.jsx +0 -0
  224. package/dist/test/qwik/show-hide/med.jsx +0 -181
  225. package/dist/test/qwik/svg/high.js +0 -0
  226. package/dist/test/qwik/svg/low.js +0 -30
  227. package/dist/test/qwik/svg/med.js +0 -4
  228. package/dist/test/qwik/todo/Todo.cjs/high.cjs +0 -19
  229. package/dist/test/qwik/todo/Todo.cjs/low.cjs +0 -0
  230. package/dist/test/qwik/todo/Todo.cjs/med.cjs +0 -51
  231. package/dist/test/qwik/todo/Todo.js/high.js +0 -19
  232. package/dist/test/qwik/todo/Todo.js/low.js +0 -0
  233. package/dist/test/qwik/todo/Todo.js/med.js +0 -47
  234. package/dist/test/qwik/todo/Todo.tsx/high.tsx +0 -19
  235. package/dist/test/qwik/todo/Todo.tsx/low.tsx +0 -0
  236. package/dist/test/qwik/todo/Todo.tsx/med.tsx +0 -43
  237. package/dist/test/qwik/todos/Todo.tsx/high.tsx +0 -7
  238. package/dist/test/qwik/todos/Todo.tsx/low.tsx +0 -32
  239. package/dist/test/qwik/todos/Todo.tsx/med.tsx +0 -4
  240. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mitosis_1 = require("@builder.io/mitosis");
3
4
  function ContentSlotJsxCode(props) {
4
5
  return (<div>
5
- {props.slotTesting}
6
+ <mitosis_1.Show when={props.slotTesting}>
7
+ <div>{props.slotTesting}</div>
8
+ </mitosis_1.Show>
6
9
  <div>
7
10
  <hr />
8
11
  </div>
@@ -45,12 +45,12 @@ var _fake_4 = require("@fake");
45
45
  function FormComponent(props) {
46
46
  var _a;
47
47
  var state = (0, mitosis_1.useStore)({
48
- state: 'unsubmitted',
48
+ formState: 'unsubmitted',
49
49
  // TODO: separate response and error?
50
50
  responseData: null,
51
51
  formErrorMessage: '',
52
52
  get submissionState() {
53
- return (sdk_1.Builder.isEditing && props.previewState) || state.state;
53
+ return (sdk_1.Builder.isEditing && props.previewState) || state.formState;
54
54
  },
55
55
  onSubmit: function (event) {
56
56
  var _this = this;
@@ -149,7 +149,7 @@ function FormComponent(props) {
149
149
  return;
150
150
  }
151
151
  }
152
- state.state = 'sending';
152
+ state.formState = 'sending';
153
153
  var formUrl = "".concat(sdk_1.builder.env === 'dev' ? 'http://localhost:5000' : 'https://builder.io', "/api/v1/form-submit?apiKey=").concat(sdk_1.builder.apiKey, "&to=").concat(btoa(props.sendSubmissionsToEmail || ''), "&name=").concat(encodeURIComponent(props.name || ''));
154
154
  fetch(props.sendSubmissionsTo === 'email'
155
155
  ? formUrl
@@ -185,7 +185,7 @@ function FormComponent(props) {
185
185
  }
186
186
  }
187
187
  state.responseData = body;
188
- state.state = res.ok ? 'success' : 'error';
188
+ state.formState = res.ok ? 'success' : 'error';
189
189
  if (res.ok) {
190
190
  submitSuccessEvent = new CustomEvent('submit:success', {
191
191
  detail: {
@@ -237,7 +237,7 @@ function FormComponent(props) {
237
237
  }
238
238
  }
239
239
  state.responseData = err;
240
- state.state = 'error';
240
+ state.formState = 'error';
241
241
  });
242
242
  }
243
243
  },
@@ -1 +1,5 @@
1
- export default function OnUpdateWithDeps(): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
1
+ declare type Props = {
2
+ size: string;
3
+ };
4
+ export default function OnUpdateWithDeps(props: Props): import("@builder.io/mitosis/jsx-runtime").JSX.Element;
5
+ export {};
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var mitosis_1 = require("@builder.io/mitosis");
4
- function OnUpdateWithDeps() {
4
+ function OnUpdateWithDeps(props) {
5
5
  var state = (0, mitosis_1.useStore)({
6
6
  a: 'a',
7
7
  b: 'b',
8
8
  });
9
9
  (0, mitosis_1.onUpdate)(function () {
10
- console.log('Runs when a or b changes', state.a, state.b);
11
- }, [state.a, state.b]);
10
+ console.log('Runs when a, b or size changes', state.a, state.b, props.size);
11
+ }, [state.a, state.b, props.size]);
12
12
  return <div />;
13
13
  }
14
14
  exports.default = OnUpdateWithDeps;
@@ -0,0 +1,2 @@
1
+ import * as babel from '@babel/core';
2
+ export declare const SPEC: babel.types.ObjectExpression;