@builder.io/mitosis 0.0.50-6 → 0.0.50

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 (138) hide show
  1. package/dist/src/__tests__/angular.test.js +6 -0
  2. package/dist/src/__tests__/builder.test.js +5 -1
  3. package/dist/src/__tests__/data/blocks/multiple-onUpdate.raw.d.ts +1 -0
  4. package/dist/src/__tests__/data/blocks/multiple-onUpdate.raw.jsx +13 -0
  5. package/dist/src/__tests__/data/blocks/multiple-onUpdateWithDeps.raw.d.ts +1 -0
  6. package/dist/src/__tests__/data/blocks/multiple-onUpdateWithDeps.raw.jsx +19 -0
  7. package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.jsx +6 -3
  8. package/dist/src/__tests__/data/blocks/self-referencing-component-with-children.raw.d.ts +1 -0
  9. package/dist/src/__tests__/data/blocks/self-referencing-component-with-children.raw.jsx +15 -0
  10. package/dist/src/__tests__/data/blocks/self-referencing-component.raw.d.ts +1 -0
  11. package/dist/src/__tests__/data/blocks/self-referencing-component.raw.jsx +12 -0
  12. package/dist/src/__tests__/data/blocks/shadow-dom.raw.d.ts +6 -0
  13. package/dist/src/__tests__/data/blocks/shadow-dom.raw.jsx +54 -0
  14. package/dist/src/__tests__/data/blocks/slot.raw.d.ts +5 -0
  15. package/dist/src/__tests__/data/blocks/slot.raw.jsx +6 -0
  16. package/dist/src/__tests__/data/blocks/stamped-io.raw.jsx +8 -0
  17. package/dist/src/__tests__/data/blocks/styles.raw.d.ts +1 -0
  18. package/dist/src/__tests__/data/blocks/styles.raw.jsx +10 -0
  19. package/dist/src/__tests__/data/context/simple.context.lite.d.ts +8 -1
  20. package/dist/src/__tests__/html.test.js +6 -0
  21. package/dist/src/__tests__/qwik.directive.test.d.ts +1 -0
  22. package/dist/src/__tests__/qwik.directive.test.js +107 -0
  23. package/dist/src/__tests__/qwik.test.js +256 -128
  24. package/dist/src/__tests__/react-native.test.js +12 -0
  25. package/dist/src/__tests__/react.test.js +12 -0
  26. package/dist/src/__tests__/svelte.test.js +24 -0
  27. package/dist/src/__tests__/vue.test.js +12 -0
  28. package/dist/src/__tests__/webcomponent.test.d.ts +1 -0
  29. package/dist/src/__tests__/webcomponent.test.js +12 -0
  30. package/dist/src/constants/html_tags.d.ts +1 -0
  31. package/dist/src/constants/html_tags.js +119 -0
  32. package/dist/src/generators/angular.js +7 -4
  33. package/dist/src/generators/context/react copy.d.ts +8 -0
  34. package/dist/src/generators/context/react copy.js +28 -0
  35. package/dist/src/generators/context/solid.d.ts +8 -0
  36. package/dist/src/generators/context/solid.js +28 -0
  37. package/dist/src/generators/context/svelte.d.ts +8 -0
  38. package/dist/src/generators/context/svelte.js +28 -0
  39. package/dist/src/generators/helpers/context.d.ts +2 -0
  40. package/dist/src/generators/helpers/context.js +8 -0
  41. package/dist/src/generators/html.js +20 -14
  42. package/dist/src/generators/mitosis.js +4 -3
  43. package/dist/src/generators/qwik/component.js +26 -5
  44. package/dist/src/generators/qwik/directives.d.ts +14 -5
  45. package/dist/src/generators/qwik/directives.js +32 -25
  46. package/dist/src/generators/qwik/handlers.js +3 -4
  47. package/dist/src/generators/qwik/jsx.js +17 -5
  48. package/dist/src/generators/qwik/src-generator.d.ts +0 -9
  49. package/dist/src/generators/qwik/src-generator.js +93 -101
  50. package/dist/src/generators/qwik/styles.js +8 -11
  51. package/dist/src/generators/react.js +9 -8
  52. package/dist/src/generators/solid.js +82 -8
  53. package/dist/src/generators/stencil/generate.js +5 -3
  54. package/dist/src/generators/stencil/index.js +5 -1
  55. package/dist/src/generators/svelte.d.ts +9 -1
  56. package/dist/src/generators/svelte.js +175 -76
  57. package/dist/src/generators/vue.d.ts +1 -1
  58. package/dist/src/generators/vue.js +86 -10
  59. package/dist/src/helpers/babel-transform copy.d.ts +8 -0
  60. package/dist/src/helpers/babel-transform copy.js +138 -0
  61. package/dist/src/helpers/babel-transform.d.ts +4 -7
  62. package/dist/src/helpers/babel-transform.js +18 -2
  63. package/dist/src/helpers/babel-transform.test.d.ts +1 -0
  64. package/dist/src/helpers/babel-transform.test.js +7 -0
  65. package/dist/src/helpers/create-mitosis-component.js +1 -1
  66. package/dist/src/helpers/get-state-object-string.js +2 -1
  67. package/dist/src/helpers/map-refs.js +22 -9
  68. package/dist/src/helpers/parsers.d.ts +8 -0
  69. package/dist/src/helpers/parsers.js +66 -0
  70. package/dist/src/helpers/render-imports.d.ts +2 -4
  71. package/dist/src/helpers/render-imports.js +32 -14
  72. package/dist/src/index.d.ts +10 -5
  73. package/dist/src/index.js +11 -5
  74. package/dist/src/parsers/builder.d.ts +16 -50
  75. package/dist/src/parsers/builder.js +22 -40
  76. package/dist/src/parsers/context.js +5 -1
  77. package/dist/src/parsers/jsx.d.ts +7 -0
  78. package/dist/src/parsers/jsx.js +27 -5
  79. package/dist/src/parsers/liquid.js +5 -1
  80. package/dist/src/plugins/compile-away-builder-components.js +5 -1
  81. package/dist/src/symbols/symbol-processor.js +3 -3
  82. package/dist/src/targets.d.ts +1 -1
  83. package/dist/src/types/mitosis-component.d.ts +8 -3
  84. package/dist/test/qwik/Accordion/high.jsx +0 -1
  85. package/dist/test/qwik/Accordion/low.jsx +171 -65
  86. package/dist/test/qwik/Accordion/med.jsx +9 -10
  87. package/dist/test/qwik/For/high.jsx +0 -1
  88. package/dist/test/qwik/For/low.jsx +25 -58
  89. package/dist/test/qwik/For/med.jsx +9 -10
  90. package/dist/test/qwik/Image/high.js +9 -1
  91. package/dist/test/qwik/Image/low.js +0 -42
  92. package/dist/test/qwik/Image/med.js +149 -12
  93. package/dist/test/qwik/Image.slow/high.js +9 -1
  94. package/dist/test/qwik/Image.slow/low.js +0 -42
  95. package/dist/test/qwik/Image.slow/med.js +149 -12
  96. package/dist/{src/types/generators.d.ts → test/qwik/bindings/high.cjs} +0 -0
  97. package/dist/test/qwik/bindings/low.cjs +33 -0
  98. package/dist/test/qwik/bindings/med.cjs +12 -0
  99. package/dist/test/qwik/button/high.js +1 -13
  100. package/dist/test/qwik/button/low.js +8 -40
  101. package/dist/test/qwik/button/med.js +36 -11
  102. package/dist/test/qwik/component/bindings/high.jsx +0 -1
  103. package/dist/test/qwik/component/bindings/low.jsx +26 -71
  104. package/dist/test/qwik/component/bindings/med.jsx +48 -39
  105. package/dist/test/qwik/component/component/inputs/high.cjsx +9 -0
  106. package/dist/test/qwik/component/component/inputs/low.cjsx +0 -0
  107. package/dist/test/qwik/component/component/inputs/med.cjsx +65 -0
  108. package/dist/test/qwik/hello_world/stylesheet/high.jsx +0 -1
  109. package/dist/test/qwik/hello_world/stylesheet/low.jsx +6 -27
  110. package/dist/test/qwik/hello_world/stylesheet/med.jsx +9 -10
  111. package/dist/test/qwik/page-with-symbol/high.js +0 -1
  112. package/dist/test/qwik/page-with-symbol/low.js +15 -52
  113. package/dist/test/qwik/page-with-symbol/med.js +9 -10
  114. package/dist/test/qwik/show-hide/high.jsx +9 -0
  115. package/dist/test/qwik/show-hide/low.jsx +0 -0
  116. package/dist/test/qwik/show-hide/med.jsx +174 -0
  117. package/dist/test/qwik/svg/high.js +0 -1
  118. package/dist/test/qwik/svg/low.js +9 -35
  119. package/dist/test/qwik/svg/med.js +9 -10
  120. package/dist/test/qwik/todo/Todo.cjs/high.cjs +4 -39
  121. package/dist/test/qwik/todo/Todo.cjs/low.cjs +0 -1
  122. package/dist/test/qwik/todo/Todo.cjs/med.cjs +38 -61
  123. package/dist/test/qwik/todo/Todo.js/high.js +22 -5
  124. package/dist/test/qwik/todo/Todo.js/med.js +45 -1
  125. package/dist/test/qwik/todo/Todo.tsx/high.tsx +4 -39
  126. package/dist/test/qwik/todo/Todo.tsx/low.tsx +0 -1
  127. package/dist/test/qwik/todo/Todo.tsx/med.tsx +31 -34
  128. package/dist/test/qwik/todos/Todo.tsx/high.tsx +0 -12
  129. package/dist/test/qwik/todos/Todo.tsx/low.tsx +18 -25
  130. package/dist/test/qwik/todos/Todo.tsx/med.tsx +8 -10
  131. package/dist/tsconfig.build.tsbuildinfo +1 -0
  132. package/dist/tsconfig.tsbuildinfo +1 -1
  133. package/package.json +22 -22
  134. package/dist/src/__tests__/data/blocks/onMount-onUnMount.d.ts +0 -1
  135. package/dist/src/__tests__/data/blocks/onMount-onUnMount.jsx +0 -13
  136. package/dist/src/__tests__/data/blocks/onMount.d.ts +0 -1
  137. package/dist/src/__tests__/data/blocks/onMount.jsx +0 -13
  138. package/dist/src/types/generators.js +0 -1
@@ -3,10 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var angular_1 = require("../generators/angular");
4
4
  var jsx_1 = require("../parsers/jsx");
5
5
  var onUpdate = require('./data/blocks/onUpdate.raw');
6
+ var slot = require('./data/blocks/slot.raw');
6
7
  describe('Angular', function () {
7
8
  test('onUpdate', function () {
8
9
  var component = (0, jsx_1.parseJsx)(onUpdate);
9
10
  var output = (0, angular_1.componentToAngular)()({ component: component });
10
11
  expect(output).toMatchSnapshot();
11
12
  });
13
+ test('ng-content', function () {
14
+ var component = (0, jsx_1.parseJsx)(slot);
15
+ var output = (0, angular_1.componentToAngular)()({ component: component });
16
+ expect(output).toMatchSnapshot();
17
+ });
12
18
  });
@@ -5,7 +5,11 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
5
5
  };
6
6
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
7
  if (k2 === undefined) k2 = k;
8
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
9
13
  }) : (function(o, m, k, k2) {
10
14
  if (k2 === undefined) k2 = k;
11
15
  o[k2] = m[k];
@@ -0,0 +1 @@
1
+ export default function MultipleOnUpdate(): JSX.Element;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mitosis_1 = require("@builder.io/mitosis");
4
+ function MultipleOnUpdate() {
5
+ (0, mitosis_1.onUpdate)(function () {
6
+ console.log('Runs on every update/rerender');
7
+ });
8
+ (0, mitosis_1.onUpdate)(function () {
9
+ console.log('Runs on every update/rerender as well');
10
+ });
11
+ return <div />;
12
+ }
13
+ exports.default = MultipleOnUpdate;
@@ -0,0 +1 @@
1
+ export default function MultipleOnUpdateWithDeps(): JSX.Element;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mitosis_1 = require("@builder.io/mitosis");
4
+ function MultipleOnUpdateWithDeps() {
5
+ var state = (0, mitosis_1.useState)({
6
+ a: 'a',
7
+ b: 'b',
8
+ c: 'c',
9
+ d: 'd',
10
+ });
11
+ (0, mitosis_1.onUpdate)(function () {
12
+ console.log('Runs when a or b changes', state.a, state.b);
13
+ }, [state.a, state.b]);
14
+ (0, mitosis_1.onUpdate)(function () {
15
+ console.log('Runs when c or d changes', state.c, state.d);
16
+ }, [state.c, state.d]);
17
+ return <div />;
18
+ }
19
+ exports.default = MultipleOnUpdateWithDeps;
@@ -2,10 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var mitosis_1 = require("@builder.io/mitosis");
4
4
  function OnUpdateWithDeps() {
5
- var a, b;
5
+ var state = (0, mitosis_1.useState)({
6
+ a: 'a',
7
+ b: 'b',
8
+ });
6
9
  (0, mitosis_1.onUpdate)(function () {
7
- console.log('Runs when a or b changes');
8
- }, [a, b]);
10
+ console.log('Runs when a or b changes', state.a, state.b);
11
+ }, [state.a, state.b]);
9
12
  return <div />;
10
13
  }
11
14
  exports.default = OnUpdateWithDeps;
@@ -0,0 +1 @@
1
+ export default function MyComponent(props: any): 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 MyComponent(props) {
5
+ return (<div>
6
+ {props.name}
7
+ {props.children}
8
+ <mitosis_1.Show when={props.name === 'Batman'}>
9
+ <MyComponent name={'Bruce'}>
10
+ <div>Wayne</div>
11
+ </MyComponent>
12
+ </mitosis_1.Show>
13
+ </div>);
14
+ }
15
+ exports.default = MyComponent;
@@ -0,0 +1 @@
1
+ export default function MyComponent(props: any): JSX.Element;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mitosis_1 = require("@builder.io/mitosis");
4
+ function MyComponent(props) {
5
+ return (<div>
6
+ {props.name}
7
+ <mitosis_1.Show when={props.name === 'Batman'}>
8
+ <MyComponent name={'Bruce Wayne'}/>
9
+ </mitosis_1.Show>
10
+ </div>);
11
+ }
12
+ exports.default = MyComponent;
@@ -0,0 +1,6 @@
1
+ declare type SmileReviewsProps = {
2
+ productId: string;
3
+ apiKey: string;
4
+ };
5
+ export default function SmileReviews(props: SmileReviewsProps): JSX.Element;
6
+ export {};
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mitosis_1 = require("@builder.io/mitosis");
4
+ (0, mitosis_1.useMetadata)({ isAttachedToShadowDom: true });
5
+ function SmileReviews(props) {
6
+ var state = (0, mitosis_1.useState)({
7
+ reviews: [],
8
+ name: 'test',
9
+ showReviewPrompt: false,
10
+ });
11
+ // TODO: allow async function here
12
+ (0, mitosis_1.onMount)(function () {
13
+ fetch("https://stamped.io/api/widget/reviews?storeUrl=builder-io.myshopify.com&apiKey=".concat(props.apiKey || 'pubkey-8bbDq7W6w4sB3OWeM1HUy2s47702hM', "&productId=").concat(props.productId || '2410511106127'))
14
+ .then(function (res) { return res.json(); })
15
+ .then(function (data) {
16
+ state.reviews = data.data;
17
+ });
18
+ });
19
+ return (<div data-user={state.name}>
20
+ <button onClick={function () { return (state.showReviewPrompt = true); }}>
21
+ Write a review
22
+ </button>
23
+ <mitosis_1.Show when={state.showReviewPrompt}>
24
+ <input placeholder="Email"/>
25
+
26
+ <input css={{ display: 'block' }} placeholder="Title"/>
27
+
28
+ <textarea css={{ display: 'block' }} placeholder="How was your experience?"/>
29
+ <button css={{ display: 'block' }} onClick={function () {
30
+ state.showReviewPrompt = false;
31
+ }}>
32
+ Submit
33
+ </button>
34
+ </mitosis_1.Show>
35
+ <mitosis_1.For each={state.reviews}>
36
+ {function (review, index) { return (<div $name="Review" key={review.id} css={{
37
+ margin: '10px',
38
+ padding: '10px',
39
+ background: 'white',
40
+ display: 'flex',
41
+ borderRadius: '5px',
42
+ boxShadow: '0 2px 5px rgba(0, 0, 0, 0.1)',
43
+ }}>
44
+ <img css={{ height: '30px', width: '30px', marginRight: '10px' }} src={review.avatar}/>
45
+ <div class={state.showReviewPrompt ? 'bg-primary' : 'bg-secondary'}>
46
+ <div>N: {index}</div>
47
+ <div>{review.author}</div>
48
+ <div>{review.reviewMessage}</div>
49
+ </div>
50
+ </div>); }}
51
+ </mitosis_1.For>
52
+ </div>);
53
+ }
54
+ exports.default = SmileReviews;
@@ -0,0 +1,5 @@
1
+ declare type Props = {
2
+ [key: string]: string;
3
+ };
4
+ export default function SlotCode(props: Props): JSX.Element;
5
+ export {};
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function SlotCode(props) {
4
+ return <div>{props.children}</div>;
5
+ }
6
+ exports.default = SlotCode;
@@ -1,11 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var mitosis_1 = require("@builder.io/mitosis");
4
+ var lodash_1 = require("lodash");
5
+ var lodash_2 = require("lodash");
4
6
  function SmileReviews(props) {
5
7
  var state = (0, mitosis_1.useState)({
6
8
  reviews: [],
7
9
  name: 'test',
8
10
  showReviewPrompt: false,
11
+ kebabCaseValue: function () {
12
+ return (0, lodash_1.kebabCase)('testThat');
13
+ },
14
+ snakeCaseValue: function () {
15
+ return (0, lodash_2.snakeCase)('testThis');
16
+ },
9
17
  });
10
18
  // TODO: allow async function here
11
19
  (0, mitosis_1.onMount)(function () {
@@ -0,0 +1 @@
1
+ export default function OnUpdate(): JSX.Element;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mitosis_1 = require("@builder.io/mitosis");
4
+ function OnUpdate() {
5
+ (0, mitosis_1.onUpdate)(function () {
6
+ console.log('Runs on every update/rerender');
7
+ });
8
+ return <div />;
9
+ }
10
+ exports.default = OnUpdate;
@@ -1,2 +1,9 @@
1
- declare const _default: any;
1
+ declare const _default: import("@builder.io/mitosis").Context<{
2
+ foo: string;
3
+ readonly fooUpperCase: any;
4
+ someMethod(): any;
5
+ content: null;
6
+ context: any;
7
+ state: {};
8
+ }>;
2
9
  export default _default;
@@ -3,10 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var html_1 = require("../generators/html");
4
4
  var jsx_1 = require("../parsers/jsx");
5
5
  var stamped = require('./data/blocks/stamped-io.raw');
6
+ var shadowDom = require('./data/blocks/shadow-dom.raw');
6
7
  describe('Html', function () {
7
8
  test('Stamped', function () {
8
9
  var component = (0, jsx_1.parseJsx)(stamped);
9
10
  var html = (0, html_1.componentToHtml)()({ component: component });
10
11
  expect(html).toMatchSnapshot();
11
12
  });
13
+ test('Shadow DOM', function () {
14
+ var component = (0, jsx_1.parseJsx)(shadowDom);
15
+ var html = (0, html_1.componentToHtml)()({ component: component });
16
+ expect(html).toMatchSnapshot();
17
+ });
12
18
  });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var directives_1 = require("../generators/qwik/directives");
4
+ describe('qwik directives', function () {
5
+ var partial = expect.objectContaining;
6
+ beforeEach(function () {
7
+ global.h = mockH;
8
+ });
9
+ afterEach(function () { return (global.h = undefined); });
10
+ describe('Image', function () {
11
+ test('altText', function () {
12
+ expect((0, directives_1.Image)({ altText: 'foo', image: 'http://some.url' }).children[0][0]).toEqual(partial({
13
+ tag: 'img',
14
+ props: partial({ src: 'http://some.url', alt: 'foo' }),
15
+ }));
16
+ expect((0, directives_1.Image)({ image: 'http://some.url' }).children[0][0]).toEqual(partial({
17
+ tag: 'img',
18
+ props: partial({ src: 'http://some.url', role: 'presentation' }),
19
+ }));
20
+ });
21
+ test('builder-pixel is eager', function () {
22
+ expect((0, directives_1.Image)({
23
+ builderBlock: { id: 'builder-pixel-foo' },
24
+ image: 'http://some.url',
25
+ }).children[0][0]).toEqual(partial({
26
+ tag: 'img',
27
+ props: partial({ loading: 'eager' }),
28
+ }));
29
+ });
30
+ test('images are lazy loaded', function () {
31
+ expect((0, directives_1.Image)({
32
+ image: 'http://some.url',
33
+ }).children[0][0]).toEqual(partial({
34
+ tag: 'img',
35
+ props: partial({ loading: 'lazy' }),
36
+ }));
37
+ });
38
+ test('builder.io URLs are served using webp', function () {
39
+ expect(find('source', (0, directives_1.Image)({
40
+ image: 'http://foo.builder.io/foo',
41
+ }))).toEqual(partial({
42
+ tag: 'source',
43
+ props: partial({
44
+ srcset: srcSet('http://foo.builder.io/foo?format=webp'),
45
+ type: 'image/webp',
46
+ }),
47
+ }));
48
+ });
49
+ test('maxWidth is added to the srcs', function () {
50
+ expect(find('source', (0, directives_1.Image)({
51
+ image: 'http://foo.builder.io/foo',
52
+ srcsetSizes: '1234 456',
53
+ }))).toEqual(partial({
54
+ tag: 'source',
55
+ props: partial({
56
+ srcset: srcSet('http://foo.builder.io/foo?format=webp', '1234 456'),
57
+ type: 'image/webp',
58
+ }),
59
+ }));
60
+ });
61
+ test('anchor should wrap in <a>', function () {
62
+ expect(find('a', (0, directives_1.Image)({
63
+ image: 'http://some.url',
64
+ href: 'my-url',
65
+ }))).toEqual(partial({
66
+ tag: 'a',
67
+ props: partial({ href: 'my-url' }),
68
+ }));
69
+ });
70
+ });
71
+ });
72
+ function find(tag, jsx) {
73
+ if (tag == jsx.tag)
74
+ return jsx;
75
+ return findInChildren(tag, jsx.children);
76
+ function findInChildren(tag, jsxs) {
77
+ var value = undefined;
78
+ for (var i = 0; i < jsxs.length; i++) {
79
+ var jsx_1 = jsxs[i];
80
+ if (Array.isArray(jsx_1)) {
81
+ value = findInChildren(tag, jsx_1);
82
+ }
83
+ else {
84
+ value = find(tag, jsx_1);
85
+ }
86
+ if (value)
87
+ return value;
88
+ }
89
+ return undefined;
90
+ }
91
+ }
92
+ var mockH = function (tag, props, children) { return ({
93
+ tag: tag,
94
+ props: props,
95
+ children: children,
96
+ }); };
97
+ function srcSet(url, additionalSizes) {
98
+ if (additionalSizes === void 0) { additionalSizes = ''; }
99
+ return ['100', '200', '400', '800', '1200', '1600', '2000']
100
+ .concat(additionalSizes ? additionalSizes.split(' ') : [])
101
+ .map(function (size) {
102
+ var parsedUrl = new URL(url);
103
+ parsedUrl.searchParams.set('width', size);
104
+ return "".concat(parsedUrl, " ").concat(size, "w");
105
+ })
106
+ .join(', ');
107
+ }