@builder.io/mitosis 0.0.50-8 → 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 (136) hide show
  1. package/dist/src/__tests__/angular.test.d.ts +1 -0
  2. package/dist/src/__tests__/angular.test.js +18 -0
  3. package/dist/src/__tests__/builder.test.d.ts +1 -0
  4. package/dist/src/__tests__/builder.test.js +235 -0
  5. package/dist/src/__tests__/context.test.d.ts +1 -0
  6. package/dist/src/__tests__/context.test.js +35 -0
  7. package/dist/src/__tests__/data/blocks/onUpdate.raw copy.d.ts +1 -0
  8. package/dist/src/__tests__/data/blocks/onUpdate.raw copy.jsx +10 -0
  9. package/dist/src/__tests__/data/blocks/self-referencing-component-with-children.raw.d.ts +1 -0
  10. package/dist/src/__tests__/data/blocks/self-referencing-component-with-children.raw.jsx +15 -0
  11. package/dist/src/__tests__/data/blocks/self-referencing-component.raw.d.ts +1 -0
  12. package/dist/src/__tests__/data/blocks/self-referencing-component.raw.jsx +12 -0
  13. package/dist/src/__tests__/data/blocks/slot.raw.d.ts +5 -0
  14. package/dist/src/__tests__/data/blocks/slot.raw.jsx +6 -0
  15. package/dist/src/__tests__/data/blocks/styles.raw.d.ts +1 -0
  16. package/dist/src/__tests__/data/blocks/styles.raw.jsx +10 -0
  17. package/dist/src/__tests__/html.test.d.ts +1 -0
  18. package/dist/src/__tests__/html.test.js +18 -0
  19. package/dist/src/__tests__/liquid.test.d.ts +1 -0
  20. package/dist/src/__tests__/liquid.test.js +108 -0
  21. package/dist/src/__tests__/parse-jsx.test.d.ts +1 -0
  22. package/dist/src/__tests__/parse-jsx.test.js +15 -0
  23. package/dist/src/__tests__/qwik.directive.test.d.ts +1 -0
  24. package/dist/src/__tests__/qwik.directive.test.js +107 -0
  25. package/dist/src/__tests__/qwik.test.d.ts +1 -0
  26. package/dist/src/__tests__/qwik.test.js +434 -0
  27. package/dist/src/__tests__/react-native.test.d.ts +1 -0
  28. package/dist/src/__tests__/react-native.test.js +140 -0
  29. package/dist/src/__tests__/react.test.d.ts +1 -0
  30. package/dist/src/__tests__/react.test.js +141 -0
  31. package/dist/src/__tests__/solid.test.d.ts +1 -0
  32. package/dist/src/__tests__/solid.test.js +102 -0
  33. package/dist/src/__tests__/stencil.test.d.ts +1 -0
  34. package/dist/src/__tests__/stencil.test.js +102 -0
  35. package/dist/src/__tests__/svelte.test.d.ts +1 -0
  36. package/dist/src/__tests__/svelte.test.js +36 -0
  37. package/dist/src/__tests__/vue.test.d.ts +1 -0
  38. package/dist/src/__tests__/vue.test.js +139 -0
  39. package/dist/src/__tests__/webcomponent.test.d.ts +1 -0
  40. package/dist/src/__tests__/webcomponent.test.js +12 -0
  41. package/dist/src/constants/html_tags.d.ts +1 -0
  42. package/dist/src/constants/html_tags.js +119 -0
  43. package/dist/src/generators/angular.js +1 -1
  44. package/dist/src/generators/context/react copy.d.ts +8 -0
  45. package/dist/src/generators/context/react copy.js +28 -0
  46. package/dist/src/generators/context/solid.d.ts +8 -0
  47. package/dist/src/generators/context/solid.js +28 -0
  48. package/dist/src/generators/context/svelte.d.ts +8 -0
  49. package/dist/src/generators/context/svelte.js +28 -0
  50. package/dist/src/generators/helpers/context.d.ts +2 -0
  51. package/dist/src/generators/helpers/context.js +8 -0
  52. package/dist/src/generators/mitosis.js +4 -3
  53. package/dist/src/generators/qwik/component.js +3 -1
  54. package/dist/src/generators/qwik/directives.d.ts +14 -5
  55. package/dist/src/generators/qwik/directives.js +22 -14
  56. package/dist/src/generators/qwik/jsx.js +14 -2
  57. package/dist/src/generators/qwik/src-generator.js +47 -24
  58. package/dist/src/generators/react.js +2 -5
  59. package/dist/src/generators/solid.js +82 -8
  60. package/dist/src/generators/stencil/generate.js +1 -1
  61. package/dist/src/generators/svelte.d.ts +9 -1
  62. package/dist/src/generators/svelte.js +170 -77
  63. package/dist/src/generators/vue.js +4 -1
  64. package/dist/src/helpers/babel-transform copy.d.ts +8 -0
  65. package/dist/src/helpers/babel-transform copy.js +138 -0
  66. package/dist/src/helpers/babel-transform.d.ts +4 -7
  67. package/dist/src/helpers/babel-transform.js +13 -1
  68. package/dist/src/helpers/babel-transform.test.d.ts +1 -0
  69. package/dist/src/helpers/babel-transform.test.js +7 -0
  70. package/dist/src/helpers/generic-format.test.d.ts +1 -0
  71. package/dist/src/helpers/generic-format.test.js +8 -0
  72. package/dist/src/helpers/get-state-object-string.js +2 -1
  73. package/dist/src/helpers/parsers.d.ts +8 -0
  74. package/dist/src/helpers/parsers.js +66 -0
  75. package/dist/src/helpers/remove-surrounding-block.test.d.ts +1 -0
  76. package/dist/src/helpers/remove-surrounding-block.test.js +9 -0
  77. package/dist/src/helpers/render-imports.d.ts +2 -4
  78. package/dist/src/helpers/render-imports.js +32 -14
  79. package/dist/src/index.d.ts +2 -0
  80. package/dist/src/index.js +2 -0
  81. package/dist/src/parsers/builder.d.ts +0 -2
  82. package/dist/src/parsers/builder.js +5 -33
  83. package/dist/src/parsers/jsx.d.ts +7 -0
  84. package/dist/src/parsers/jsx.js +7 -0
  85. package/dist/src/types/mitosis-component.d.ts +0 -1
  86. package/dist/test/qwik/Accordion/high.jsx +0 -0
  87. package/dist/test/qwik/Accordion/low.jsx +207 -0
  88. package/dist/test/qwik/Accordion/med.jsx +10 -0
  89. package/dist/test/qwik/For/high.jsx +0 -0
  90. package/dist/test/qwik/For/low.jsx +33 -0
  91. package/dist/test/qwik/For/med.jsx +10 -0
  92. package/dist/test/qwik/Image/high.js +9 -0
  93. package/dist/test/qwik/Image/low.js +0 -0
  94. package/dist/test/qwik/Image/med.js +149 -0
  95. package/dist/test/qwik/Image.slow/high.js +9 -0
  96. package/dist/test/qwik/Image.slow/low.js +0 -0
  97. package/dist/test/qwik/Image.slow/med.js +149 -0
  98. package/dist/test/qwik/bindings/high.cjs +0 -0
  99. package/dist/test/qwik/bindings/low.cjs +33 -0
  100. package/dist/test/qwik/bindings/med.cjs +12 -0
  101. package/dist/test/qwik/button/high.js +3 -0
  102. package/dist/test/qwik/button/low.js +11 -0
  103. package/dist/test/qwik/button/med.js +37 -0
  104. package/dist/test/qwik/component/bindings/high.jsx +0 -0
  105. package/dist/test/qwik/component/bindings/low.jsx +43 -0
  106. package/dist/test/qwik/component/bindings/med.jsx +53 -0
  107. package/dist/test/qwik/component/component/inputs/high.cjsx +9 -0
  108. package/dist/test/qwik/component/component/inputs/low.cjsx +0 -0
  109. package/dist/test/qwik/component/component/inputs/med.cjsx +65 -0
  110. package/dist/test/qwik/hello_world/stylesheet/high.jsx +0 -0
  111. package/dist/test/qwik/hello_world/stylesheet/low.jsx +12 -0
  112. package/dist/test/qwik/hello_world/stylesheet/med.jsx +10 -0
  113. package/dist/test/qwik/page-with-symbol/high.js +0 -0
  114. package/dist/test/qwik/page-with-symbol/low.js +19 -0
  115. package/dist/test/qwik/page-with-symbol/med.js +10 -0
  116. package/dist/test/qwik/show-hide/high.jsx +9 -0
  117. package/dist/test/qwik/show-hide/low.jsx +0 -0
  118. package/dist/test/qwik/show-hide/med.jsx +174 -0
  119. package/dist/test/qwik/svg/high.js +0 -0
  120. package/dist/test/qwik/svg/low.js +13 -0
  121. package/dist/test/qwik/svg/med.js +10 -0
  122. package/dist/test/qwik/todo/Todo.cjs/high.cjs +23 -0
  123. package/dist/test/qwik/todo/Todo.cjs/low.cjs +0 -0
  124. package/dist/test/qwik/todo/Todo.cjs/med.cjs +48 -0
  125. package/dist/test/qwik/todo/Todo.js/high.js +22 -0
  126. package/dist/test/qwik/todo/Todo.js/low.js +0 -0
  127. package/dist/test/qwik/todo/Todo.js/med.js +45 -0
  128. package/dist/test/qwik/todo/Todo.tsx/high.tsx +22 -0
  129. package/dist/test/qwik/todo/Todo.tsx/low.tsx +0 -0
  130. package/dist/test/qwik/todo/Todo.tsx/med.tsx +41 -0
  131. package/dist/test/qwik/todos/Todo.tsx/high.tsx +7 -0
  132. package/dist/test/qwik/todos/Todo.tsx/low.tsx +27 -0
  133. package/dist/test/qwik/todos/Todo.tsx/med.tsx +9 -0
  134. package/dist/tsconfig.build.tsbuildinfo +1 -1
  135. package/dist/tsconfig.tsbuildinfo +1 -0
  136. package/package.json +6 -5
@@ -0,0 +1,149 @@
1
+ import {
2
+ Fragment,
3
+ componentQrl,
4
+ h,
5
+ qrl,
6
+ useLexicalScope,
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 = (state) => {
11
+ if (state.myState === undefined) state.myState = "initialValue";
12
+ typeof __STATE__ === "object" &&
13
+ Object.assign(state, __STATE__[state.serverStateId]);
14
+ withScopedStylesQrl(qrl("./med.js", "MyComponent_styles", []));
15
+ return qrl("./med.js", "MyComponent_onRender", [state]);
16
+ };
17
+ export const MyComponent = componentQrl(
18
+ qrl("./med.js", "MyComponent_onMount", [])
19
+ );
20
+ export const MyComponent_onRender = () => {
21
+ const state = useLexicalScope()[0];
22
+ return h(
23
+ Fragment,
24
+ null,
25
+ h(Image, {
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",
34
+ onClickQrl: 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
+ innerHTML: (() => {
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 Image = function Image(props) {
59
+ var _a;
60
+ var jsx = props.children || [];
61
+ var image = props.image;
62
+ if (image) {
63
+ var isBuilderIoImage = !!(image || "").match(/\.builder\.io/);
64
+ var isPixel =
65
+ (_a = props.builderBlock) === null || _a === void 0
66
+ ? void 0
67
+ : _a.id.startsWith("builder-pixel-");
68
+ var imgProps = {
69
+ src: props.image,
70
+ style:
71
+ "object-fit:"
72
+ .concat(props.backgroundSize || "cover", ";object-position:")
73
+ .concat(props.backgroundPosition || "center", ";") +
74
+ (props.aspectRatio
75
+ ? "position:absolute;height:100%;width:100%;top:0;left:0"
76
+ : ""),
77
+ sizes: props.sizes,
78
+ alt: props.altText,
79
+ role: !props.altText ? "presentation" : undefined,
80
+ loading: isPixel ? "eager" : "lazy",
81
+ srcset: undefined,
82
+ };
83
+ if (isBuilderIoImage) {
84
+ image = updateQueryParam(image, "format", "webp");
85
+ var srcset = ["100", "200", "400", "800", "1200", "1600", "2000"]
86
+ .concat(props.srcsetSizes ? String(props.srcsetSizes).split(" ") : [])
87
+ .map(function (size) {
88
+ return updateQueryParam(image, "width", size) + " " + size + "w";
89
+ })
90
+ .join(",");
91
+ imgProps.srcset = srcset;
92
+ jsx = jsx = [
93
+ h("picture", {}, [
94
+ h("source", { type: "image/webp", srcset: srcset }),
95
+ h("img", imgProps, jsx),
96
+ ]),
97
+ ];
98
+ } else {
99
+ jsx = [h("img", imgProps, jsx)];
100
+ }
101
+ if (
102
+ props.aspectRatio &&
103
+ !(props.fitContent && props.children && props.children.length)
104
+ ) {
105
+ var sizingDiv = h("div", {
106
+ class: "builder-image-sizer",
107
+ style: "width:100%;padding-top:".concat(
108
+ (props.aspectRatio || 1) * 100,
109
+ "%;pointer-events:none;font-size:0"
110
+ ),
111
+ });
112
+ jsx.push(sizingDiv);
113
+ }
114
+ }
115
+ var children = props.children ? [jsx].concat(props.children) : [jsx];
116
+ return h(
117
+ props.href ? "a" : "div",
118
+ __passThroughProps__({ href: props.href, class: props.class }, props),
119
+ children
120
+ );
121
+ function updateQueryParam(uri, key, value) {
122
+ if (uri === void 0) {
123
+ uri = "";
124
+ }
125
+ var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
126
+ var separator = uri.indexOf("?") !== -1 ? "&" : "?";
127
+ if (uri.match(re)) {
128
+ return uri.replace(
129
+ re,
130
+ "$1" + key + "=" + encodeURIComponent(value) + "$2"
131
+ );
132
+ }
133
+ return uri + separator + key + "=" + encodeURIComponent(value);
134
+ }
135
+ };
136
+ export const __passThroughProps__ = function __passThroughProps__(
137
+ dstProps,
138
+ srcProps
139
+ ) {
140
+ for (var key in srcProps) {
141
+ if (
142
+ Object.prototype.hasOwnProperty.call(srcProps, key) &&
143
+ ((key.startsWith("on") && key.endsWith("Qrl")) || key == "style")
144
+ ) {
145
+ dstProps[key] = srcProps[key];
146
+ }
147
+ }
148
+ return dstProps;
149
+ };
@@ -0,0 +1,9 @@
1
+ import { useLexicalScope } from "@builder.io/qwik";
2
+ export const MyComponent_onClick_0 = () => {
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
@@ -0,0 +1,149 @@
1
+ import {
2
+ Fragment,
3
+ componentQrl,
4
+ h,
5
+ qrl,
6
+ useLexicalScope,
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 = (state) => {
11
+ if (state.myState === undefined) state.myState = "initialValue";
12
+ typeof __STATE__ === "object" &&
13
+ Object.assign(state, __STATE__[state.serverStateId]);
14
+ withScopedStylesQrl(qrl("./med.js", "MyComponent_styles", []));
15
+ return qrl("./med.js", "MyComponent_onRender", [state]);
16
+ };
17
+ export const MyComponent = componentQrl(
18
+ qrl("./med.js", "MyComponent_onMount", [])
19
+ );
20
+ export const MyComponent_onRender = () => {
21
+ const state = useLexicalScope()[0];
22
+ return h(
23
+ Fragment,
24
+ null,
25
+ h(Image, {
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",
34
+ onClickQrl: 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
+ innerHTML: (() => {
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 Image = function Image(props) {
59
+ var _a;
60
+ var jsx = props.children || [];
61
+ var image = props.image;
62
+ if (image) {
63
+ var isBuilderIoImage = !!(image || "").match(/\.builder\.io/);
64
+ var isPixel =
65
+ (_a = props.builderBlock) === null || _a === void 0
66
+ ? void 0
67
+ : _a.id.startsWith("builder-pixel-");
68
+ var imgProps = {
69
+ src: props.image,
70
+ style:
71
+ "object-fit:"
72
+ .concat(props.backgroundSize || "cover", ";object-position:")
73
+ .concat(props.backgroundPosition || "center", ";") +
74
+ (props.aspectRatio
75
+ ? "position:absolute;height:100%;width:100%;top:0;left:0"
76
+ : ""),
77
+ sizes: props.sizes,
78
+ alt: props.altText,
79
+ role: !props.altText ? "presentation" : undefined,
80
+ loading: isPixel ? "eager" : "lazy",
81
+ srcset: undefined,
82
+ };
83
+ if (isBuilderIoImage) {
84
+ image = updateQueryParam(image, "format", "webp");
85
+ var srcset = ["100", "200", "400", "800", "1200", "1600", "2000"]
86
+ .concat(props.srcsetSizes ? String(props.srcsetSizes).split(" ") : [])
87
+ .map(function (size) {
88
+ return updateQueryParam(image, "width", size) + " " + size + "w";
89
+ })
90
+ .join(",");
91
+ imgProps.srcset = srcset;
92
+ jsx = jsx = [
93
+ h("picture", {}, [
94
+ h("source", { type: "image/webp", srcset: srcset }),
95
+ h("img", imgProps, jsx),
96
+ ]),
97
+ ];
98
+ } else {
99
+ jsx = [h("img", imgProps, jsx)];
100
+ }
101
+ if (
102
+ props.aspectRatio &&
103
+ !(props.fitContent && props.children && props.children.length)
104
+ ) {
105
+ var sizingDiv = h("div", {
106
+ class: "builder-image-sizer",
107
+ style: "width:100%;padding-top:".concat(
108
+ (props.aspectRatio || 1) * 100,
109
+ "%;pointer-events:none;font-size:0"
110
+ ),
111
+ });
112
+ jsx.push(sizingDiv);
113
+ }
114
+ }
115
+ var children = props.children ? [jsx].concat(props.children) : [jsx];
116
+ return h(
117
+ props.href ? "a" : "div",
118
+ __passThroughProps__({ href: props.href, class: props.class }, props),
119
+ children
120
+ );
121
+ function updateQueryParam(uri, key, value) {
122
+ if (uri === void 0) {
123
+ uri = "";
124
+ }
125
+ var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
126
+ var separator = uri.indexOf("?") !== -1 ? "&" : "?";
127
+ if (uri.match(re)) {
128
+ return uri.replace(
129
+ re,
130
+ "$1" + key + "=" + encodeURIComponent(value) + "$2"
131
+ );
132
+ }
133
+ return uri + separator + key + "=" + encodeURIComponent(value);
134
+ }
135
+ };
136
+ export const __passThroughProps__ = function __passThroughProps__(
137
+ dstProps,
138
+ srcProps
139
+ ) {
140
+ for (var key in srcProps) {
141
+ if (
142
+ Object.prototype.hasOwnProperty.call(srcProps, key) &&
143
+ ((key.startsWith("on") && key.endsWith("Qrl")) || key == "style")
144
+ ) {
145
+ dstProps[key] = srcProps[key];
146
+ }
147
+ }
148
+ return dstProps;
149
+ };
File without changes
@@ -0,0 +1,33 @@
1
+ const h = require("@builder.io/qwik").h;
2
+ const qrl = require("@builder.io/qwik").qrl;
3
+ const useLexicalScope = require("@builder.io/qwik").useLexicalScope;
4
+ exports.MyComponent_styles = `.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}`;
5
+ exports.MyComponent_onRender = () => {
6
+ const state = useLexicalScope()[0];
7
+ return h(
8
+ "div",
9
+ {
10
+ class: "cjrqfb1",
11
+ style: {
12
+ backgroundColor: (() => {
13
+ try {
14
+ return state.hilitTitle ? "red" : "gray";
15
+ } catch (err) {
16
+ console.warn("Builder code error", err);
17
+ }
18
+ })(),
19
+ },
20
+ },
21
+ h("div", {
22
+ class: "builder-text",
23
+ innerHTML: (() => {
24
+ try {
25
+ var _virtual_index = state.title;
26
+ return _virtual_index;
27
+ } catch (err) {
28
+ console.warn("Builder code error", err);
29
+ }
30
+ })(),
31
+ })
32
+ );
33
+ };
@@ -0,0 +1,12 @@
1
+ const componentQrl = require("@builder.io/qwik").componentQrl;
2
+ const qrl = require("@builder.io/qwik").qrl;
3
+ const withScopedStylesQrl = require("@builder.io/qwik").withScopedStylesQrl;
4
+ exports.MyComponent_onMount = (state) => {
5
+ if (state.title === undefined) state.title = '"Default title value"';
6
+ if (state.hiliteTitle === undefined) state.hiliteTitle = true;
7
+ typeof __STATE__ === "object" &&
8
+ Object.assign(state, __STATE__[state.serverStateId]);
9
+ withScopedStylesQrl(qrl("./low.js", "MyComponent_styles", []));
10
+ return qrl("./low.js", "MyComponent_onRender", [state]);
11
+ };
12
+ exports.MyComponent = componentQrl(qrl("./med.js", "MyComponent_onMount", []));
@@ -0,0 +1,3 @@
1
+ export const MyComponent_onClick_0 = () => {
2
+ alert("WORKS!");
3
+ };
@@ -0,0 +1,11 @@
1
+ import { CoreButton } from "./med.js";
2
+ import { h, qrl, useLexicalScope } from "@builder.io/qwik";
3
+ export const MyComponent_styles = `.c9nzze9{display:flex;flex-direction:column;position:relative;flex-shrink:0;box-sizing:border-box;margin-top:20px;appearance:none;padding-top:15px;padding-bottom:15px;padding-left:25px;padding-right:25px;background-color:#3898EC;color:white;border-radius:4px;text-align:center;cursor:pointer}`;
4
+ export const MyComponent_onRender = () => {
5
+ const state = useLexicalScope()[0];
6
+ return h(CoreButton, {
7
+ text: "Click me!",
8
+ class: "c9nzze9",
9
+ onClickQrl: qrl("./high.js", "MyComponent_onClick_0", [state]),
10
+ });
11
+ };
@@ -0,0 +1,37 @@
1
+ import { componentQrl, h, qrl, withScopedStylesQrl } from "@builder.io/qwik";
2
+ export const MyComponent_onMount = (state) => {
3
+ typeof __STATE__ === "object" &&
4
+ Object.assign(state, __STATE__[state.serverStateId]);
5
+ withScopedStylesQrl(qrl("./low.js", "MyComponent_styles", []));
6
+ return qrl("./low.js", "MyComponent_onRender", [state]);
7
+ };
8
+ export const MyComponent = componentQrl(
9
+ qrl("./med.js", "MyComponent_onMount", [])
10
+ );
11
+ export const CoreButton = function CoreButton(props) {
12
+ var hasLink = !!props.link;
13
+ var hProps = {
14
+ innerHTML: props.text || "",
15
+ href: props.link,
16
+ target: props.openInNewTab ? "_blank" : "_self",
17
+ class: props.class,
18
+ };
19
+ return h(
20
+ hasLink ? "a" : props.tagName$ || "span",
21
+ __passThroughProps__(hProps, props)
22
+ );
23
+ };
24
+ export const __passThroughProps__ = function __passThroughProps__(
25
+ dstProps,
26
+ srcProps
27
+ ) {
28
+ for (var key in srcProps) {
29
+ if (
30
+ Object.prototype.hasOwnProperty.call(srcProps, key) &&
31
+ ((key.startsWith("on") && key.endsWith("Qrl")) || key == "style")
32
+ ) {
33
+ dstProps[key] = srcProps[key];
34
+ }
35
+ }
36
+ return dstProps;
37
+ };
File without changes
@@ -0,0 +1,43 @@
1
+ import { ComponentD187055AF171488FAD843ACF045D6BF7 } from "./med.js";
2
+ import { Fragment, h, qrl, useLexicalScope } from "@builder.io/qwik";
3
+ export const ComponentD187055AF171488FAD843ACF045D6BF7_styles = `.cj49hqu{display:flex;flex-direction:column;position:relative;flex-shrink:0;box-sizing:border-box;margin-top:20px;height:auto;background-color:rgba(227, 227, 227, 1);border-radius:5px;border-style:solid;border-color:rgb(0, 0, 0);border-width:1px;padding-bottom:30px}.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}`;
4
+ export const ComponentD187055AF171488FAD843ACF045D6BF7_onRender = () => {
5
+ const state = useLexicalScope()[0];
6
+ return (
7
+ <div class="cj49hqu">
8
+ <div class="cjrqfb1">
9
+ <div
10
+ class="builder-text"
11
+ innerHTML={(() => {
12
+ try {
13
+ var _virtual_index = state.title;
14
+ return _virtual_index;
15
+ } catch (err) {
16
+ console.warn("Builder code error", err);
17
+ }
18
+ })()}
19
+ ></div>
20
+ </div>
21
+ </div>
22
+ );
23
+ };
24
+ export const MyComponent_styles = `.c713ty2{display:flex;flex-direction:column;position:relative;flex-shrink:0;box-sizing:border-box;margin-top:20px}`;
25
+ export const MyComponent_onRender = () => {
26
+ const state = useLexicalScope()[0];
27
+ return (
28
+ <>
29
+ <div class="c713ty2">
30
+ <ComponentD187055AF171488FAD843ACF045D6BF7
31
+ title="First title from parent"
32
+ serverStateId="woo8b6"
33
+ ></ComponentD187055AF171488FAD843ACF045D6BF7>
34
+ </div>
35
+ <div class="c713ty2">
36
+ <ComponentD187055AF171488FAD843ACF045D6BF7
37
+ title="Second title from parent"
38
+ serverStateId="woo8b6"
39
+ ></ComponentD187055AF171488FAD843ACF045D6BF7>
40
+ </div>
41
+ </>
42
+ );
43
+ };
@@ -0,0 +1,53 @@
1
+ import { componentQrl, qrl, withScopedStylesQrl } from "@builder.io/qwik";
2
+ export const ComponentD187055AF171488FAD843ACF045D6BF7_onMount = (state) => {
3
+ if (state.title === undefined) state.title = "default-title";
4
+ typeof __STATE__ === "object" &&
5
+ Object.assign(state, __STATE__[state.serverStateId]);
6
+ withScopedStylesQrl(
7
+ qrl("./low.js", "ComponentD187055AF171488FAD843ACF045D6BF7_styles", [])
8
+ );
9
+ return qrl("./low.js", "ComponentD187055AF171488FAD843ACF045D6BF7_onRender", [
10
+ state,
11
+ ]);
12
+ };
13
+ export const ComponentD187055AF171488FAD843ACF045D6BF7 = componentQrl(
14
+ qrl("./med.js", "ComponentD187055AF171488FAD843ACF045D6BF7_onMount", [])
15
+ );
16
+ export const MyComponent_onMount = (state) => {
17
+ typeof __STATE__ === "object" &&
18
+ Object.assign(state, __STATE__[state.serverStateId]);
19
+ (() => {
20
+ /*
21
+ * Global objects available:
22
+ *
23
+ * state - builder state object - learn about state https://www.builder.io/c/docs/guides/state-and-actions
24
+ * context - builder context object - learn about state https://github.com/BuilderIO/builder/tree/main/packages/react#passing-data-and-functions-down
25
+ * fetch - Fetch API - https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API'
26
+ * Builder - Builder object - useful values include: Builder.isServer, Builder.isBrowser, Builder.isPreviewing, Builder.isEditing
27
+ *
28
+ * visit https://www.builder.io/c/docs/guides/custom-code
29
+ * for more information on writing custom code
30
+ */
31
+ async function main() {
32
+ if (Builder.isServer) {
33
+ // Place any code here you want to only run on the server. Any
34
+ // data fetched on the server will be available to re-hydrate on the client
35
+ // if added to the state object
36
+ }
37
+
38
+ if (Builder.isBrowser) {
39
+ // Place code that you only want to run in the browser (client side only) here
40
+ // For example, anything that uses document/window access or DOM manipulation
41
+ }
42
+
43
+ state.something = "works!";
44
+ }
45
+
46
+ return main();
47
+ })();
48
+ withScopedStylesQrl(qrl("./low.js", "MyComponent_styles", []));
49
+ return qrl("./low.js", "MyComponent_onRender", [state]);
50
+ };
51
+ export const MyComponent = componentQrl(
52
+ qrl("./med.js", "MyComponent_onMount", [])
53
+ );
@@ -0,0 +1,9 @@
1
+ const useLexicalScope = require("@builder.io/qwik").useLexicalScope;
2
+ exports.MyComponent_onClick_0 = () => {
3
+ const state = useLexicalScope()[0];
4
+ try {
5
+ return (state.data = state.data + 1);
6
+ } catch (err) {
7
+ console.warn("Builder code error", err);
8
+ }
9
+ };
@@ -0,0 +1,65 @@
1
+ const Fragment = require("@builder.io/qwik").Fragment;
2
+ const componentQrl = require("@builder.io/qwik").componentQrl;
3
+ const h = require("@builder.io/qwik").h;
4
+ const qrl = require("@builder.io/qwik").qrl;
5
+ const useLexicalScope = require("@builder.io/qwik").useLexicalScope;
6
+ const withScopedStylesQrl = require("@builder.io/qwik").withScopedStylesQrl;
7
+ exports.MyComponent_styles = `.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}.c9nzze9{display:flex;flex-direction:column;position:relative;flex-shrink:0;box-sizing:border-box;margin-top:20px;appearance:none;padding-top:15px;padding-bottom:15px;padding-left:25px;padding-right:25px;background-color:#3898EC;color:white;border-radius:4px;text-align:center;cursor:pointer}`;
8
+ exports.MyComponent_onMount = (state) => {
9
+ if (state.data === undefined) state.data = 0;
10
+ typeof __STATE__ === "object" &&
11
+ Object.assign(state, __STATE__[state.serverStateId]);
12
+ withScopedStylesQrl(qrl("./med.js", "MyComponent_styles", []));
13
+ return qrl("./med.js", "MyComponent_onRender", [state]);
14
+ };
15
+ exports.MyComponent = componentQrl(qrl("./med.js", "MyComponent_onMount", []));
16
+ exports.MyComponent_onRender = () => {
17
+ const state = useLexicalScope()[0];
18
+ return (
19
+ <>
20
+ <div class="cjrqfb1">
21
+ <div
22
+ class="builder-text"
23
+ innerHTML={(() => {
24
+ try {
25
+ var _virtual_index = state.data;
26
+ return _virtual_index;
27
+ } catch (err) {
28
+ console.warn("Builder code error", err);
29
+ }
30
+ })()}
31
+ ></div>
32
+ </div>
33
+ <CoreButton
34
+ text="Something else"
35
+ class="c9nzze9"
36
+ onClickQrl={qrl("./high.js", "MyComponent_onClick_0", [state])}
37
+ ></CoreButton>
38
+ </>
39
+ );
40
+ };
41
+ const CoreButton = (exports.CoreButton = function CoreButton(props) {
42
+ var hasLink = !!props.link;
43
+ var hProps = {
44
+ innerHTML: props.text || "",
45
+ href: props.link,
46
+ target: props.openInNewTab ? "_blank" : "_self",
47
+ class: props.class,
48
+ };
49
+ return h(
50
+ hasLink ? "a" : props.tagName$ || "span",
51
+ __passThroughProps__(hProps, props)
52
+ );
53
+ });
54
+ const __passThroughProps__ = (exports.__passThroughProps__ =
55
+ function __passThroughProps__(dstProps, srcProps) {
56
+ for (var key in srcProps) {
57
+ if (
58
+ Object.prototype.hasOwnProperty.call(srcProps, key) &&
59
+ ((key.startsWith("on") && key.endsWith("Qrl")) || key == "style")
60
+ ) {
61
+ dstProps[key] = srcProps[key];
62
+ }
63
+ }
64
+ return dstProps;
65
+ });
File without changes
@@ -0,0 +1,12 @@
1
+ import { h, qrl, useLexicalScope } from "@builder.io/qwik";
2
+ export const MyComponent_styles = `.crt27f8{display:flex;flex-direction:column;position:relative;flex-shrink:0;box-sizing:border-box;margin-top:123px;line-height:normal;height:auto;text-align:center;margin-left:auto;margin-right:auto}`;
3
+ export const MyComponent_onRender = () => {
4
+ const state = useLexicalScope()[0];
5
+ return (
6
+ <div class="crt27f8">
7
+ <p>
8
+ Hello <span class="names">World</span>
9
+ </p>
10
+ </div>
11
+ );
12
+ };
@@ -0,0 +1,10 @@
1
+ import { componentQrl, qrl, withScopedStylesQrl } from "@builder.io/qwik";
2
+ export const MyComponent_onMount = (state) => {
3
+ typeof __STATE__ === "object" &&
4
+ Object.assign(state, __STATE__[state.serverStateId]);
5
+ withScopedStylesQrl(qrl("./low.js", "MyComponent_styles", []));
6
+ return qrl("./low.js", "MyComponent_onRender", [state]);
7
+ };
8
+ export const MyComponent = componentQrl(
9
+ qrl("./med.js", "MyComponent_onMount", [])
10
+ );
File without changes
@@ -0,0 +1,19 @@
1
+ import { Symbol1 } from "./med.js";
2
+ import { Fragment, h, qrl, useLexicalScope } from "@builder.io/qwik";
3
+ export const MyComponent_styles = `.c713ty2{display:flex;flex-direction:column;position:relative;flex-shrink:0;box-sizing:border-box;margin-top:20px}.cxvcn5v{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;padding-top:1em;padding-bottom:1em;font-weight:700;font-size:24px}`;
4
+ export const MyComponent_onRender = () => {
5
+ const state = useLexicalScope()[0];
6
+ return h(
7
+ Fragment,
8
+ null,
9
+ h(Symbol1, {
10
+ class: "c713ty2",
11
+ symbol: {
12
+ model: "page",
13
+ entry: "36da1052e57e47f084ea8b1fbde248e4",
14
+ data: {},
15
+ },
16
+ }),
17
+ h("div", { class: "cxvcn5v" }, "<p>Main Text</p>")
18
+ );
19
+ };
@@ -0,0 +1,10 @@
1
+ import { componentQrl, qrl, withScopedStylesQrl } from "@builder.io/qwik";
2
+ export const MyComponent_onMount = (state) => {
3
+ typeof __STATE__ === "object" &&
4
+ Object.assign(state, __STATE__[state.serverStateId]);
5
+ withScopedStylesQrl(qrl("./low.js", "MyComponent_styles", []));
6
+ return qrl("./low.js", "MyComponent_onRender", [state]);
7
+ };
8
+ export const MyComponent = componentQrl(
9
+ qrl("./med.js", "MyComponent_onMount", [])
10
+ );