@builder.io/mitosis 0.0.56-35 → 0.0.56-38

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.
@@ -1,6 +1,7 @@
1
1
  import { MitosisNode } from '../types/mitosis-node';
2
2
  import { BaseTranspilerOptions, Transpiler } from '../types/transpiler';
3
3
  export interface ToAngularOptions extends BaseTranspilerOptions {
4
+ standalone?: boolean;
4
5
  }
5
6
  interface AngularBlockOptions {
6
7
  contextVars?: string[];
@@ -283,7 +283,10 @@ var componentToAngular = function (options) {
283
283
  });
284
284
  },
285
285
  });
286
- var str = (0, dedent_1.default)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n import { ", " ", " Component ", "", " } from '@angular/core';\n\n ", "\n ", "\n ", "\n\n @Component({\n selector: '", "',\n template: `\n ", "\n `,\n ", "\n })\n export default class ", " {\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n\n }\n "], ["\n import { ", " ", " Component ", "", " } from '@angular/core';\n\n ", "\n ", "\n ", "\n\n @Component({\n selector: '", "',\n template: \\`\n ", "\n \\`,\n ", "\n })\n export default class ", " {\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n\n }\n "])), outputs.length ? 'Output, EventEmitter, \n' : '', ((_g = options === null || options === void 0 ? void 0 : options.experimental) === null || _g === void 0 ? void 0 : _g.inject) ? 'Inject, forwardRef,' : '', domRefs.size ? ', ViewChild, ElementRef' : '', props.size ? ', Input' : '', json.types ? json.types.join('\n') : '', json.interfaces ? (_h = json.interfaces) === null || _h === void 0 ? void 0 : _h.join('\n') : '', (0, render_imports_1.renderPreComponent)({ component: json, target: 'angular' }), (0, lodash_1.kebabCase)(json.name || 'my-component'), (0, indent_1.indent)(template, 8).replace(/`/g, '\\`').replace(/\$\{/g, '\\${'), css.length
286
+ var str = (0, dedent_1.default)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n import { ", " ", " Component ", "", " } from '@angular/core';\n ", "\n\n ", "\n ", "\n ", "\n\n @Component({\n ", "\n selector: '", "',\n template: `\n ", "\n `,\n ", "\n })\n export default class ", " {\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n\n }\n "], ["\n import { ", " ", " Component ", "", " } from '@angular/core';\n ", "\n\n ", "\n ", "\n ", "\n\n @Component({\n ", "\n selector: '", "',\n template: \\`\n ", "\n \\`,\n ", "\n })\n export default class ", " {\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n ", "\n\n ", "\n\n ", "\n\n }\n "])), outputs.length ? 'Output, EventEmitter, \n' : '', ((_g = options === null || options === void 0 ? void 0 : options.experimental) === null || _g === void 0 ? void 0 : _g.inject) ? 'Inject, forwardRef,' : '', domRefs.size ? ', ViewChild, ElementRef' : '', props.size ? ', Input' : '', options.standalone ? "import { CommonModule } from '@angular/common';" : '', json.types ? json.types.join('\n') : '', json.interfaces ? (_h = json.interfaces) === null || _h === void 0 ? void 0 : _h.join('\n') : '', (0, render_imports_1.renderPreComponent)({ component: json, target: 'angular' }), options.standalone
287
+ ? // TODO: also add child component imports here as well
288
+ "\n standalone: true,\n imports: [CommonModule],\n "
289
+ : '', (0, lodash_1.kebabCase)(json.name || 'my-component'), (0, indent_1.indent)(template, 8).replace(/`/g, '\\`').replace(/\$\{/g, '\\${'), css.length
287
290
  ? "styles: [\n `".concat((0, indent_1.indent)(css, 8), "`\n ],")
288
291
  : '', component.name, localExportVars.join('\n'), Array.from(props)
289
292
  .filter(function (item) { return !(0, slots_1.isSlotProperty)(item) && item !== 'children'; })
@@ -23,6 +23,7 @@ var collect_css_1 = require("../../helpers/styles/collect-css");
23
23
  var indent_1 = require("../../helpers/indent");
24
24
  var map_refs_1 = require("../../helpers/map-refs");
25
25
  var dash_case_1 = require("../../helpers/dash-case");
26
+ var has_props_1 = require("../../helpers/has-props");
26
27
  // Having issues with this, so off for now
27
28
  var USE_MARKO_PRETTIER = false;
28
29
  var blockToMarko = function (json, options) {
@@ -50,7 +51,7 @@ var blockToMarko = function (json, options) {
50
51
  .join('\n'), "</if>\n ").concat(!json.meta.else ? '' : "<else>".concat(blockToMarko(json.meta.else, options), "</else>"));
51
52
  }
52
53
  var str = '';
53
- str += "<".concat(json.name, " ");
54
+ str += "<".concat((0, dash_case_1.dashCase)(json.name), " ");
54
55
  var classString = (0, collect_class_string_1.collectClassString)(json);
55
56
  if (classString) {
56
57
  str += " class=".concat(classString, " ");
@@ -85,17 +86,17 @@ var blockToMarko = function (json, options) {
85
86
  if (json.children) {
86
87
  str += json.children.map(function (item) { return blockToMarko(item, options); }).join('\n');
87
88
  }
88
- str += "</".concat(json.name, ">");
89
+ str += "</".concat((0, dash_case_1.dashCase)(json.name), ">");
89
90
  return str;
90
91
  };
91
92
  function processBinding(code, type) {
92
93
  if (type === void 0) { type = 'attribute'; }
93
94
  return (0, strip_state_and_props_refs_1.stripStateAndPropsRefs)((0, strip_state_and_props_refs_1.stripStateAndPropsRefs)(code, {
94
- replaceWith: type === 'class' ? 'this.input.' : 'input.',
95
+ replaceWith: type === 'state' ? 'input.' : type === 'class' ? 'this.input.' : 'input.',
95
96
  includeProps: true,
96
97
  includeState: false,
97
98
  }), {
98
- replaceWith: type === 'class' ? 'this.state.' : 'state.',
99
+ replaceWith: type === 'state' ? 'this.' : type === 'class' ? 'this.state.' : 'state.',
99
100
  includeProps: false,
100
101
  includeState: true,
101
102
  });
@@ -120,8 +121,9 @@ var componentToMarko = function (options) {
120
121
  data: true,
121
122
  functions: true,
122
123
  getters: true,
123
- valueMapper: function (code) { return processBinding(code, 'class'); },
124
+ valueMapper: function (code) { return processBinding(code, 'state'); },
124
125
  });
126
+ var thisHasProps = (0, has_props_1.hasProps)(json);
125
127
  var methodsString = '';
126
128
  var hasState = dataString.length > 5;
127
129
  if (options.prettier !== false) {
@@ -137,13 +139,13 @@ var componentToMarko = function (options) {
137
139
  }
138
140
  var jsString = (0, dedent_1.default)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n\n class {\n ", "\n\n ", "\n \n ", "\n ", "\n ", "\n }\n "], ["\n ", "\n\n class {\n ", "\n\n ", "\n \n ", "\n ", "\n ", "\n }\n "])), (0, render_imports_1.renderPreComponent)({ component: json, target: 'marko' }), methodsString, !hasState
139
141
  ? ''
140
- : "onCreate() {\n this.state = ".concat(dataString, "\n }"), !((_b = json.hooks.onMount) === null || _b === void 0 ? void 0 : _b.code)
142
+ : "onCreate() {\n ".concat(thisHasProps ? 'const input = this.input;' : '', "\n this.state = ").concat(dataString, "\n }"), !((_b = json.hooks.onMount) === null || _b === void 0 ? void 0 : _b.code)
141
143
  ? ''
142
- : "onMount() { ".concat(processBinding(json.hooks.onMount.code), " }"), !((_c = json.hooks.onUnMount) === null || _c === void 0 ? void 0 : _c.code)
144
+ : "onMount() { ".concat(processBinding(json.hooks.onMount.code, 'class'), " }"), !((_c = json.hooks.onUnMount) === null || _c === void 0 ? void 0 : _c.code)
143
145
  ? ''
144
- : "onDestroy() { ".concat(processBinding(json.hooks.onUnMount.code), " }"), !((_d = json.hooks.onUpdate) === null || _d === void 0 ? void 0 : _d.length)
146
+ : "onDestroy() { ".concat(processBinding(json.hooks.onUnMount.code, 'class'), " }"), !((_d = json.hooks.onUpdate) === null || _d === void 0 ? void 0 : _d.length)
145
147
  ? ''
146
- : json.hooks.onUpdate.map(function (hook) { return "onRender() { ".concat(processBinding(hook.code), " }"); }));
148
+ : json.hooks.onUpdate.map(function (hook) { return "onRender() { ".concat(processBinding(hook.code, 'class'), " }"); }));
147
149
  var htmlString = json.children.map(function (item) { return blockToMarko(item, options); }).join('\n');
148
150
  var cssString = css.length
149
151
  ? "style { \n ".concat((0, indent_1.indent)(css, 2).trim(), "\n}")
@@ -1,17 +1,26 @@
1
- import { h, qrl, withScopedStylesQrl } from "@builder.io/qwik";
1
+ import {
2
+ Fragment,
3
+ h,
4
+ qrl,
5
+ useStore,
6
+ withScopedStylesQrl,
7
+ } from "@builder.io/qwik";
2
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}`;
3
- export const MyComponent_onMount = (state) => {
4
- if (!state.__INIT__) {
5
- state.__INIT__ = true;
6
- typeof __STATE__ === "object" &&
7
- Object.assign(state, __STATE__[state.serverStateId]);
8
- undefined;
9
- }
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
+ });
10
18
  withScopedStylesQrl(qrl("./low.js", "MyComponent_styles", []));
11
19
  return (
12
20
  <div
21
+ builder-id="builder-bb2f62792e464d73b7cb89258027f356"
13
22
  gridRowWidth="25%"
14
- class="csw5022"
23
+ class="csw5022 builder-block"
15
24
  items={[
16
25
  {
17
26
  title: [
@@ -171,14 +180,20 @@ export const MyComponent_onMount = (state) => {
171
180
  <div>
172
181
  <div builder="accordion">
173
182
  <div builder="accordion-title">
174
- <div class="csanagh">
183
+ <div
184
+ builder-id="builder-5fed2723c1cc4fb39e9d22b9c54ef179"
185
+ class="csanagh"
186
+ >
175
187
  <div class="crwdrpw">
176
188
  <div innerHTML="<p>Item 1</p>" class="builder-text"></div>
177
189
  </div>
178
190
  </div>
179
191
  </div>
180
192
  <div builder="accordion-detail">
181
- <div class="c4qyc1p">
193
+ <div
194
+ builder-id="builder-18279a99b32240f19aa21d3f4b015cc9"
195
+ class="c4qyc1p"
196
+ >
182
197
  <div class="ctcw2m4">
183
198
  <div
184
199
  innerHTML="<p>Item 1 content</p>"
@@ -190,14 +205,20 @@ export const MyComponent_onMount = (state) => {
190
205
  </div>
191
206
  <div builder="accordion">
192
207
  <div builder="accordion-title">
193
- <div class="csanagh">
208
+ <div
209
+ builder-id="builder-2a93def22a354cf7aa193c20d1ad6def"
210
+ class="csanagh"
211
+ >
194
212
  <div class="crwdrpw">
195
213
  <div innerHTML="<p>Item 2</p>" class="builder-text"></div>
196
214
  </div>
197
215
  </div>
198
216
  </div>
199
217
  <div builder="accordion-detail">
200
- <div class="c4qyc1p">
218
+ <div
219
+ builder-id="builder-fd6ef41da6d040328fbd8b0801611fe5"
220
+ class="c4qyc1p"
221
+ >
201
222
  <div class="ctcw2m4">
202
223
  <div
203
224
  innerHTML="<p>Item 2 content</p>"
@@ -1,38 +1,51 @@
1
- import { h, qrl, withScopedStylesQrl } from "@builder.io/qwik";
1
+ import {
2
+ Fragment,
3
+ h,
4
+ qrl,
5
+ useStore,
6
+ withScopedStylesQrl,
7
+ } from "@builder.io/qwik";
2
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}`;
3
- export const MyComponent_onMount = (state) => {
4
- if (!state.__INIT__) {
5
- state.__INIT__ = true;
6
- typeof __STATE__ === "object" &&
7
- Object.assign(state, __STATE__[state.serverStateId]);
8
- undefined;
9
- }
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
+ });
10
18
  withScopedStylesQrl(qrl("./low.js", "MyComponent_styles", []));
11
19
  return (
12
- <div class="cvdfnp5" maxWidth={1200}>
13
- <section class="cz5wnof">
14
- {(state.simpleList.results || []).map(
15
- function (__value__) {
16
- var state = Object.assign({}, this, {
17
- resultsItem: __value__ == null ? {} : __value__,
18
- });
19
- return (
20
- <div class="cdrk993">
21
- <div
22
- class="builder-text"
23
- innerHTML={(() => {
24
- try {
25
- var _virtual_index = state.resultsItem.data.title;
26
- return _virtual_index;
27
- } catch (err) {
28
- console.warn("Builder code error", err);
29
- }
30
- })()}
31
- ></div>
32
- </div>
33
- );
34
- }.bind(state)
35
- )}
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
+ innerHTML={(() => {
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
+ })}
36
49
  </section>
37
50
  </div>
38
51
  );
@@ -3,22 +3,26 @@ import {
3
3
  componentQrl,
4
4
  h,
5
5
  qrl,
6
+ useStore,
6
7
  withScopedStylesQrl,
7
8
  } from "@builder.io/qwik";
8
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}`;
9
- export const MyComponent_onMount = (state) => {
10
- if (!state.__INIT__) {
11
- state.__INIT__ = true;
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
+ );
12
17
  if (!state.hasOwnProperty("myState")) state.myState = "initialValue";
13
- typeof __STATE__ === "object" &&
14
- Object.assign(state, __STATE__[state.serverStateId]);
15
- undefined;
16
- }
18
+ return state;
19
+ });
17
20
  withScopedStylesQrl(qrl("./med.js", "MyComponent_styles", []));
18
21
  return h(
19
22
  Fragment,
20
23
  null,
21
24
  h(Image, {
25
+ "builder-id": "builder-fa4480d2f48a44a7a2e98cf07c54927b",
22
26
  image:
23
27
  "https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=1160",
24
28
  backgroundSize: "cover",
@@ -26,8 +30,8 @@ export const MyComponent_onMount = (state) => {
26
30
  srcset:
27
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",
28
32
  sizes: "(max-width: 638px) 94vw, (max-width: 998px) 96vw, 83vw",
29
- class: "cvk52jt",
30
- onClickQrl: qrl("./high.js", "MyComponent_onClick_0", [state]),
33
+ class: "cvk52jt builder-block",
34
+ onClick$: qrl("./high.js", "MyComponent_onClick_0", [state]),
31
35
  lazy: false,
32
36
  fitContent: true,
33
37
  aspectRatio: 1,
@@ -142,7 +146,7 @@ export const __passThroughProps__ = function __passThroughProps__(
142
146
  for (var key in srcProps) {
143
147
  if (
144
148
  Object.prototype.hasOwnProperty.call(srcProps, key) &&
145
- ((key.startsWith("on") && key.endsWith("Qrl")) || key == "style")
149
+ ((key.startsWith("on") && key.endsWith("$")) || key == "style")
146
150
  ) {
147
151
  dstProps[key] = srcProps[key];
148
152
  }
@@ -3,22 +3,26 @@ import {
3
3
  componentQrl,
4
4
  h,
5
5
  qrl,
6
+ useStore,
6
7
  withScopedStylesQrl,
7
8
  } from "@builder.io/qwik";
8
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}`;
9
- export const MyComponent_onMount = (state) => {
10
- if (!state.__INIT__) {
11
- state.__INIT__ = true;
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
+ );
12
17
  if (!state.hasOwnProperty("myState")) state.myState = "initialValue";
13
- typeof __STATE__ === "object" &&
14
- Object.assign(state, __STATE__[state.serverStateId]);
15
- undefined;
16
- }
18
+ return state;
19
+ });
17
20
  withScopedStylesQrl(qrl("./med.js", "MyComponent_styles", []));
18
21
  return h(
19
22
  Fragment,
20
23
  null,
21
24
  h(Image, {
25
+ "builder-id": "builder-fa4480d2f48a44a7a2e98cf07c54927b",
22
26
  image:
23
27
  "https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=1160",
24
28
  backgroundSize: "cover",
@@ -26,8 +30,8 @@ export const MyComponent_onMount = (state) => {
26
30
  srcset:
27
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",
28
32
  sizes: "(max-width: 638px) 94vw, (max-width: 998px) 96vw, 83vw",
29
- class: "cvk52jt",
30
- onClickQrl: qrl("./high.js", "MyComponent_onClick_0", [state]),
33
+ class: "cvk52jt builder-block",
34
+ onClick$: qrl("./high.js", "MyComponent_onClick_0", [state]),
31
35
  lazy: false,
32
36
  fitContent: true,
33
37
  aspectRatio: 1,
@@ -142,7 +146,7 @@ export const __passThroughProps__ = function __passThroughProps__(
142
146
  for (var key in srcProps) {
143
147
  if (
144
148
  Object.prototype.hasOwnProperty.call(srcProps, key) &&
145
- ((key.startsWith("on") && key.endsWith("Qrl")) || key == "style")
149
+ ((key.startsWith("on") && key.endsWith("$")) || key == "style")
146
150
  ) {
147
151
  dstProps[key] = srcProps[key];
148
152
  }
@@ -1,16 +1,20 @@
1
+ const Fragment = require("@builder.io/qwik").Fragment;
1
2
  const h = require("@builder.io/qwik").h;
2
3
  const qrl = require("@builder.io/qwik").qrl;
4
+ const useStore = require("@builder.io/qwik").useStore;
3
5
  const withScopedStylesQrl = require("@builder.io/qwik").withScopedStylesQrl;
4
6
  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_onMount = (state) => {
6
- if (!state.__INIT__) {
7
- state.__INIT__ = true;
7
+ exports.MyComponent_onMount = (props) => {
8
+ const state = useStore(() => {
9
+ const state = Object.assign(
10
+ {},
11
+ props,
12
+ typeof __STATE__ === "object" ? __STATE__[props.serverStateId] : undefined
13
+ );
8
14
  if (!state.hasOwnProperty("title")) state.title = '"Default title value"';
9
15
  if (!state.hasOwnProperty("hiliteTitle")) state.hiliteTitle = true;
10
- typeof __STATE__ === "object" &&
11
- Object.assign(state, __STATE__[state.serverStateId]);
12
- undefined;
13
- }
16
+ return state;
17
+ });
14
18
  withScopedStylesQrl(qrl("./low.js", "MyComponent_styles", []));
15
19
  return h(
16
20
  "div",
@@ -1,17 +1,25 @@
1
1
  import { CoreButton } from "./med.js";
2
- import { h, qrl, withScopedStylesQrl } from "@builder.io/qwik";
2
+ import {
3
+ Fragment,
4
+ h,
5
+ qrl,
6
+ useStore,
7
+ withScopedStylesQrl,
8
+ } from "@builder.io/qwik";
3
9
  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_onMount = (state) => {
5
- if (!state.__INIT__) {
6
- state.__INIT__ = true;
7
- typeof __STATE__ === "object" &&
8
- Object.assign(state, __STATE__[state.serverStateId]);
9
- undefined;
10
- }
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
+ return state;
18
+ });
11
19
  withScopedStylesQrl(qrl("./low.js", "MyComponent_styles", []));
12
20
  return h(CoreButton, {
13
21
  text: "Click me!",
14
22
  class: "c9nzze9",
15
- onClickQrl: qrl("./high.js", "MyComponent_onClick_0", [state]),
23
+ onClick$: qrl("./high.js", "MyComponent_onClick_0", [state]),
16
24
  });
17
25
  };
@@ -22,7 +22,7 @@ export const __passThroughProps__ = function __passThroughProps__(
22
22
  for (var key in srcProps) {
23
23
  if (
24
24
  Object.prototype.hasOwnProperty.call(srcProps, key) &&
25
- ((key.startsWith("on") && key.endsWith("Qrl")) || key == "style")
25
+ ((key.startsWith("on") && key.endsWith("$")) || key == "style")
26
26
  ) {
27
27
  dstProps[key] = srcProps[key];
28
28
  }
@@ -1,19 +1,30 @@
1
1
  import { ComponentD187055AF171488FAD843ACF045D6BF7 } from "./med.js";
2
- import { Fragment, h, qrl, withScopedStylesQrl } from "@builder.io/qwik";
2
+ import {
3
+ Fragment,
4
+ h,
5
+ qrl,
6
+ useStore,
7
+ withScopedStylesQrl,
8
+ } from "@builder.io/qwik";
3
9
  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_onMount = (state) => {
5
- if (!state.__INIT__) {
6
- state.__INIT__ = true;
10
+ export const ComponentD187055AF171488FAD843ACF045D6BF7_onMount = (props) => {
11
+ const state = useStore(() => {
12
+ const state = Object.assign(
13
+ {},
14
+ props,
15
+ typeof __STATE__ === "object" ? __STATE__[props.serverStateId] : undefined
16
+ );
7
17
  if (!state.hasOwnProperty("title")) state.title = "default-title";
8
- typeof __STATE__ === "object" &&
9
- Object.assign(state, __STATE__[state.serverStateId]);
10
- undefined;
11
- }
18
+ return state;
19
+ });
12
20
  withScopedStylesQrl(
13
21
  qrl("./low.js", "ComponentD187055AF171488FAD843ACF045D6BF7_styles", [])
14
22
  );
15
23
  return (
16
- <div class="cj49hqu">
24
+ <div
25
+ builder-id="builder-139a8479536b4c4f9c2738e724ed0952"
26
+ class="cj49hqu builder-block"
27
+ >
17
28
  <div class="cjrqfb1">
18
29
  <div
19
30
  class="builder-text"
@@ -31,54 +42,61 @@ export const ComponentD187055AF171488FAD843ACF045D6BF7_onMount = (state) => {
31
42
  );
32
43
  };
33
44
  export const MyComponent_styles = `.c713ty2{display:flex;flex-direction:column;position:relative;flex-shrink:0;box-sizing:border-box;margin-top:20px}`;
34
- export const MyComponent_onMount = (state) => {
35
- if (!state.__INIT__) {
36
- state.__INIT__ = true;
37
- typeof __STATE__ === "object" &&
38
- Object.assign(state, __STATE__[state.serverStateId]);
39
- (() => {
40
- /*
41
- * Global objects available:
42
- *
43
- * state - builder state object - learn about state https://www.builder.io/c/docs/guides/state-and-actions
44
- * context - builder context object - learn about state https://github.com/BuilderIO/builder/tree/main/packages/react#passing-data-and-functions-down
45
- * fetch - Fetch API - https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API'
46
- * Builder - Builder object - useful values include: Builder.isServer, Builder.isBrowser, Builder.isPreviewing, Builder.isEditing
47
- *
48
- * visit https://www.builder.io/c/docs/guides/custom-code
49
- * for more information on writing custom code
50
- */
51
- async function main() {
52
- if (Builder.isServer) {
53
- // Place any code here you want to only run on the server. Any
54
- // data fetched on the server will be available to re-hydrate on the client
55
- // if added to the state object
56
- }
57
-
58
- if (Builder.isBrowser) {
59
- // Place code that you only want to run in the browser (client side only) here
60
- // For example, anything that uses document/window access or DOM manipulation
61
- }
45
+ export const MyComponent_onMount = (props) => {
46
+ const state = useStore(() => {
47
+ const state = Object.assign(
48
+ {},
49
+ props,
50
+ typeof __STATE__ === "object" ? __STATE__[props.serverStateId] : undefined
51
+ );
52
+ /*
53
+ * Global objects available:
54
+ *
55
+ * state - builder state object - learn about state https://www.builder.io/c/docs/guides/state-and-actions
56
+ * context - builder context object - learn about state https://github.com/BuilderIO/builder/tree/main/packages/react#passing-data-and-functions-down
57
+ * fetch - Fetch API - https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API'
58
+ * Builder - Builder object - useful values include: Builder.isServer, Builder.isBrowser, Builder.isPreviewing, Builder.isEditing
59
+ *
60
+ * visit https://www.builder.io/c/docs/guides/custom-code
61
+ * for more information on writing custom code
62
+ */
63
+ async function main() {
64
+ if (Builder.isServer) {
65
+ // Place any code here you want to only run on the server. Any
66
+ // data fetched on the server will be available to re-hydrate on the client
67
+ // if added to the state object
68
+ }
62
69
 
63
- state.something = "works!";
70
+ if (Builder.isBrowser) {
71
+ // Place code that you only want to run in the browser (client side only) here
72
+ // For example, anything that uses document/window access or DOM manipulation
64
73
  }
65
74
 
66
- return main();
67
- })();
68
- }
75
+ state.something = "works!";
76
+ }
77
+ return state;
78
+ });
69
79
  withScopedStylesQrl(qrl("./low.js", "MyComponent_styles", []));
70
80
  return (
71
81
  <>
72
- <div class="c713ty2">
82
+ <div
83
+ builder-id="builder-50b2438beaa4498b985eb9d8a7659afa"
84
+ class="c713ty2 builder-block"
85
+ >
73
86
  <ComponentD187055AF171488FAD843ACF045D6BF7
87
+ builder-id="builder-l6nwek"
74
88
  title="First title from parent"
75
- serverStateId="woo8b6"
89
+ serverStateId="w8x6w6"
76
90
  ></ComponentD187055AF171488FAD843ACF045D6BF7>
77
91
  </div>
78
- <div class="c713ty2">
92
+ <div
93
+ builder-id="builder-33f427415bef4725b0c9fcd4fed325f2"
94
+ class="c713ty2 builder-block"
95
+ >
79
96
  <ComponentD187055AF171488FAD843ACF045D6BF7
97
+ builder-id="builder-1iryyq"
80
98
  title="Second title from parent"
81
- serverStateId="woo8b6"
99
+ serverStateId="w8x6w6"
82
100
  ></ComponentD187055AF171488FAD843ACF045D6BF7>
83
101
  </div>
84
102
  </>
@@ -2,16 +2,19 @@ const Fragment = require("@builder.io/qwik").Fragment;
2
2
  const componentQrl = require("@builder.io/qwik").componentQrl;
3
3
  const h = require("@builder.io/qwik").h;
4
4
  const qrl = require("@builder.io/qwik").qrl;
5
+ const useStore = require("@builder.io/qwik").useStore;
5
6
  const withScopedStylesQrl = require("@builder.io/qwik").withScopedStylesQrl;
6
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}`;
7
- exports.MyComponent_onMount = (state) => {
8
- if (!state.__INIT__) {
9
- state.__INIT__ = true;
8
+ exports.MyComponent_onMount = (props) => {
9
+ const state = useStore(() => {
10
+ const state = Object.assign(
11
+ {},
12
+ props,
13
+ typeof __STATE__ === "object" ? __STATE__[props.serverStateId] : undefined
14
+ );
10
15
  if (!state.hasOwnProperty("data")) state.data = 0;
11
- typeof __STATE__ === "object" &&
12
- Object.assign(state, __STATE__[state.serverStateId]);
13
- undefined;
14
- }
16
+ return state;
17
+ });
15
18
  withScopedStylesQrl(qrl("./med.js", "MyComponent_styles", []));
16
19
  return (
17
20
  <>
@@ -29,9 +32,10 @@ exports.MyComponent_onMount = (state) => {
29
32
  ></div>
30
33
  </div>
31
34
  <CoreButton
35
+ builder-id="builder-6f8fe6a1d2284f2890ae97657eed084a"
32
36
  text="Something else"
33
- class="c9nzze9"
34
- onClickQrl={qrl("./high.js", "MyComponent_onClick_0", [state])}
37
+ class="c9nzze9 builder-block"
38
+ onClick$={qrl("./high.js", "MyComponent_onClick_0", [state])}
35
39
  ></CoreButton>
36
40
  </>
37
41
  );
@@ -55,7 +59,7 @@ const __passThroughProps__ = (exports.__passThroughProps__ =
55
59
  for (var key in srcProps) {
56
60
  if (
57
61
  Object.prototype.hasOwnProperty.call(srcProps, key) &&
58
- ((key.startsWith("on") && key.endsWith("Qrl")) || key == "style")
62
+ ((key.startsWith("on") && key.endsWith("$")) || key == "style")
59
63
  ) {
60
64
  dstProps[key] = srcProps[key];
61
65
  }