@builder.io/sdk-qwik 0.0.5 → 0.0.8

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 (108) hide show
  1. package/README.md +2 -65
  2. package/lib/index.97024df8.js +80165 -0
  3. package/lib/index.d8c1e37f.cjs +80165 -0
  4. package/lib/index.qwik.cjs +2424 -0
  5. package/lib/index.qwik.mjs +2424 -0
  6. package/package.json +3 -4
  7. package/tsconfig.json +1 -1
  8. package/types.d.ts +12 -7
  9. package/src/blocks/button/button.jsx +0 -211
  10. package/src/blocks/button/component-info.js +0 -41
  11. package/src/blocks/columns/columns.jsx +0 -267
  12. package/src/blocks/columns/component-info.js +0 -242
  13. package/src/blocks/custom-code/component-info.js +0 -31
  14. package/src/blocks/custom-code/custom-code.jsx +0 -130
  15. package/src/blocks/embed/component-info.js +0 -44
  16. package/src/blocks/embed/embed.jsx +0 -130
  17. package/src/blocks/embed/helpers.js +0 -9
  18. package/src/blocks/form/builder-blocks.jsx +0 -100
  19. package/src/blocks/form/component-info.js +0 -262
  20. package/src/blocks/form/form.jsx +0 -789
  21. package/src/blocks/fragment/component-info.js +0 -11
  22. package/src/blocks/fragment/fragment.jsx +0 -59
  23. package/src/blocks/image/component-info.js +0 -151
  24. package/src/blocks/image/image.helpers.js +0 -48
  25. package/src/blocks/image/image.jsx +0 -554
  26. package/src/blocks/img/component-info.js +0 -20
  27. package/src/blocks/img/img.jsx +0 -76
  28. package/src/blocks/input/component-info.js +0 -74
  29. package/src/blocks/input/input.jsx +0 -87
  30. package/src/blocks/raw-text/component-info.js +0 -16
  31. package/src/blocks/raw-text/raw-text.jsx +0 -53
  32. package/src/blocks/section/component-info.js +0 -49
  33. package/src/blocks/section/section.jsx +0 -97
  34. package/src/blocks/select/component-info.js +0 -59
  35. package/src/blocks/select/select.jsx +0 -149
  36. package/src/blocks/submit-button/component-info.js +0 -28
  37. package/src/blocks/submit-button/submit-button.jsx +0 -87
  38. package/src/blocks/symbol/component-info.js +0 -43
  39. package/src/blocks/symbol/symbol.jsx +0 -230
  40. package/src/blocks/text/component-info.js +0 -24
  41. package/src/blocks/text/text.jsx +0 -46
  42. package/src/blocks/textarea/component-info.js +0 -47
  43. package/src/blocks/textarea/textarea.jsx +0 -65
  44. package/src/blocks/util.js +0 -12
  45. package/src/blocks/video/component-info.js +0 -106
  46. package/src/blocks/video/video.jsx +0 -103
  47. package/src/components/render-block/block-styles.jsx +0 -186
  48. package/src/components/render-block/render-block.helpers.js +0 -23
  49. package/src/components/render-block/render-block.jsx +0 -749
  50. package/src/components/render-block/render-component.jsx +0 -257
  51. package/src/components/render-block/render-repeated-block.jsx +0 -119
  52. package/src/components/render-block/types.js +0 -0
  53. package/src/components/render-blocks.jsx +0 -387
  54. package/src/components/render-content/components/render-styles.jsx +0 -140
  55. package/src/components/render-content/index.js +0 -4
  56. package/src/components/render-content/render-content.jsx +0 -636
  57. package/src/components/render-inlined-styles.jsx +0 -153
  58. package/src/constants/builder-registered-components.js +0 -48
  59. package/src/constants/device-sizes.js +0 -21
  60. package/src/constants/target.js +0 -4
  61. package/src/context/builder.context.js +0 -5
  62. package/src/functions/camel-to-kebab-case.js +0 -4
  63. package/src/functions/convert-style-object.js +0 -6
  64. package/src/functions/evaluate.js +0 -28
  65. package/src/functions/event-handler-name.js +0 -7
  66. package/src/functions/get-block-actions.js +0 -23
  67. package/src/functions/get-block-component-options.js +0 -28
  68. package/src/functions/get-block-properties.js +0 -29
  69. package/src/functions/get-block-styles.js +0 -34
  70. package/src/functions/get-block-tag.js +0 -6
  71. package/src/functions/get-builder-search-params/fn.test.js +0 -13
  72. package/src/functions/get-builder-search-params/index.js +0 -33
  73. package/src/functions/get-content/ab-testing.js +0 -38
  74. package/src/functions/get-content/fn.test.js +0 -31
  75. package/src/functions/get-content/index.js +0 -99
  76. package/src/functions/get-content/types.js +0 -0
  77. package/src/functions/get-fetch.js +0 -33
  78. package/src/functions/get-global-this.js +0 -18
  79. package/src/functions/get-processed-block.js +0 -53
  80. package/src/functions/get-processed-block.test.js +0 -32
  81. package/src/functions/if-target.js +0 -15
  82. package/src/functions/is-browser.js +0 -6
  83. package/src/functions/is-editing.js +0 -7
  84. package/src/functions/is-iframe.js +0 -7
  85. package/src/functions/is-previewing.js +0 -14
  86. package/src/functions/on-change.js +0 -27
  87. package/src/functions/on-change.test.js +0 -19
  88. package/src/functions/register-component.js +0 -72
  89. package/src/functions/register.js +0 -29
  90. package/src/functions/sanitize-styles.js +0 -5
  91. package/src/functions/set-editor-settings.js +0 -15
  92. package/src/functions/set.js +0 -11
  93. package/src/functions/set.test.js +0 -16
  94. package/src/functions/track.js +0 -22
  95. package/src/functions/transform-block.js +0 -6
  96. package/src/helpers/css.js +0 -12
  97. package/src/helpers/flatten.js +0 -34
  98. package/src/index-helpers/blocks-exports.js +0 -22
  99. package/src/index-helpers/top-of-file.js +0 -4
  100. package/src/index.js +0 -10
  101. package/src/scripts/init-editing.js +0 -79
  102. package/src/types/builder-block.js +0 -0
  103. package/src/types/builder-content.js +0 -0
  104. package/src/types/components.js +0 -0
  105. package/src/types/deep-partial.js +0 -0
  106. package/src/types/element.js +0 -0
  107. package/src/types/targets.js +0 -0
  108. package/src/types/typescript.js +0 -0
@@ -1,636 +0,0 @@
1
- // GENERATED BY MITOSIS
2
-
3
- import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components.js";
4
- import { TARGET } from "../../constants/target.js";
5
- import BuilderContext from "../../context/builder.context";
6
- import { evaluate } from "../../functions/evaluate.js";
7
- import { getContent } from "../../functions/get-content/index.js";
8
- import { getFetch } from "../../functions/get-fetch.js";
9
- import { isBrowser } from "../../functions/is-browser.js";
10
- import { isEditing } from "../../functions/is-editing.js";
11
- import { isPreviewing } from "../../functions/is-previewing.js";
12
- import {
13
- components,
14
- createRegisterComponentMessage,
15
- } from "../../functions/register-component.js";
16
- import { track } from "../../functions/track.js";
17
- import {
18
- registerInsertMenu,
19
- setupBrowserForEditing,
20
- } from "../../scripts/init-editing.js";
21
- import RenderBlocks from "../render-blocks";
22
- import RenderContentStyles from "./components/render-styles";
23
- import {
24
- Fragment,
25
- Host,
26
- component$,
27
- h,
28
- useCleanup$,
29
- useClientEffect$,
30
- useContextProvider,
31
- useStore,
32
- useWatch$,
33
- } from "@builder.io/qwik";
34
- export const useContent = function useContent(props, state) {
35
- const mergedContent = {
36
- ...props.content,
37
- ...state.overrideContent,
38
- data: {
39
- ...props.content?.data,
40
- ...props.data,
41
- ...state.overrideContent?.data,
42
- },
43
- };
44
- return mergedContent;
45
- };
46
- export const contentState = function contentState(props, state) {
47
- return {
48
- ...props.content?.data?.state,
49
- ...props.data,
50
- ...state.overrideState,
51
- };
52
- };
53
- export const contextContext = function contextContext(props, state) {
54
- return props.context || {};
55
- };
56
- export const allRegisteredComponents = function allRegisteredComponents(
57
- props,
58
- state
59
- ) {
60
- const allComponentsArray = [
61
- ...getDefaultRegisteredComponents(), // While this `components` object is deprecated, we must maintain support for it.
62
- // Since users are able to override our default components, we need to make sure that we do not break such
63
- // existing usage.
64
- // This is why we spread `components` after the default Builder.io components, but before the `props.customComponents`,
65
- // which is the new standard way of providing custom components, and must therefore take precedence.
66
- ...components,
67
- ...(props.customComponents || []),
68
- ];
69
- const allComponents = allComponentsArray.reduce(
70
- (acc, curr) => ({ ...acc, [curr.name]: curr }),
71
- {}
72
- );
73
- return allComponents;
74
- };
75
- export const processMessage = function processMessage(props, state, event) {
76
- const { data } = event;
77
-
78
- if (data) {
79
- switch (data.type) {
80
- case "builder.contentUpdate": {
81
- const messageContent = data.data;
82
- const key =
83
- messageContent.key ||
84
- messageContent.alias ||
85
- messageContent.entry ||
86
- messageContent.modelName;
87
- const contentData = messageContent.data;
88
-
89
- if (key === props.model) {
90
- state.overrideContent = contentData;
91
- }
92
-
93
- break;
94
- }
95
-
96
- case "builder.patchUpdates": {
97
- // TODO
98
- break;
99
- }
100
- }
101
- }
102
- };
103
- export const evaluateJsCode = function evaluateJsCode(props, state) {
104
- // run any dynamic JS code attached to content
105
- const jsCode = useContent(props, state)?.data?.jsCode;
106
-
107
- if (jsCode) {
108
- evaluate({
109
- code: jsCode,
110
- context: contextContext(props, state),
111
- state: contentState(props, state),
112
- });
113
- }
114
- };
115
- export const httpReqsData = function httpReqsData(props, state) {
116
- return {};
117
- };
118
- export const onClick = function onClick(props, state, _event) {
119
- if (useContent(props, state) && props.canTrack !== false) {
120
- track("click", {
121
- contentId: useContent(props, state).id,
122
- });
123
- }
124
- };
125
- export const evalExpression = function evalExpression(
126
- props,
127
- state,
128
- expression
129
- ) {
130
- return expression.replace(/{{([^}]+)}}/g, (_match, group) =>
131
- evaluate({
132
- code: group,
133
- context: contextContext(props, state),
134
- state: contentState(props, state),
135
- })
136
- );
137
- };
138
- export const handleRequest = function handleRequest(
139
- props,
140
- state,
141
- { url, key }
142
- ) {
143
- const fetchAndSetState = async () => {
144
- const fetch = await getFetch();
145
- const response = await fetch(url);
146
- const json = await response.json();
147
- const newOverrideState = { ...state.overrideState, [key]: json };
148
- state.overrideState = newOverrideState;
149
- };
150
-
151
- fetchAndSetState();
152
- };
153
- export const runHttpRequests = function runHttpRequests(props, state) {
154
- const requests = useContent(props, state)?.data?.httpRequests ?? {};
155
- Object.entries(requests).forEach(([key, url]) => {
156
- if (url && (!httpReqsData(props, state)[key] || isEditing())) {
157
- const evaluatedUrl = evalExpression(props, state, url);
158
- handleRequest(props, state, {
159
- url: evaluatedUrl,
160
- key,
161
- });
162
- }
163
- });
164
- };
165
- export const emitStateUpdate = function emitStateUpdate(props, state) {
166
- if (isEditing()) {
167
- window.dispatchEvent(
168
- new CustomEvent("builder:component:stateChange", {
169
- detail: {
170
- state: contentState(props, state),
171
- ref: {
172
- name: props.model,
173
- },
174
- },
175
- })
176
- );
177
- }
178
- };
179
- export const shouldRenderContentStyles = function shouldRenderContentStyles(
180
- props,
181
- state
182
- ) {
183
- return Boolean(
184
- (useContent(props, state)?.data?.cssCode ||
185
- useContent(props, state)?.data?.customFonts?.length) &&
186
- TARGET !== "reactNative"
187
- );
188
- };
189
- export const RenderContent = component$((props) => {
190
- const state = useStore({
191
- overrideContent: null,
192
- update: 0,
193
- overrideState: {},
194
- });
195
- useContextProvider(
196
- BuilderContext,
197
- useStore({
198
- content: (() => {
199
- return useContent(props, state);
200
- })(),
201
- state: (() => {
202
- return contentState(props, state);
203
- })(),
204
- context: (() => {
205
- return contextContext(props, state);
206
- })(),
207
- apiKey: (() => {
208
- return props.apiKey;
209
- })(),
210
- registeredComponents: (() => {
211
- return allRegisteredComponents(props, state);
212
- })(),
213
- })
214
- );
215
- useClientEffect$(() => {
216
- if (isBrowser()) {
217
- if (isEditing()) {
218
- registerInsertMenu();
219
- setupBrowserForEditing();
220
- Object.values(allRegisteredComponents(props, state)).forEach(
221
- (registeredComponent) => {
222
- const message = createRegisterComponentMessage(registeredComponent);
223
- window.parent?.postMessage(message, "*");
224
- }
225
- );
226
- window.addEventListener(
227
- "message",
228
- processMessage.bind(null, props, state)
229
- );
230
- window.addEventListener(
231
- "builder:component:stateChangeListenerActivated",
232
- emitStateUpdate.bind(null, props, state)
233
- );
234
- }
235
-
236
- if (useContent(props, state) && props.canTrack !== false) {
237
- track("impression", {
238
- contentId: useContent(props, state).id,
239
- });
240
- } // override normal content in preview mode
241
-
242
- if (isPreviewing()) {
243
- const searchParams = new URL(location.href).searchParams;
244
-
245
- if (
246
- props.model &&
247
- searchParams.get("builder.preview") === props.model
248
- ) {
249
- const previewApiKey =
250
- searchParams.get("apiKey") || searchParams.get("builder.space");
251
-
252
- if (previewApiKey) {
253
- getContent({
254
- model: props.model,
255
- apiKey: previewApiKey,
256
- }).then((content) => {
257
- if (content) {
258
- state.overrideContent = content;
259
- }
260
- });
261
- }
262
- }
263
- }
264
-
265
- evaluateJsCode(props, state);
266
- runHttpRequests(props, state);
267
- emitStateUpdate(props, state);
268
- }
269
- });
270
- useWatch$(({ track }) => {
271
- state.useContent?.data && track(state.useContent?.data, "jsCode");
272
- evaluateJsCode(props, state);
273
- });
274
- useWatch$(({ track }) => {
275
- state.useContent?.data && track(state.useContent?.data, "httpRequests");
276
- runHttpRequests(props, state);
277
- });
278
- useWatch$(({ track }) => {
279
- state && track(state, "contentState");
280
- emitStateUpdate(props, state);
281
- });
282
- useCleanup$(() => {
283
- if (isBrowser()) {
284
- window.removeEventListener(
285
- "message",
286
- processMessage.bind(null, props, state)
287
- );
288
- window.removeEventListener(
289
- "builder:component:stateChangeListenerActivated",
290
- emitStateUpdate.bind(null, props, state)
291
- );
292
- }
293
- });
294
- return (
295
- <Host q:host-pseudo="">
296
- {useContent(props, state) ? (
297
- <div
298
- onClick$={(event) => onClick(props, state, event)}
299
- builder-content-id={useContent(props, state)?.id}
300
- >
301
- {shouldRenderContentStyles(props, state) ? (
302
- <RenderContentStyles
303
- cssCode={useContent(props, state)?.data?.cssCode}
304
- customFonts={useContent(props, state)?.data?.customFonts}
305
- ></RenderContentStyles>
306
- ) : null}
307
- <RenderBlocks
308
- blocks={useContent(props, state)?.data?.blocks}
309
- ></RenderBlocks>
310
- </div>
311
- ) : null}
312
- </Host>
313
- );
314
- });
315
- export default RenderContent;
316
- export const COMPONENT = {
317
- "@type": "@builder.io/mitosis/component",
318
- imports: [
319
- {
320
- imports: {
321
- getDefaultRegisteredComponents: "getDefaultRegisteredComponents",
322
- },
323
- path: "../../constants/builder-registered-components.js",
324
- },
325
- {
326
- imports: {
327
- TARGET: "TARGET",
328
- },
329
- path: "../../constants/target.js",
330
- },
331
- {
332
- imports: {
333
- BuilderContext: "default",
334
- },
335
- path: "../../context/builder.context.lite",
336
- },
337
- {
338
- imports: {
339
- evaluate: "evaluate",
340
- },
341
- path: "../../functions/evaluate.js",
342
- },
343
- {
344
- imports: {
345
- getContent: "getContent",
346
- },
347
- path: "../../functions/get-content/index.js",
348
- },
349
- {
350
- imports: {
351
- getFetch: "getFetch",
352
- },
353
- path: "../../functions/get-fetch.js",
354
- },
355
- {
356
- imports: {
357
- isBrowser: "isBrowser",
358
- },
359
- path: "../../functions/is-browser.js",
360
- },
361
- {
362
- imports: {
363
- isEditing: "isEditing",
364
- },
365
- path: "../../functions/is-editing.js",
366
- },
367
- {
368
- imports: {
369
- isPreviewing: "isPreviewing",
370
- },
371
- path: "../../functions/is-previewing.js",
372
- },
373
- {
374
- imports: {
375
- registerInsertMenu: "registerInsertMenu",
376
- setupBrowserForEditing: "setupBrowserForEditing",
377
- },
378
- path: "../../scripts/init-editing.js",
379
- },
380
- {
381
- imports: {
382
- components: "components",
383
- createRegisterComponentMessage: "createRegisterComponentMessage",
384
- },
385
- path: "../../functions/register-component.js",
386
- },
387
- {
388
- imports: {
389
- track: "track",
390
- },
391
- path: "../../functions/track.js",
392
- },
393
- {
394
- imports: {
395
- RenderBlocks: "default",
396
- },
397
- path: "../render-blocks.lite",
398
- },
399
- {
400
- imports: {
401
- RenderContentStyles: "default",
402
- },
403
- path: "./components/render-styles.lite",
404
- },
405
- ],
406
- exports: {},
407
- inputs: [],
408
- meta: {},
409
- refs: {},
410
- state: {
411
- useContent:
412
- "@builder.io/mitosis/method:get useContent() {\n const mergedContent: BuilderContent = { ...props.content,\n ...state.overrideContent,\n data: { ...props.content?.data,\n ...props.data,\n ...state.overrideContent?.data\n }\n };\n return mergedContent;\n}",
413
- overrideContent: null,
414
- update: 0,
415
- overrideState: {},
416
- contentState:
417
- "@builder.io/mitosis/method:get contentState() {\n return { ...props.content?.data?.state,\n ...props.data,\n ...state.overrideState\n };\n}",
418
- contextContext:
419
- "@builder.io/mitosis/method:get contextContext() {\n return props.context || {};\n}",
420
- allRegisteredComponents:
421
- "@builder.io/mitosis/method:get allRegisteredComponents() {\n const allComponentsArray = [...getDefaultRegisteredComponents(), // While this `components` object is deprecated, we must maintain support for it.\n // Since users are able to override our default components, we need to make sure that we do not break such\n // existing usage.\n // This is why we spread `components` after the default Builder.io components, but before the `props.customComponents`,\n // which is the new standard way of providing custom components, and must therefore take precedence.\n ...components, ...(props.customComponents || [])];\n const allComponents = allComponentsArray.reduce((acc, curr) => ({ ...acc,\n [curr.name]: curr\n }), ({} as RegisteredComponents));\n return allComponents;\n}",
422
- processMessage:
423
- "@builder.io/mitosis/method:processMessage(event: MessageEvent) {\n const {\n data\n } = event;\n\n if (data) {\n switch (data.type) {\n case 'builder.contentUpdate':\n {\n const messageContent = data.data;\n const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;\n const contentData = messageContent.data;\n\n if (key === props.model) {\n state.overrideContent = contentData;\n }\n\n break;\n }\n\n case 'builder.patchUpdates':\n {\n // TODO\n break;\n }\n }\n }\n}",
424
- evaluateJsCode:
425
- "@builder.io/mitosis/method:evaluateJsCode() {\n // run any dynamic JS code attached to content\n const jsCode = useContent(props,state)?.data?.jsCode;\n\n if (jsCode) {\n evaluate({\n code: jsCode,\n context: contextContext(props,state),\n state: contentState(props,state)\n });\n }\n}",
426
- httpReqsData:
427
- "@builder.io/mitosis/method:get httpReqsData() {\n return {};\n}",
428
- onClick:
429
- "@builder.io/mitosis/method:onClick(_event: MouseEvent) {\n if (useContent(props,state) && props.canTrack !== false) {\n track('click', {\n contentId: useContent(props,state).id\n });\n }\n}",
430
- evalExpression:
431
- "@builder.io/mitosis/method:evalExpression(expression: string) {\n return expression.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({\n code: group,\n context: contextContext(props,state),\n state: contentState(props,state)\n }));\n}",
432
- handleRequest:
433
- "@builder.io/mitosis/method:handleRequest({\n url,\n key\n}: {\n key: string;\n url: string;\n}) {\n const fetchAndSetState = async () => {\n const fetch = await getFetch();\n const response = await fetch(url);\n const json = await response.json();\n const newOverrideState = { ...state.overrideState,\n [key]: json\n };\n state.overrideState = newOverrideState;\n };\n\n fetchAndSetState();\n}",
434
- runHttpRequests:
435
- "@builder.io/mitosis/method:runHttpRequests() {\n const requests = useContent(props,state)?.data?.httpRequests ?? {};\n Object.entries(requests).forEach(([key, url]) => {\n if (url && (!httpReqsData(props,state)[key] || isEditing())) {\n const evaluatedUrl = evalExpression(props,state,url);\n handleRequest(props,state,{\n url: evaluatedUrl,\n key\n });\n }\n });\n}",
436
- emitStateUpdate:
437
- "@builder.io/mitosis/method:emitStateUpdate() {\n if (isEditing()) {\n window.dispatchEvent(new CustomEvent<BuilderComponentStateChange>('builder:component:stateChange', {\n detail: {\n state: contentState(props,state),\n ref: {\n name: props.model\n }\n }\n }));\n }\n}",
438
- shouldRenderContentStyles:
439
- "@builder.io/mitosis/method:get shouldRenderContentStyles() {\n return Boolean((useContent(props,state)?.data?.cssCode || useContent(props,state)?.data?.customFonts?.length) && TARGET !== 'reactNative');\n}",
440
- },
441
- children: [
442
- {
443
- "@type": "@builder.io/mitosis/node",
444
- name: "Host",
445
- meta: {},
446
- scope: {},
447
- properties: {
448
- "q:host-pseudo": "",
449
- },
450
- bindings: {},
451
- children: [
452
- {
453
- "@type": "@builder.io/mitosis/node",
454
- name: "Show",
455
- meta: {},
456
- scope: {},
457
- properties: {},
458
- bindings: {
459
- when: {
460
- code: "useContent(props,state)",
461
- },
462
- },
463
- children: [
464
- {
465
- "@type": "@builder.io/mitosis/node",
466
- name: "div",
467
- meta: {},
468
- scope: {},
469
- properties: {
470
- _text: "\n ",
471
- },
472
- bindings: {},
473
- children: [],
474
- },
475
- {
476
- "@type": "@builder.io/mitosis/node",
477
- name: "div",
478
- meta: {},
479
- scope: {},
480
- properties: {},
481
- bindings: {
482
- onClick: {
483
- code: "onClick(props,state,event)",
484
- arguments: ["event"],
485
- },
486
- "builder-content-id": {
487
- code: "useContent(props,state)?.id",
488
- },
489
- },
490
- children: [
491
- {
492
- "@type": "@builder.io/mitosis/node",
493
- name: "div",
494
- meta: {},
495
- scope: {},
496
- properties: {
497
- _text: "\n ",
498
- },
499
- bindings: {},
500
- children: [],
501
- },
502
- {
503
- "@type": "@builder.io/mitosis/node",
504
- name: "Show",
505
- meta: {},
506
- scope: {},
507
- properties: {},
508
- bindings: {
509
- when: {
510
- code: "shouldRenderContentStyles(props,state)",
511
- },
512
- },
513
- children: [
514
- {
515
- "@type": "@builder.io/mitosis/node",
516
- name: "RenderContentStyles",
517
- meta: {},
518
- scope: {},
519
- properties: {},
520
- bindings: {
521
- cssCode: {
522
- code: "useContent(props,state)?.data?.cssCode",
523
- },
524
- customFonts: {
525
- code: "useContent(props,state)?.data?.customFonts",
526
- },
527
- },
528
- children: [],
529
- },
530
- ],
531
- },
532
- {
533
- "@type": "@builder.io/mitosis/node",
534
- name: "div",
535
- meta: {},
536
- scope: {},
537
- properties: {
538
- _text: "\n ",
539
- },
540
- bindings: {},
541
- children: [],
542
- },
543
- {
544
- "@type": "@builder.io/mitosis/node",
545
- name: "RenderBlocks",
546
- meta: {},
547
- scope: {},
548
- properties: {},
549
- bindings: {
550
- blocks: {
551
- code: "useContent(props,state)?.data?.blocks",
552
- },
553
- },
554
- children: [],
555
- },
556
- {
557
- "@type": "@builder.io/mitosis/node",
558
- name: "div",
559
- meta: {},
560
- scope: {},
561
- properties: {
562
- _text: "\n ",
563
- },
564
- bindings: {},
565
- children: [],
566
- },
567
- ],
568
- },
569
- {
570
- "@type": "@builder.io/mitosis/node",
571
- name: "div",
572
- meta: {},
573
- scope: {},
574
- properties: {
575
- _text: "\n ",
576
- },
577
- bindings: {},
578
- children: [],
579
- },
580
- ],
581
- },
582
- ],
583
- },
584
- ],
585
- hooks: {
586
- onMount: {
587
- code: "\n if (isBrowser()) {\n if (isEditing()) {\n registerInsertMenu();\n setupBrowserForEditing();\n Object.values(allRegisteredComponents(props,state)).forEach(registeredComponent => {\n const message = createRegisterComponentMessage(registeredComponent);\n window.parent?.postMessage(message, '*');\n });\n window.addEventListener('message', processMessage.bind(null,props,state));\n window.addEventListener('builder:component:stateChangeListenerActivated', emitStateUpdate.bind(null,props,state));\n }\n\n if (useContent(props,state) && props.canTrack !== false) {\n track('impression', {\n contentId: useContent(props,state).id\n });\n } // override normal content in preview mode\n\n\n if (isPreviewing()) {\n const searchParams = new URL(location.href).searchParams;\n\n if (props.model && searchParams.get('builder.preview') === props.model) {\n const previewApiKey = searchParams.get('apiKey') || searchParams.get('builder.space');\n\n if (previewApiKey) {\n getContent({\n model: props.model,\n apiKey: previewApiKey\n }).then(content => {\n if (content) {\n state.overrideContent = content;\n }\n });\n }\n }\n }\n\n evaluateJsCode(props,state,);\n runHttpRequests(props,state,);\n emitStateUpdate(props,state,);\n }\n",
588
- },
589
- onUpdate: [
590
- {
591
- code: "\n evaluateJsCode(props,state,);\n",
592
- deps: "[state.useContent?.data?.jsCode]",
593
- },
594
- {
595
- code: "\n runHttpRequests(props,state,);\n",
596
- deps: "[state.useContent?.data?.httpRequests]",
597
- },
598
- {
599
- code: "\n emitStateUpdate(props,state,);\n",
600
- deps: "[state.contentState]",
601
- },
602
- ],
603
- onUnMount: {
604
- code: "\n if (isBrowser()) {\n window.removeEventListener('message', processMessage.bind(null,props,state));\n window.removeEventListener('builder:component:stateChangeListenerActivated', emitStateUpdate.bind(null,props,state));\n }\n",
605
- },
606
- },
607
- context: {
608
- get: {},
609
- set: {
610
- "../../context/builder.context.lite:default": {
611
- name: "BuilderContext",
612
- value: {
613
- content:
614
- "@builder.io/mitosis/method:get content() {\n return useContent(props,state);\n}",
615
- state:
616
- "@builder.io/mitosis/method:get state() {\n return contentState(props,state);\n}",
617
- context:
618
- "@builder.io/mitosis/method:get context() {\n return contextContext(props,state);\n}",
619
- apiKey:
620
- "@builder.io/mitosis/method:get apiKey() {\n return props.apiKey;\n}",
621
- registeredComponents:
622
- "@builder.io/mitosis/method:get registeredComponents() {\n return allRegisteredComponents(props,state);\n}",
623
- },
624
- },
625
- },
626
- },
627
- name: "RenderContent",
628
- subComponents: [],
629
- types: [
630
- "export type RenderContentProps = {\n content?: Nullable<BuilderContent>;\n model?: string;\n data?: {\n [key: string]: any;\n };\n context?: BuilderRenderContext;\n apiKey: string;\n customComponents?: RegisteredComponent[];\n canTrack?: boolean;\n};",
631
- ],
632
- interfaces: [
633
- "interface BuilderComponentStateChange {\n state: BuilderRenderState;\n ref: {\n name?: string;\n props?: {\n builderBlock?: {\n id?: string;\n };\n };\n };\n}",
634
- ],
635
- propsTypeRef: "RenderContentProps",
636
- };