@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,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var svelte_1 = require("../generators/svelte");
4
- var shared_1 = require("./shared");
5
- describe('Svelte', function () {
6
- (0, shared_1.runTestsForTarget)('svelte', (0, svelte_1.componentToSvelte)());
7
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var vue_1 = require("../generators/vue");
4
- var shared_1 = require("./shared");
5
- describe('Vue', function () {
6
- (0, shared_1.runTestsForTarget)('vue', (0, vue_1.componentToVue2)());
7
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var __1 = require("..");
4
- var html_1 = require("../generators/html");
5
- var shared_1 = require("./shared");
6
- var shadowDom = require('./data/blocks/shadow-dom.raw');
7
- describe('webcomponent', function () {
8
- var generator = (0, html_1.componentToCustomElement)();
9
- (0, shared_1.runTestsForTarget)('webcomponent', generator);
10
- test('Shadow DOM', function () {
11
- var component = (0, __1.parseJsx)(shadowDom);
12
- var html = generator({ component: component });
13
- expect(html).toMatchSnapshot();
14
- });
15
- });
@@ -1 +0,0 @@
1
- export declare const functionLiteralPrefix = "@builder.io/mitosis/function:";
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.functionLiteralPrefix = void 0;
4
- exports.functionLiteralPrefix = "@builder.io/mitosis/function:";
@@ -1,14 +0,0 @@
1
- import { BaseTranspilerOptions, Transpiler } from '../types/transpiler';
2
- import { MitosisNode } from '../types/mitosis-node';
3
- export interface ToReactOptions extends BaseTranspilerOptions {
4
- stylesType?: 'emotion' | 'styled-components' | 'styled-jsx' | 'react-native' | 'style-tag';
5
- stateType?: 'useState' | 'mobx' | 'valtio' | 'solid' | 'builder';
6
- format?: 'lite' | 'safe';
7
- type?: 'dom' | 'native';
8
- preact?: boolean;
9
- forwardRef?: string;
10
- experimental?: any;
11
- }
12
- export declare const blockToReact: (json: MitosisNode, options: ToReactOptions, parentSlots?: any[]) => string;
13
- export declare const componentToPreact: (reactOptions?: ToReactOptions) => Transpiler;
14
- export declare const componentToReact: (reactOptions?: ToReactOptions) => Transpiler;
@@ -1,5 +0,0 @@
1
- import { BaseTranspilerOptions, Transpiler } from '../types/transpiler';
2
- export interface ToSolidOptions extends BaseTranspilerOptions {
3
- stylesType?: 'styled-components' | 'style-tag';
4
- }
5
- export declare const componentToSolid: (_options?: ToSolidOptions) => Transpiler;
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var babel_transform_1 = require("./babel-transform");
4
- test('babelTransform', function () {
5
- var code = "\nconst symbol = symbol;\n\nif (symbol) {\n getContent({\n apiKey: builderContext.apiKey!,\n }).then(response => {\n content = response;\n });\n}\n";
6
- expect((0, babel_transform_1.babelTransformCode)(code)).toMatchSnapshot();
7
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var globals_1 = require("@jest/globals");
4
- var generic_format_1 = require("./generic-format");
5
- (0, globals_1.test)('Can generic format sloppy Swift code', function () {
6
- var code = "\n import SwiftUI\n import JavaScriptCore\n \n struct MyComponent: View {\n \n @State private var updateIndex = 0\n private var context = JSContext()\n \n func eval(expression: String) -> JSValue! {\n return context?.evaluateScript(expression)\n }\n \n init() {\n let jsSource = \"\"\"\n const state = { name: \"Steve\" };\n \n \"\"\"\n context?.evaluateScript(jsSource)\n }\n \n \n var body: some View {\n VStack {\n Text(String(updateIndex)).hidden()\n VStack(){\n Foo(\n bar: baz\n )\n TextField(){}\n Text(\"Hello\")\n Text(eval(expression: \"\"\"state.name\"\"\"))\n Text(\"! I can run in React, Vue, Solid, or Liquid!\")}\n }\n }\n }\n ";
7
- (0, globals_1.expect)((0, generic_format_1.format)(code)).toMatchSnapshot();
8
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var remove_surrounding_block_1 = require("./remove-surrounding-block");
4
- describe('removeSurroundingBlock', function () {
5
- test('It removes the surrounding wrapper block', function () {
6
- var output = (0, remove_surrounding_block_1.removeSurroundingBlock)('{ const foo = "bar" }');
7
- expect(output).toBe(' const foo = "bar" ');
8
- });
9
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var render_imports_1 = require("./render-imports");
4
- describe('renderImport', function () {
5
- test('Adds correct extension to component import', function () {
6
- var data = [
7
- {
8
- imports: { RenderBlocks: 'default' },
9
- path: '../render-blocks.lite',
10
- },
11
- ];
12
- var output = (0, render_imports_1.renderImport)({
13
- theImport: data[0],
14
- target: 'vue',
15
- asyncComponentImports: false,
16
- });
17
- expect(output).toMatchSnapshot();
18
- });
19
- test('Adds correctly a side-effect import', function () {
20
- var data = [
21
- {
22
- imports: {},
23
- path: '../render-blocks.scss',
24
- },
25
- ];
26
- var output = (0, render_imports_1.renderImport)({
27
- theImport: data[0],
28
- target: 'react',
29
- asyncComponentImports: false,
30
- });
31
- expect(output).toEqual("import '../render-blocks.scss';");
32
- });
33
- });
@@ -1 +0,0 @@
1
- export declare const replaceIdentifiers: (code: string, from: string | string[], to: string | ((identifier: string) => string)) => string;
@@ -1 +0,0 @@
1
- export {};
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var collect_css_1 = require("./collect-css");
4
- var jsx_1 = require("../../parsers/jsx");
5
- var classRaw = require('../../__tests__/data/styles/class.raw');
6
- var classState = require('../../__tests__/data/styles/classState.raw');
7
- describe('Styles', function () {
8
- test('class property and CSS are merged', function () {
9
- var component = (0, jsx_1.parseJsx)(classRaw);
10
- var output = (0, collect_css_1.collectCss)(component);
11
- expect({ component: component, output: output }).toMatchSnapshot();
12
- });
13
- test('class binding and CSS are merged', function () {
14
- var component = (0, jsx_1.parseJsx)(classState);
15
- var output = (0, collect_css_1.collectCss)(component);
16
- expect({ component: component, output: output }).toMatchSnapshot();
17
- });
18
- });
File without changes
@@ -1,240 +0,0 @@
1
- import {
2
- Fragment,
3
- h,
4
- qrl,
5
- useStore,
6
- withScopedStylesQrl,
7
- } from "@builder.io/qwik";
8
- export const MyComponent_styles = `.csw5022{display:flex;flex-direction:column;position:relative;flex-shrink:0;box-sizing:border-box;margin-top:20px;align-items:stretch}.csanagh{margin-top:10px;position:relative;display:flex;align-items:stretch;flex-direction:column;padding-bottom:10px}.c4qyc1p{position:relative;display:flex;align-items:stretch;flex-direction:column;margin-top:10px;padding-bottom:10px}.crwdrpw{text-align:left;display:flex;flex-direction:column}.ctcw2m4{padding-top:50px;text-align:left;display:flex;flex-direction:column;padding-bottom:50px}`;
9
- export const MyComponent_onMount = (props) => {
10
- const state = useStore(() => {
11
- const state = Object.assign(
12
- {},
13
- props,
14
- typeof __STATE__ === "object" ? __STATE__[props.serverStateId] : undefined
15
- );
16
- return state;
17
- });
18
- withScopedStylesQrl(qrl("./low.js", "MyComponent_styles", []));
19
- return (
20
- <div
21
- builder-id="builder-bb2f62792e464d73b7cb89258027f356"
22
- gridRowWidth="25%"
23
- class="csw5022 builder-block"
24
- items={[
25
- {
26
- title: [
27
- {
28
- "@type": "@builder.io/sdk:Element",
29
- "@version": 2,
30
- layerName: "Accordion item title",
31
- id: "builder-5fed2723c1cc4fb39e9d22b9c54ef179",
32
- children: [
33
- {
34
- "@type": "@builder.io/sdk:Element",
35
- "@version": 2,
36
- id: "builder-2cad86b387ec405d82917895d7af0a12",
37
- component: {
38
- name: "Text",
39
- options: { text: "<p>Item 1</p>" },
40
- },
41
- responsiveStyles: {
42
- large: {
43
- textAlign: "left",
44
- display: "flex",
45
- flexDirection: "column",
46
- },
47
- },
48
- },
49
- ],
50
- responsiveStyles: {
51
- large: {
52
- marginTop: "10px",
53
- position: "relative",
54
- display: "flex",
55
- alignItems: "stretch",
56
- flexDirection: "column",
57
- paddingBottom: "10px",
58
- },
59
- },
60
- },
61
- ],
62
- detail: [
63
- {
64
- "@type": "@builder.io/sdk:Element",
65
- "@version": 2,
66
- layerName: "Accordion item detail",
67
- id: "builder-18279a99b32240f19aa21d3f4b015cc9",
68
- children: [
69
- {
70
- "@type": "@builder.io/sdk:Element",
71
- "@version": 2,
72
- id: "builder-2dbfa56b8988461c8566bbe759580e9b",
73
- component: {
74
- name: "Text",
75
- options: { text: "<p>Item 1 content</p>" },
76
- },
77
- responsiveStyles: {
78
- large: {
79
- paddingTop: "50px",
80
- textAlign: "left",
81
- display: "flex",
82
- flexDirection: "column",
83
- paddingBottom: "50px",
84
- },
85
- },
86
- },
87
- ],
88
- responsiveStyles: {
89
- large: {
90
- position: "relative",
91
- display: "flex",
92
- alignItems: "stretch",
93
- flexDirection: "column",
94
- marginTop: "10px",
95
- paddingBottom: "10px",
96
- },
97
- },
98
- },
99
- ],
100
- },
101
- {
102
- title: [
103
- {
104
- "@type": "@builder.io/sdk:Element",
105
- "@version": 2,
106
- layerName: "Accordion item title",
107
- id: "builder-2a93def22a354cf7aa193c20d1ad6def",
108
- children: [
109
- {
110
- "@type": "@builder.io/sdk:Element",
111
- "@version": 2,
112
- id: "builder-1365fc457ece45db82ad90dbe9819e7c",
113
- component: {
114
- name: "Text",
115
- options: { text: "<p>Item 2</p>" },
116
- },
117
- responsiveStyles: {
118
- large: {
119
- textAlign: "left",
120
- display: "flex",
121
- flexDirection: "column",
122
- },
123
- },
124
- },
125
- ],
126
- responsiveStyles: {
127
- large: {
128
- marginTop: "10px",
129
- position: "relative",
130
- display: "flex",
131
- alignItems: "stretch",
132
- flexDirection: "column",
133
- paddingBottom: "10px",
134
- },
135
- },
136
- },
137
- ],
138
- detail: [
139
- {
140
- "@type": "@builder.io/sdk:Element",
141
- "@version": 2,
142
- layerName: "Accordion item detail",
143
- id: "builder-fd6ef41da6d040328fbd8b0801611fe5",
144
- children: [
145
- {
146
- "@type": "@builder.io/sdk:Element",
147
- "@version": 2,
148
- id: "builder-7362f9fd64c647c5a400d9e75c74473f",
149
- component: {
150
- name: "Text",
151
- options: { text: "<p>Item 2 content</p>" },
152
- },
153
- responsiveStyles: {
154
- large: {
155
- paddingTop: "50px",
156
- textAlign: "left",
157
- display: "flex",
158
- flexDirection: "column",
159
- paddingBottom: "50px",
160
- },
161
- },
162
- },
163
- ],
164
- responsiveStyles: {
165
- large: {
166
- position: "relative",
167
- display: "flex",
168
- alignItems: "stretch",
169
- flexDirection: "column",
170
- marginTop: "10px",
171
- paddingBottom: "10px",
172
- },
173
- },
174
- },
175
- ],
176
- },
177
- ]}
178
- animate={true}
179
- >
180
- <div>
181
- <div builder="accordion">
182
- <div builder="accordion-title">
183
- <div
184
- builder-id="builder-5fed2723c1cc4fb39e9d22b9c54ef179"
185
- class="csanagh"
186
- >
187
- <div class="crwdrpw">
188
- <div
189
- dangerouslySetInnerHTML="<p>Item 1</p>"
190
- class="builder-text"
191
- ></div>
192
- </div>
193
- </div>
194
- </div>
195
- <div builder="accordion-detail">
196
- <div
197
- builder-id="builder-18279a99b32240f19aa21d3f4b015cc9"
198
- class="c4qyc1p"
199
- >
200
- <div class="ctcw2m4">
201
- <div
202
- dangerouslySetInnerHTML="<p>Item 1 content</p>"
203
- class="builder-text"
204
- ></div>
205
- </div>
206
- </div>
207
- </div>
208
- </div>
209
- <div builder="accordion">
210
- <div builder="accordion-title">
211
- <div
212
- builder-id="builder-2a93def22a354cf7aa193c20d1ad6def"
213
- class="csanagh"
214
- >
215
- <div class="crwdrpw">
216
- <div
217
- dangerouslySetInnerHTML="<p>Item 2</p>"
218
- class="builder-text"
219
- ></div>
220
- </div>
221
- </div>
222
- </div>
223
- <div builder="accordion-detail">
224
- <div
225
- builder-id="builder-fd6ef41da6d040328fbd8b0801611fe5"
226
- class="c4qyc1p"
227
- >
228
- <div class="ctcw2m4">
229
- <div
230
- dangerouslySetInnerHTML="<p>Item 2 content</p>"
231
- class="builder-text"
232
- ></div>
233
- </div>
234
- </div>
235
- </div>
236
- </div>
237
- </div>
238
- </div>
239
- );
240
- };
@@ -1,4 +0,0 @@
1
- import { componentQrl, qrl } from "@builder.io/qwik";
2
- export const MyComponent = componentQrl(
3
- qrl("./low.js", "MyComponent_onMount", [])
4
- );
File without changes
@@ -1,52 +0,0 @@
1
- import {
2
- Fragment,
3
- h,
4
- qrl,
5
- useStore,
6
- withScopedStylesQrl,
7
- } from "@builder.io/qwik";
8
- export const MyComponent_styles = `.cvdfnp5{display:flex;flex-direction:column;position:relative;flex-shrink:0;box-sizing:border-box;margin-top:0px;padding-left:20px;padding-right:20px;padding-top:50px;padding-bottom:50px;width:100vw;margin-left:calc(50% - 50vw)}.cz5wnof{width:100%;align-self:stretch;flex-grow:1;box-sizing:border-box;max-width:1200px;display:flex;flex-direction:column;align-items:stretch;margin-left:auto;margin-right:auto}.cdrk993{text-align:center}`;
9
- export const MyComponent_onMount = (props) => {
10
- const state = useStore(() => {
11
- const state = Object.assign(
12
- {},
13
- props,
14
- typeof __STATE__ === "object" ? __STATE__[props.serverStateId] : undefined
15
- );
16
- return state;
17
- });
18
- withScopedStylesQrl(qrl("./low.js", "MyComponent_styles", []));
19
- return (
20
- <div
21
- builder-id="builder-a58a66676d9b4ecc826c1b8bc5ad91f1"
22
- class="cvdfnp5 builder-block"
23
- maxWidth={1200}
24
- >
25
- <section
26
- builder-id="builder-a58a66676d9b4ecc826c1b8bc5ad91f1"
27
- class="cz5wnof"
28
- >
29
- {(state.simpleList.results || []).map((item) => {
30
- var state = Object.assign({}, this, {
31
- resultsItem: item == null ? {} : item,
32
- });
33
- return (
34
- <div class="cdrk993">
35
- <div
36
- class="builder-text"
37
- dangerouslySetInnerHTML={(() => {
38
- try {
39
- var _virtual_index = state.resultsItem.data.title;
40
- return _virtual_index;
41
- } catch (err) {
42
- console.warn("Builder code error", err);
43
- }
44
- })()}
45
- ></div>
46
- </div>
47
- );
48
- })}
49
- </section>
50
- </div>
51
- );
52
- };
@@ -1,4 +0,0 @@
1
- import { componentQrl, qrl } from "@builder.io/qwik";
2
- export const MyComponent = componentQrl(
3
- qrl("./low.js", "MyComponent_onMount", [])
4
- );
@@ -1,9 +0,0 @@
1
- import { useLexicalScope } from "@builder.io/qwik";
2
- export const MyComponent_onClick_0 = (event) => {
3
- const state = useLexicalScope()[0];
4
- try {
5
- return (state.myState = "changed value");
6
- } catch (err) {
7
- console.warn("Builder code error", err);
8
- }
9
- };
File without changes
@@ -1,155 +0,0 @@
1
- import {
2
- Fragment,
3
- componentQrl,
4
- h,
5
- qrl,
6
- useStore,
7
- withScopedStylesQrl,
8
- } from "@builder.io/qwik";
9
- export const MyComponent_styles = `.cvk52jt{display:flex;flex-direction:column;position:relative;flex-shrink:0;box-sizing:border-box;margin-top:20px;min-height:20px;min-width:20px;overflow:hidden}.cjrqfb1{display:flex;flex-direction:column;position:relative;flex-shrink:0;box-sizing:border-box;margin-top:20px;line-height:normal;height:auto;text-align:center}`;
10
- export const MyComponent_onMount = (props) => {
11
- const state = useStore(() => {
12
- const state = Object.assign(
13
- {},
14
- props,
15
- typeof __STATE__ === "object" ? __STATE__[props.serverStateId] : undefined
16
- );
17
- if (!state.hasOwnProperty("myState")) state.myState = "initialValue";
18
- return state;
19
- });
20
- withScopedStylesQrl(qrl("./med.js", "MyComponent_styles", []));
21
- return h(
22
- Fragment,
23
- null,
24
- h(Image, {
25
- "builder-id": "builder-fa4480d2f48a44a7a2e98cf07c54927b",
26
- image:
27
- "https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=1160",
28
- backgroundSize: "cover",
29
- backgroundPosition: "center",
30
- srcset:
31
- "https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=100 100w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=200 200w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=400 400w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=800 800w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=1200 1200w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=1600 1600w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=2000 2000w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=1160 1160w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=598 598w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=958 958w",
32
- sizes: "(max-width: 638px) 94vw, (max-width: 998px) 96vw, 83vw",
33
- class: "cvk52jt builder-block",
34
- onClick$: qrl("./high.js", "MyComponent_onClick_0", [state]),
35
- lazy: false,
36
- fitContent: true,
37
- aspectRatio: 1,
38
- height: 1300,
39
- width: 1300,
40
- }),
41
- h(
42
- "div",
43
- { class: "cjrqfb1" },
44
- h("div", {
45
- class: "builder-text",
46
- dangerouslySetInnerHTML: (() => {
47
- try {
48
- var _virtual_index = state.myState;
49
- return _virtual_index;
50
- } catch (err) {
51
- console.warn("Builder code error", err);
52
- }
53
- })(),
54
- })
55
- )
56
- );
57
- };
58
- export const MyComponent = componentQrl(
59
- qrl("./med.js", "MyComponent_onMount", [])
60
- );
61
- export const Image = function Image(props) {
62
- var _a;
63
- var jsx = props.children || [];
64
- var image = props.image;
65
- if (image) {
66
- var isBuilderIoImage = !!(image || "").match(/\.builder\.io/);
67
- var isPixel =
68
- (_a = props.builderBlock) === null || _a === void 0
69
- ? void 0
70
- : _a.id.startsWith("builder-pixel-");
71
- var imgProps = {
72
- src: props.image,
73
- style:
74
- "object-fit:"
75
- .concat(props.backgroundSize || "cover", ";object-position:")
76
- .concat(props.backgroundPosition || "center", ";") +
77
- (props.aspectRatio
78
- ? "position:absolute;height:100%;width:100%;top:0;left:0"
79
- : ""),
80
- sizes: props.sizes,
81
- alt: props.altText,
82
- role: !props.altText ? "presentation" : undefined,
83
- loading: isPixel ? "eager" : "lazy",
84
- srcset: undefined,
85
- };
86
- if (isBuilderIoImage) {
87
- var webpImage_1 = updateQueryParam(image, "format", "webp");
88
- var srcset = ["100", "200", "400", "800", "1200", "1600", "2000"]
89
- .concat(props.srcsetSizes ? String(props.srcsetSizes).split(" ") : [])
90
- .map(function (size) {
91
- return (
92
- updateQueryParam(webpImage_1, "width", size) + " " + size + "w"
93
- );
94
- })
95
- .concat([image])
96
- .join(",");
97
- imgProps.srcset = srcset;
98
- jsx = jsx = [
99
- h("picture", {}, [
100
- h("source", { type: "image/webp", srcset: srcset }),
101
- h("img", imgProps, jsx),
102
- ]),
103
- ];
104
- } else {
105
- jsx = [h("img", imgProps, jsx)];
106
- }
107
- if (
108
- props.aspectRatio &&
109
- !(props.fitContent && props.children && props.children.length)
110
- ) {
111
- var sizingDiv = h("div", {
112
- class: "builder-image-sizer",
113
- style: "width:100%;padding-top:".concat(
114
- (props.aspectRatio || 1) * 100,
115
- "%;pointer-events:none;font-size:0"
116
- ),
117
- });
118
- jsx.push(sizingDiv);
119
- }
120
- }
121
- var children = props.children ? [jsx].concat(props.children) : [jsx];
122
- return h(
123
- props.href ? "a" : "div",
124
- __passThroughProps__({ href: props.href, class: props.class }, props),
125
- children
126
- );
127
- function updateQueryParam(uri, key, value) {
128
- if (uri === void 0) {
129
- uri = "";
130
- }
131
- var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
132
- var separator = uri.indexOf("?") !== -1 ? "&" : "?";
133
- if (uri.match(re)) {
134
- return uri.replace(
135
- re,
136
- "$1" + key + "=" + encodeURIComponent(value) + "$2"
137
- );
138
- }
139
- return uri + separator + key + "=" + encodeURIComponent(value);
140
- }
141
- };
142
- export const __passThroughProps__ = function __passThroughProps__(
143
- dstProps,
144
- srcProps
145
- ) {
146
- for (var key in srcProps) {
147
- if (
148
- Object.prototype.hasOwnProperty.call(srcProps, key) &&
149
- ((key.startsWith("on") && key.endsWith("$")) || key == "style")
150
- ) {
151
- dstProps[key] = srcProps[key];
152
- }
153
- }
154
- return dstProps;
155
- };
@@ -1,9 +0,0 @@
1
- import { useLexicalScope } from "@builder.io/qwik";
2
- export const MyComponent_onClick_0 = (event) => {
3
- const state = useLexicalScope()[0];
4
- try {
5
- return (state.myState = "changed value");
6
- } catch (err) {
7
- console.warn("Builder code error", err);
8
- }
9
- };