@builder.io/sdk-qwik 0.2.0 → 0.2.2
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.
- package/lib/index.qwik.cjs +523 -380
- package/lib/index.qwik.mjs +524 -381
- package/package.json +2 -2
- package/types/blocks/columns/columns.d.ts +0 -2
- package/types/blocks/image/image.d.ts +0 -9
- package/types/blocks/video/video.d.ts +0 -8
- package/types/components/render-block/block-styles.d.ts +1 -6
- package/types/components/render-block/render-block.d.ts +1 -43
- package/types/components/render-block/render-block.helpers.d.ts +1 -0
- package/types/components/render-blocks.d.ts +0 -1
- package/types/components/render-content-variants/helpers.d.ts +6 -0
- package/types/components/render-content-variants/render-content-variants.d.ts +3 -0
- package/types/components/render-inlined-styles.d.ts +1 -5
- package/types/functions/get-block-properties.d.ts +1 -0
- package/types/functions/get-content/index.d.ts +1 -1
- package/types/helpers/logger.d.ts +5 -0
- package/types/types/builder-content.d.ts +1 -1
- package/types/types/components.d.ts +1 -72
- package/types/types/input.d.ts +4 -0
package/lib/index.qwik.mjs
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC,
|
|
1
|
+
import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC, _jsxS, _fnSignal, createContextId, useComputedQrl, useLexicalScope, _jsxQ, _jsxBranch, _IMMUTABLE, _wrapProp, useContextProvider, useStore, useContext, Slot, Fragment as Fragment$1, useVisibleTaskQrl, useTaskQrl, useSignal } from "@builder.io/qwik";
|
|
2
2
|
import { Fragment } from "@builder.io/qwik/jsx-runtime";
|
|
3
3
|
const Button = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
4
4
|
useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$3, "Button_component_useStylesScoped_a1JZ0Q0Q2Oc"));
|
|
5
5
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
6
|
-
children: props.link ? /* @__PURE__ */
|
|
7
|
-
...props.attributes
|
|
6
|
+
children: props.link ? /* @__PURE__ */ _jsxS("a", {
|
|
7
|
+
...props.attributes,
|
|
8
|
+
children: _fnSignal((p0) => p0.text, [
|
|
9
|
+
props
|
|
10
|
+
], "p0.text")
|
|
8
11
|
}, {
|
|
9
12
|
role: "button",
|
|
10
13
|
href: _fnSignal((p0) => p0.link, [
|
|
@@ -13,16 +16,15 @@ const Button = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =
|
|
|
13
16
|
target: _fnSignal((p0) => p0.openLinkInNewTab ? "_blank" : void 0, [
|
|
14
17
|
props
|
|
15
18
|
], 'p0.openLinkInNewTab?"_blank":undefined')
|
|
16
|
-
},
|
|
17
|
-
props
|
|
18
|
-
], "p0.text"), 2, "jc_0") : /* @__PURE__ */ _jsxQ("button", {
|
|
19
|
+
}, 0, "jc_0") : /* @__PURE__ */ _jsxS("button", {
|
|
19
20
|
class: (() => {
|
|
20
21
|
props.attributes.class;
|
|
21
22
|
})(),
|
|
22
|
-
...props.attributes
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
...props.attributes,
|
|
24
|
+
children: _fnSignal((p0) => p0.text, [
|
|
25
|
+
props
|
|
26
|
+
], "p0.text")
|
|
27
|
+
}, null, 0, null)
|
|
26
28
|
}, 1, "jc_1");
|
|
27
29
|
}, "Button_component_gJoMUICXoUQ"));
|
|
28
30
|
const STYLES$3 = `
|
|
@@ -159,8 +161,8 @@ const convertStyleMapToCSSArray = (style) => {
|
|
|
159
161
|
return cssProps.filter(checkIsDefined);
|
|
160
162
|
};
|
|
161
163
|
const convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
162
|
-
const createCssClass = ({ mediaQuery, className
|
|
163
|
-
const cssClass = `.${
|
|
164
|
+
const createCssClass = ({ mediaQuery, className, styles }) => {
|
|
165
|
+
const cssClass = `.${className} {
|
|
164
166
|
${convertStyleMapToCSS(styles)}
|
|
165
167
|
}`;
|
|
166
168
|
if (mediaQuery)
|
|
@@ -170,69 +172,95 @@ const createCssClass = ({ mediaQuery, className: className3, styles }) => {
|
|
|
170
172
|
else
|
|
171
173
|
return cssClass;
|
|
172
174
|
};
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
175
|
+
const RenderInlinedStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
176
|
+
const tag = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
177
|
+
return "style";
|
|
178
|
+
}, "RenderInlinedStyles_component_tag_useComputed_S1nSc0C6qB4"));
|
|
179
|
+
useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
180
|
+
const [props2, tag2] = useLexicalScope();
|
|
181
|
+
return `<${tag2.value}>${props2.styles}</${tag2.value}>`;
|
|
182
|
+
}, "RenderInlinedStyles_component_injectedStyleScript_useComputed_CVKinNBYTxE", [
|
|
183
|
+
props,
|
|
184
|
+
tag
|
|
185
|
+
]));
|
|
179
186
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
180
|
-
children: /* @__PURE__ */ _jsxQ("style", {
|
|
181
|
-
dangerouslySetInnerHTML:
|
|
182
|
-
|
|
187
|
+
children: /* @__PURE__ */ _jsxQ("style", null, {
|
|
188
|
+
dangerouslySetInnerHTML: _fnSignal((p0) => p0.styles, [
|
|
189
|
+
props
|
|
190
|
+
], "p0.styles")
|
|
191
|
+
}, null, 3, "zz_0")
|
|
183
192
|
}, 1, "zz_2");
|
|
184
|
-
};
|
|
185
|
-
const
|
|
186
|
-
return getProcessedBlock({
|
|
187
|
-
block: props.block,
|
|
188
|
-
state: props.context.state,
|
|
189
|
-
context: props.context.context,
|
|
190
|
-
shouldEvaluateBindings: true
|
|
191
|
-
});
|
|
192
|
-
};
|
|
193
|
-
const canShowBlock$1 = function canShowBlock2(props, state) {
|
|
194
|
-
if (checkIsDefined(useBlock$1(props).hide))
|
|
195
|
-
return !useBlock$1(props).hide;
|
|
196
|
-
if (checkIsDefined(useBlock$1(props).show))
|
|
197
|
-
return useBlock$1(props).show;
|
|
198
|
-
return true;
|
|
199
|
-
};
|
|
200
|
-
const css = function css2(props, state) {
|
|
201
|
-
const styles = useBlock$1(props).responsiveStyles;
|
|
202
|
-
const content = props.context.content;
|
|
203
|
-
const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(content?.meta?.breakpoints || {});
|
|
204
|
-
const largeStyles = styles?.large;
|
|
205
|
-
const mediumStyles = styles?.medium;
|
|
206
|
-
const smallStyles = styles?.small;
|
|
207
|
-
const className3 = useBlock$1(props).id;
|
|
208
|
-
const largeStylesClass = largeStyles ? createCssClass({
|
|
209
|
-
className: className3,
|
|
210
|
-
styles: largeStyles
|
|
211
|
-
}) : "";
|
|
212
|
-
const mediumStylesClass = mediumStyles ? createCssClass({
|
|
213
|
-
className: className3,
|
|
214
|
-
styles: mediumStyles,
|
|
215
|
-
mediaQuery: getMaxWidthQueryForSize("medium", sizesWithUpdatedBreakpoints)
|
|
216
|
-
}) : "";
|
|
217
|
-
const smallStylesClass = smallStyles ? createCssClass({
|
|
218
|
-
className: className3,
|
|
219
|
-
styles: smallStyles,
|
|
220
|
-
mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
|
|
221
|
-
}) : "";
|
|
222
|
-
return [
|
|
223
|
-
largeStylesClass,
|
|
224
|
-
mediumStylesClass,
|
|
225
|
-
smallStylesClass
|
|
226
|
-
].join(" ");
|
|
227
|
-
};
|
|
228
|
-
const BlockStyles = (props) => {
|
|
193
|
+
}, "RenderInlinedStyles_component_ejNQtXd1ahM"));
|
|
194
|
+
const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
229
195
|
_jsxBranch();
|
|
196
|
+
const useBlock = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
197
|
+
const [props2] = useLexicalScope();
|
|
198
|
+
return getProcessedBlock({
|
|
199
|
+
block: props2.block,
|
|
200
|
+
state: props2.context.state,
|
|
201
|
+
context: props2.context.context,
|
|
202
|
+
shouldEvaluateBindings: true
|
|
203
|
+
});
|
|
204
|
+
}, "BlockStyles_component_useBlock_useComputed_9Y0pQBSnHds", [
|
|
205
|
+
props
|
|
206
|
+
]));
|
|
207
|
+
const canShowBlock = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
208
|
+
const [useBlock2] = useLexicalScope();
|
|
209
|
+
if (checkIsDefined(useBlock2.value.hide))
|
|
210
|
+
return !useBlock2.value.hide;
|
|
211
|
+
if (checkIsDefined(useBlock2.value.show))
|
|
212
|
+
return useBlock2.value.show;
|
|
213
|
+
return true;
|
|
214
|
+
}, "BlockStyles_component_canShowBlock_useComputed_QhiYxJDtCJY", [
|
|
215
|
+
useBlock
|
|
216
|
+
]));
|
|
217
|
+
const css = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
218
|
+
const [props2, useBlock2] = useLexicalScope();
|
|
219
|
+
const styles = useBlock2.value.responsiveStyles;
|
|
220
|
+
const content = props2.context.content;
|
|
221
|
+
const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(content?.meta?.breakpoints || {});
|
|
222
|
+
const largeStyles = styles?.large;
|
|
223
|
+
const mediumStyles = styles?.medium;
|
|
224
|
+
const smallStyles = styles?.small;
|
|
225
|
+
const className = useBlock2.value.id;
|
|
226
|
+
if (!className)
|
|
227
|
+
return "";
|
|
228
|
+
const largeStylesClass = largeStyles ? createCssClass({
|
|
229
|
+
className,
|
|
230
|
+
styles: largeStyles
|
|
231
|
+
}) : "";
|
|
232
|
+
const mediumStylesClass = mediumStyles ? createCssClass({
|
|
233
|
+
className,
|
|
234
|
+
styles: mediumStyles,
|
|
235
|
+
mediaQuery: getMaxWidthQueryForSize("medium", sizesWithUpdatedBreakpoints)
|
|
236
|
+
}) : "";
|
|
237
|
+
const smallStylesClass = smallStyles ? createCssClass({
|
|
238
|
+
className,
|
|
239
|
+
styles: smallStyles,
|
|
240
|
+
mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
|
|
241
|
+
}) : "";
|
|
242
|
+
return [
|
|
243
|
+
largeStylesClass,
|
|
244
|
+
mediumStylesClass,
|
|
245
|
+
smallStylesClass
|
|
246
|
+
].join(" ");
|
|
247
|
+
}, "BlockStyles_component_css_useComputed_wAetZF3ncbo", [
|
|
248
|
+
props,
|
|
249
|
+
useBlock
|
|
250
|
+
]));
|
|
230
251
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
231
|
-
children: css
|
|
232
|
-
styles
|
|
252
|
+
children: css.value && canShowBlock.value ? /* @__PURE__ */ _jsxC(RenderInlinedStyles, {
|
|
253
|
+
get styles() {
|
|
254
|
+
return css.value;
|
|
255
|
+
},
|
|
256
|
+
[_IMMUTABLE]: {
|
|
257
|
+
styles: _fnSignal((p0) => p0.value, [
|
|
258
|
+
css
|
|
259
|
+
], "p0.value")
|
|
260
|
+
}
|
|
233
261
|
}, 3, "LQ_0") : null
|
|
234
262
|
}, 1, "LQ_1");
|
|
235
|
-
};
|
|
263
|
+
}, "BlockStyles_component_r0t5qGxiwHA"));
|
|
236
264
|
function capitalizeFirstLetter(string) {
|
|
237
265
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
238
266
|
}
|
|
@@ -272,8 +300,14 @@ function getBlockComponentOptions(block) {
|
|
|
272
300
|
function transformBlockProperties(properties) {
|
|
273
301
|
return properties;
|
|
274
302
|
}
|
|
303
|
+
const extractRelevantRootBlockProperties = (block) => {
|
|
304
|
+
return {
|
|
305
|
+
href: block.href
|
|
306
|
+
};
|
|
307
|
+
};
|
|
275
308
|
function getBlockProperties(block) {
|
|
276
309
|
const properties = {
|
|
310
|
+
...extractRelevantRootBlockProperties(block),
|
|
277
311
|
...block.properties,
|
|
278
312
|
"builder-id": block.id,
|
|
279
313
|
style: getStyleAttribute(block.style),
|
|
@@ -301,9 +335,6 @@ function getStyleAttribute(style) {
|
|
|
301
335
|
return style;
|
|
302
336
|
}
|
|
303
337
|
}
|
|
304
|
-
function getBlockTag(block) {
|
|
305
|
-
return block.tagName || "div";
|
|
306
|
-
}
|
|
307
338
|
const EMPTY_HTML_ELEMENTS = [
|
|
308
339
|
"area",
|
|
309
340
|
"base",
|
|
@@ -370,6 +401,20 @@ const getRepeatItemData = ({ block, context }) => {
|
|
|
370
401
|
}));
|
|
371
402
|
return repeatArray;
|
|
372
403
|
};
|
|
404
|
+
const getProxyState = (context) => {
|
|
405
|
+
if (typeof Proxy === "undefined") {
|
|
406
|
+
console.error("no Proxy available in this environment, cannot proxy state.");
|
|
407
|
+
return context.state;
|
|
408
|
+
}
|
|
409
|
+
const useState = new Proxy(context.state, {
|
|
410
|
+
set: (obj, prop, value) => {
|
|
411
|
+
obj[prop] = value;
|
|
412
|
+
context.setState?.(obj);
|
|
413
|
+
return true;
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
return useState;
|
|
417
|
+
};
|
|
373
418
|
const RenderComponent = (props) => {
|
|
374
419
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
375
420
|
children: props.componentRef ? /* @__PURE__ */ _jsxC(props.componentRef, {
|
|
@@ -427,111 +472,135 @@ const RenderRepeatedBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlined
|
|
|
427
472
|
}
|
|
428
473
|
}, 3, "K5_0");
|
|
429
474
|
}, "RenderRepeatedBlock_component_nRyVBtbGKc8"));
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
};
|
|
436
|
-
const tag = function tag22(props, state) {
|
|
437
|
-
return getBlockTag(useBlock(props));
|
|
438
|
-
};
|
|
439
|
-
const useBlock = function useBlock22(props, state) {
|
|
440
|
-
return repeatItemData(props) ? props.block : getProcessedBlock({
|
|
441
|
-
block: props.block,
|
|
442
|
-
state: props.context.state,
|
|
443
|
-
context: props.context.context,
|
|
444
|
-
shouldEvaluateBindings: true
|
|
445
|
-
});
|
|
446
|
-
};
|
|
447
|
-
const canShowBlock = function canShowBlock22(props, state) {
|
|
448
|
-
if (checkIsDefined(useBlock(props).hide))
|
|
449
|
-
return !useBlock(props).hide;
|
|
450
|
-
if (checkIsDefined(useBlock(props).show))
|
|
451
|
-
return useBlock(props).show;
|
|
452
|
-
return true;
|
|
453
|
-
};
|
|
454
|
-
const proxyState = function proxyState2(props, state) {
|
|
455
|
-
if (typeof Proxy === "undefined") {
|
|
456
|
-
console.error("no Proxy available in this environment, cannot proxy state.");
|
|
457
|
-
return props.context.state;
|
|
458
|
-
}
|
|
459
|
-
const useState = new Proxy(props.context.state, {
|
|
460
|
-
set: (obj, prop, value) => {
|
|
461
|
-
obj[prop] = value;
|
|
462
|
-
props.context.setState?.(obj);
|
|
463
|
-
return true;
|
|
464
|
-
}
|
|
465
|
-
});
|
|
466
|
-
return useState;
|
|
467
|
-
};
|
|
468
|
-
const actions = function actions2(props, state) {
|
|
469
|
-
return getBlockActions({
|
|
470
|
-
block: useBlock(props),
|
|
471
|
-
state: proxyState(props),
|
|
472
|
-
context: props.context.context
|
|
475
|
+
const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
476
|
+
_jsxBranch();
|
|
477
|
+
const state = useStore({
|
|
478
|
+
proxyState: getProxyState(props.context),
|
|
479
|
+
tag: props.block.tagName || "div"
|
|
473
480
|
});
|
|
474
|
-
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
481
|
+
const component = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
482
|
+
const [props2] = useLexicalScope();
|
|
483
|
+
return getComponent({
|
|
484
|
+
block: props2.block,
|
|
485
|
+
context: props2.context
|
|
486
|
+
});
|
|
487
|
+
}, "RenderBlock_component_component_useComputed_qb7DMTJ9XGY", [
|
|
488
|
+
props
|
|
489
|
+
]));
|
|
490
|
+
const repeatItemData = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
491
|
+
const [props2] = useLexicalScope();
|
|
492
|
+
return getRepeatItemData({
|
|
493
|
+
block: props2.block,
|
|
494
|
+
context: props2.context
|
|
495
|
+
});
|
|
496
|
+
}, "RenderBlock_component_repeatItemData_useComputed_Q2wkGRsY3KE", [
|
|
497
|
+
props
|
|
498
|
+
]));
|
|
499
|
+
const useBlock = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
500
|
+
const [props2, repeatItemData2] = useLexicalScope();
|
|
501
|
+
return repeatItemData2.value ? props2.block : getProcessedBlock({
|
|
502
|
+
block: props2.block,
|
|
503
|
+
state: props2.context.state,
|
|
504
|
+
context: props2.context.context,
|
|
505
|
+
shouldEvaluateBindings: true
|
|
506
|
+
});
|
|
507
|
+
}, "RenderBlock_component_useBlock_useComputed_4ZTSqMpaluI", [
|
|
508
|
+
props,
|
|
509
|
+
repeatItemData
|
|
510
|
+
]));
|
|
511
|
+
const canShowBlock = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
512
|
+
const [useBlock2] = useLexicalScope();
|
|
513
|
+
if ("hide" in useBlock2.value)
|
|
514
|
+
return !useBlock2.value.hide;
|
|
515
|
+
if ("show" in useBlock2.value)
|
|
516
|
+
return useBlock2.value.show;
|
|
517
|
+
return true;
|
|
518
|
+
}, "RenderBlock_component_canShowBlock_useComputed_82dAQcDBUzY", [
|
|
519
|
+
useBlock
|
|
520
|
+
]));
|
|
521
|
+
const actions = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
522
|
+
const [props2, state2, useBlock2] = useLexicalScope();
|
|
523
|
+
return getBlockActions({
|
|
524
|
+
block: useBlock2.value,
|
|
525
|
+
state: props2.context.state,
|
|
526
|
+
context: props2.context.context
|
|
527
|
+
});
|
|
528
|
+
}, "RenderBlock_component_actions_useComputed_AOTwdXfwCqY", [
|
|
529
|
+
props,
|
|
530
|
+
state,
|
|
531
|
+
useBlock
|
|
532
|
+
]));
|
|
533
|
+
const attributes = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
534
|
+
const [props2, useBlock2] = useLexicalScope();
|
|
535
|
+
const blockProperties = getBlockProperties(useBlock2.value);
|
|
536
|
+
return {
|
|
537
|
+
...blockProperties,
|
|
538
|
+
...{}
|
|
539
|
+
};
|
|
540
|
+
}, "RenderBlock_component_attributes_useComputed_2cvnb0dCzeU", [
|
|
541
|
+
props,
|
|
542
|
+
useBlock
|
|
543
|
+
]));
|
|
544
|
+
const childrenWithoutParentComponent = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
545
|
+
const [component2, repeatItemData2, useBlock2] = useLexicalScope();
|
|
546
|
+
const shouldRenderChildrenOutsideRef = !component2.value?.component && !repeatItemData2.value;
|
|
547
|
+
return shouldRenderChildrenOutsideRef ? useBlock2.value.children ?? [] : [];
|
|
548
|
+
}, "RenderBlock_component_childrenWithoutParentComponent_useComputed_l4hT2V9liQc", [
|
|
549
|
+
component,
|
|
550
|
+
repeatItemData,
|
|
551
|
+
useBlock
|
|
552
|
+
]));
|
|
553
|
+
const childrenContext = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
554
|
+
const [attributes2, props2, useBlock2] = useLexicalScope();
|
|
555
|
+
const getInheritedTextStyles = () => {
|
|
556
|
+
return {};
|
|
557
|
+
};
|
|
558
|
+
return {
|
|
559
|
+
apiKey: props2.context.apiKey,
|
|
560
|
+
apiVersion: props2.context.apiVersion,
|
|
561
|
+
state: props2.context.state,
|
|
562
|
+
content: props2.context.content,
|
|
563
|
+
context: props2.context.context,
|
|
564
|
+
setState: props2.context.setState,
|
|
565
|
+
registeredComponents: props2.context.registeredComponents,
|
|
566
|
+
inheritedStyles: getInheritedTextStyles()
|
|
567
|
+
};
|
|
568
|
+
}, "RenderBlock_component_childrenContext_useComputed_gskFnyBnHDI", [
|
|
569
|
+
attributes,
|
|
570
|
+
props,
|
|
571
|
+
useBlock
|
|
572
|
+
]));
|
|
573
|
+
const renderComponentProps = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
574
|
+
const [actions2, attributes2, childrenContext2, component2, useBlock2] = useLexicalScope();
|
|
575
|
+
return {
|
|
576
|
+
blockChildren: useBlock2.value.children ?? [],
|
|
577
|
+
componentRef: component2.value?.component,
|
|
578
|
+
componentOptions: {
|
|
579
|
+
...getBlockComponentOptions(useBlock2.value),
|
|
580
|
+
...!component2.value?.noWrap ? {} : {
|
|
581
|
+
attributes: {
|
|
582
|
+
...attributes2.value,
|
|
583
|
+
...actions2.value
|
|
584
|
+
}
|
|
492
585
|
}
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
return getRepeatItemData({
|
|
504
|
-
block: props.block,
|
|
505
|
-
context: props.context
|
|
506
|
-
});
|
|
507
|
-
};
|
|
508
|
-
const childrenContext = function childrenContext2(props, state) {
|
|
509
|
-
const getInheritedTextStyles = () => {
|
|
510
|
-
return {};
|
|
511
|
-
};
|
|
512
|
-
return {
|
|
513
|
-
apiKey: props.context.apiKey,
|
|
514
|
-
apiVersion: props.context.apiVersion,
|
|
515
|
-
state: props.context.state,
|
|
516
|
-
content: props.context.content,
|
|
517
|
-
context: props.context.context,
|
|
518
|
-
setState: props.context.setState,
|
|
519
|
-
registeredComponents: props.context.registeredComponents,
|
|
520
|
-
inheritedStyles: getInheritedTextStyles()
|
|
521
|
-
};
|
|
522
|
-
};
|
|
523
|
-
const RenderBlock = (props) => {
|
|
524
|
-
_jsxBranch();
|
|
525
|
-
const state = {};
|
|
526
|
-
state.tag = tag(props);
|
|
586
|
+
},
|
|
587
|
+
context: childrenContext2.value
|
|
588
|
+
};
|
|
589
|
+
}, "RenderBlock_component_renderComponentProps_useComputed_tWa1cp0r7XY", [
|
|
590
|
+
actions,
|
|
591
|
+
attributes,
|
|
592
|
+
childrenContext,
|
|
593
|
+
component,
|
|
594
|
+
useBlock
|
|
595
|
+
]));
|
|
527
596
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
528
|
-
children: canShowBlock
|
|
597
|
+
children: canShowBlock.value ? !component.value?.noWrap ? /* @__PURE__ */ _jsxC(Fragment, {
|
|
529
598
|
children: [
|
|
530
|
-
isEmptyHtmlElement(tag
|
|
531
|
-
...attributes
|
|
532
|
-
...actions
|
|
533
|
-
},
|
|
534
|
-
!isEmptyHtmlElement(tag
|
|
599
|
+
isEmptyHtmlElement(state.tag) ? /* @__PURE__ */ _jsxC(state.tag, {
|
|
600
|
+
...attributes.value,
|
|
601
|
+
...actions.value
|
|
602
|
+
}, 0, "9d_0") : null,
|
|
603
|
+
!isEmptyHtmlElement(state.tag) && repeatItemData.value ? (repeatItemData.value || []).map(function(data, index) {
|
|
535
604
|
return /* @__PURE__ */ _jsxC(RenderRepeatedBlock, {
|
|
536
605
|
get repeatContext() {
|
|
537
606
|
return data.context;
|
|
@@ -545,36 +614,47 @@ const RenderBlock = (props) => {
|
|
|
545
614
|
}
|
|
546
615
|
}, 3, index);
|
|
547
616
|
}) : null,
|
|
548
|
-
!isEmptyHtmlElement(tag
|
|
549
|
-
...attributes
|
|
550
|
-
...actions
|
|
617
|
+
!isEmptyHtmlElement(state.tag) && !repeatItemData.value ? /* @__PURE__ */ _jsxC(state.tag, {
|
|
618
|
+
...attributes.value,
|
|
619
|
+
...actions.value,
|
|
551
620
|
children: [
|
|
552
621
|
/* @__PURE__ */ _jsxC(RenderComponent, {
|
|
553
|
-
...renderComponentProps
|
|
554
|
-
},
|
|
555
|
-
(childrenWithoutParentComponent
|
|
622
|
+
...renderComponentProps.value
|
|
623
|
+
}, 0, "9d_1"),
|
|
624
|
+
(childrenWithoutParentComponent.value || []).map(function(child) {
|
|
556
625
|
return /* @__PURE__ */ _jsxC(RenderBlock, {
|
|
557
626
|
block: child,
|
|
558
|
-
context
|
|
627
|
+
get context() {
|
|
628
|
+
return childrenContext.value;
|
|
629
|
+
},
|
|
630
|
+
[_IMMUTABLE]: {
|
|
631
|
+
context: _fnSignal((p0) => p0.value, [
|
|
632
|
+
childrenContext
|
|
633
|
+
], "p0.value")
|
|
634
|
+
}
|
|
559
635
|
}, 3, "render-block-" + child.id);
|
|
560
636
|
}),
|
|
561
|
-
(childrenWithoutParentComponent
|
|
637
|
+
(childrenWithoutParentComponent.value || []).map(function(child) {
|
|
562
638
|
return /* @__PURE__ */ _jsxC(BlockStyles, {
|
|
563
639
|
block: child,
|
|
564
|
-
context
|
|
640
|
+
get context() {
|
|
641
|
+
return childrenContext.value;
|
|
642
|
+
},
|
|
643
|
+
[_IMMUTABLE]: {
|
|
644
|
+
context: _fnSignal((p0) => p0.value, [
|
|
645
|
+
childrenContext
|
|
646
|
+
], "p0.value")
|
|
647
|
+
}
|
|
565
648
|
}, 3, "block-style-" + child.id);
|
|
566
649
|
})
|
|
567
650
|
]
|
|
568
651
|
}, 0, "9d_2") : null
|
|
569
652
|
]
|
|
570
653
|
}, 1, "9d_3") : /* @__PURE__ */ _jsxC(RenderComponent, {
|
|
571
|
-
...renderComponentProps
|
|
572
|
-
},
|
|
654
|
+
...renderComponentProps.value
|
|
655
|
+
}, 0, "9d_4") : null
|
|
573
656
|
}, 1, "9d_5");
|
|
574
|
-
};
|
|
575
|
-
const className = function className2(props, state, builderContext2) {
|
|
576
|
-
return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
|
|
577
|
-
};
|
|
657
|
+
}, "RenderBlock_component_m0hg0zT573Q"));
|
|
578
658
|
const onClick$1 = function onClick2(props, state, builderContext2) {
|
|
579
659
|
if (isEditing() && !props.blocks?.length)
|
|
580
660
|
window.parent?.postMessage({
|
|
@@ -599,8 +679,13 @@ const RenderBlocks = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
599
679
|
useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$2, "RenderBlocks_component_useStylesScoped_0XKYzaR059E"));
|
|
600
680
|
const builderContext$1 = useContext(builderContext);
|
|
601
681
|
const state = {};
|
|
682
|
+
const className = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
683
|
+
const [props2] = useLexicalScope();
|
|
684
|
+
return "builder-blocks" + (!props2.blocks?.length ? " no-blocks" : "");
|
|
685
|
+
}, "RenderBlocks_component_className_useComputed_7iQuBozD6Tc", [
|
|
686
|
+
props
|
|
687
|
+
]));
|
|
602
688
|
return /* @__PURE__ */ _jsxQ("div", {
|
|
603
|
-
class: className(props) + " div-RenderBlocks",
|
|
604
689
|
onClick$: /* @__PURE__ */ inlinedQrl((event) => {
|
|
605
690
|
const [builderContext2, props2, state2] = useLexicalScope();
|
|
606
691
|
return onClick$1(props2);
|
|
@@ -618,6 +703,9 @@ const RenderBlocks = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
618
703
|
state
|
|
619
704
|
])
|
|
620
705
|
}, {
|
|
706
|
+
class: _fnSignal((p0) => p0.value + " div-RenderBlocks", [
|
|
707
|
+
className
|
|
708
|
+
], 'p0.value+" div-RenderBlocks"'),
|
|
621
709
|
"builder-path": _fnSignal((p0) => p0.path, [
|
|
622
710
|
props
|
|
623
711
|
], "p0.path"),
|
|
@@ -668,15 +756,6 @@ const getTabletStyle = function getTabletStyle2(props, state, builderContext2, {
|
|
|
668
756
|
const getMobileStyle = function getMobileStyle2(props, state, builderContext2, { stackedStyle, desktopStyle }) {
|
|
669
757
|
return state.stackAt === "never" ? desktopStyle : stackedStyle;
|
|
670
758
|
};
|
|
671
|
-
const columnsCssVars = function columnsCssVars2(props, state, builderContext2) {
|
|
672
|
-
return {
|
|
673
|
-
"--flex-dir": state.flexDir,
|
|
674
|
-
"--flex-dir-tablet": getTabletStyle(props, state, builderContext2, {
|
|
675
|
-
stackedStyle: state.flexDir,
|
|
676
|
-
desktopStyle: "row"
|
|
677
|
-
})
|
|
678
|
-
};
|
|
679
|
-
};
|
|
680
759
|
const columnCssVars = function columnCssVars2(props, state, builderContext2, index) {
|
|
681
760
|
index === 0 ? 0 : state.gutterSize;
|
|
682
761
|
const width = getColumnCssWidth(props, state, builderContext2, index);
|
|
@@ -706,52 +785,79 @@ const getWidthForBreakpointSize = function getWidthForBreakpointSize2(props, sta
|
|
|
706
785
|
const breakpointSizes = getSizesForBreakpoints(builderContext2.content?.meta?.breakpoints || {});
|
|
707
786
|
return breakpointSizes[size].max;
|
|
708
787
|
};
|
|
709
|
-
const
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
788
|
+
const Columns = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
789
|
+
_jsxBranch();
|
|
790
|
+
useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$1, "Columns_component_useStylesScoped_s7JLZz7MCCQ"));
|
|
791
|
+
const builderContext$1 = useContext(builderContext);
|
|
792
|
+
const state = useStore({
|
|
793
|
+
cols: props.columns || [],
|
|
794
|
+
flexDir: props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column",
|
|
795
|
+
gutterSize: typeof props.space === "number" ? props.space || 0 : 20,
|
|
796
|
+
stackAt: props.stackColumnsAt || "tablet"
|
|
797
|
+
});
|
|
798
|
+
const columnsCssVars = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
799
|
+
const [builderContext2, props2, state2] = useLexicalScope();
|
|
800
|
+
return {
|
|
801
|
+
"--flex-dir": state2.flexDir,
|
|
802
|
+
"--flex-dir-tablet": getTabletStyle(props2, state2, builderContext2, {
|
|
803
|
+
stackedStyle: state2.flexDir,
|
|
804
|
+
desktopStyle: "row"
|
|
805
|
+
})
|
|
806
|
+
};
|
|
807
|
+
}, "Columns_component_columnsCssVars_useComputed_adFEq2RWT9s", [
|
|
808
|
+
builderContext$1,
|
|
809
|
+
props,
|
|
810
|
+
state
|
|
811
|
+
]));
|
|
812
|
+
const columnsStyles = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
813
|
+
const [builderContext2, props2, state2] = useLexicalScope();
|
|
814
|
+
return `
|
|
815
|
+
@media (max-width: ${getWidthForBreakpointSize(props2, state2, builderContext2, "medium")}px) {
|
|
816
|
+
.${props2.builderBlock.id}-breakpoints {
|
|
713
817
|
flex-direction: var(--flex-dir-tablet);
|
|
714
818
|
align-items: stretch;
|
|
715
819
|
}
|
|
716
820
|
|
|
717
|
-
.${
|
|
821
|
+
.${props2.builderBlock.id}-breakpoints > .builder-column {
|
|
718
822
|
width: var(--column-width-tablet) !important;
|
|
719
823
|
margin-left: var(--column-margin-left-tablet) !important;
|
|
720
824
|
}
|
|
721
825
|
}
|
|
722
826
|
|
|
723
|
-
@media (max-width: ${getWidthForBreakpointSize(
|
|
724
|
-
.${
|
|
827
|
+
@media (max-width: ${getWidthForBreakpointSize(props2, state2, builderContext2, "small")}px) {
|
|
828
|
+
.${props2.builderBlock.id}-breakpoints {
|
|
725
829
|
flex-direction: var(--flex-dir);
|
|
726
830
|
align-items: stretch;
|
|
727
831
|
}
|
|
728
832
|
|
|
729
|
-
.${
|
|
833
|
+
.${props2.builderBlock.id}-breakpoints > .builder-column {
|
|
730
834
|
width: var(--column-width-mobile) !important;
|
|
731
835
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
732
836
|
}
|
|
733
837
|
},
|
|
734
838
|
`;
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
cols: props.columns || [],
|
|
742
|
-
flexDir: props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column",
|
|
743
|
-
gutterSize: typeof props.space === "number" ? props.space || 0 : 20,
|
|
744
|
-
stackAt: props.stackColumnsAt || "tablet"
|
|
745
|
-
});
|
|
746
|
-
return /* @__PURE__ */ _jsxQ("div", {
|
|
747
|
-
style: columnsCssVars(props, state, builderContext$1)
|
|
748
|
-
}, {
|
|
839
|
+
}, "Columns_component_columnsStyles_useComputed_nBtMPbzd1Wc", [
|
|
840
|
+
builderContext$1,
|
|
841
|
+
props,
|
|
842
|
+
state
|
|
843
|
+
]));
|
|
844
|
+
return /* @__PURE__ */ _jsxQ("div", null, {
|
|
749
845
|
class: _fnSignal((p0) => `builder-columns ${p0.builderBlock.id}-breakpoints div-Columns`, [
|
|
750
846
|
props
|
|
751
|
-
], '`builder-columns ${p0.builderBlock.id}-breakpoints`+" div-Columns"')
|
|
847
|
+
], '`builder-columns ${p0.builderBlock.id}-breakpoints`+" div-Columns"'),
|
|
848
|
+
style: _fnSignal((p0) => p0.value, [
|
|
849
|
+
columnsCssVars
|
|
850
|
+
], "p0.value")
|
|
752
851
|
}, [
|
|
753
852
|
/* @__PURE__ */ _jsxC(RenderInlinedStyles, {
|
|
754
|
-
styles
|
|
853
|
+
get styles() {
|
|
854
|
+
return columnsStyles.value;
|
|
855
|
+
},
|
|
856
|
+
[_IMMUTABLE]: {
|
|
857
|
+
styles: _fnSignal((p0) => p0.value, [
|
|
858
|
+
columnsStyles
|
|
859
|
+
], "p0.value")
|
|
860
|
+
}
|
|
755
861
|
}, 3, "c0_0"),
|
|
756
862
|
(props.columns || []).map(function(column, index) {
|
|
757
863
|
return /* @__PURE__ */ _jsxQ("div", {
|
|
@@ -847,55 +953,59 @@ function getSrcSet(url) {
|
|
|
847
953
|
]).join(", ");
|
|
848
954
|
return url;
|
|
849
955
|
}
|
|
850
|
-
const srcSetToUse = function srcSetToUse2(props, state) {
|
|
851
|
-
const imageToUse = props.image || props.src;
|
|
852
|
-
if (!imageToUse || !(imageToUse.match(/builder\.io/) || imageToUse.match(/cdn\.shopify\.com/)))
|
|
853
|
-
return props.srcset;
|
|
854
|
-
if (props.srcset && props.image?.includes("builder.io/api/v1/image")) {
|
|
855
|
-
if (!props.srcset.includes(props.image.split("?")[0])) {
|
|
856
|
-
console.debug("Removed given srcset");
|
|
857
|
-
return getSrcSet(imageToUse);
|
|
858
|
-
}
|
|
859
|
-
} else if (props.image && !props.srcset)
|
|
860
|
-
return getSrcSet(imageToUse);
|
|
861
|
-
return getSrcSet(imageToUse);
|
|
862
|
-
};
|
|
863
|
-
const webpSrcSet = function webpSrcSet2(props, state) {
|
|
864
|
-
if (srcSetToUse(props)?.match(/builder\.io/) && !props.noWebp)
|
|
865
|
-
return srcSetToUse(props).replace(/\?/g, "?format=webp&");
|
|
866
|
-
else
|
|
867
|
-
return "";
|
|
868
|
-
};
|
|
869
|
-
const aspectRatioCss = function aspectRatioCss2(props, state) {
|
|
870
|
-
const aspectRatioStyles = {
|
|
871
|
-
position: "absolute",
|
|
872
|
-
height: "100%",
|
|
873
|
-
width: "100%",
|
|
874
|
-
left: "0px",
|
|
875
|
-
top: "0px"
|
|
876
|
-
};
|
|
877
|
-
const out = props.aspectRatio ? aspectRatioStyles : void 0;
|
|
878
|
-
return out;
|
|
879
|
-
};
|
|
880
956
|
const Image = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
881
957
|
_jsxBranch();
|
|
882
958
|
useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES, "Image_component_useStylesScoped_fBMYiVf9fuU"));
|
|
959
|
+
const srcSetToUse = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
960
|
+
const [props2] = useLexicalScope();
|
|
961
|
+
const imageToUse = props2.image || props2.src;
|
|
962
|
+
if (!imageToUse || !(imageToUse.match(/builder\.io/) || imageToUse.match(/cdn\.shopify\.com/)))
|
|
963
|
+
return props2.srcset;
|
|
964
|
+
if (props2.srcset && props2.image?.includes("builder.io/api/v1/image")) {
|
|
965
|
+
if (!props2.srcset.includes(props2.image.split("?")[0])) {
|
|
966
|
+
console.debug("Removed given srcset");
|
|
967
|
+
return getSrcSet(imageToUse);
|
|
968
|
+
}
|
|
969
|
+
} else if (props2.image && !props2.srcset)
|
|
970
|
+
return getSrcSet(imageToUse);
|
|
971
|
+
return getSrcSet(imageToUse);
|
|
972
|
+
}, "Image_component_srcSetToUse_useComputed_TZMibf9Gpvw", [
|
|
973
|
+
props
|
|
974
|
+
]));
|
|
975
|
+
const webpSrcSet = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
976
|
+
const [props2, srcSetToUse2] = useLexicalScope();
|
|
977
|
+
if (srcSetToUse2.value?.match(/builder\.io/) && !props2.noWebp)
|
|
978
|
+
return srcSetToUse2.value.replace(/\?/g, "?format=webp&");
|
|
979
|
+
else
|
|
980
|
+
return "";
|
|
981
|
+
}, "Image_component_webpSrcSet_useComputed_01YCu72BBtA", [
|
|
982
|
+
props,
|
|
983
|
+
srcSetToUse
|
|
984
|
+
]));
|
|
985
|
+
const aspectRatioCss = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
986
|
+
const [props2] = useLexicalScope();
|
|
987
|
+
const aspectRatioStyles = {
|
|
988
|
+
position: "absolute",
|
|
989
|
+
height: "100%",
|
|
990
|
+
width: "100%",
|
|
991
|
+
left: "0px",
|
|
992
|
+
top: "0px"
|
|
993
|
+
};
|
|
994
|
+
const out = props2.aspectRatio ? aspectRatioStyles : void 0;
|
|
995
|
+
return out;
|
|
996
|
+
}, "Image_component_aspectRatioCss_useComputed_yJ1jG0g5fbw", [
|
|
997
|
+
props
|
|
998
|
+
]));
|
|
883
999
|
return /* @__PURE__ */ _jsxC(Fragment$1, {
|
|
884
1000
|
children: [
|
|
885
1001
|
/* @__PURE__ */ _jsxQ("picture", null, null, [
|
|
886
|
-
webpSrcSet
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
1002
|
+
webpSrcSet.value ? /* @__PURE__ */ _jsxQ("source", null, {
|
|
1003
|
+
type: "image/webp",
|
|
1004
|
+
srcSet: _fnSignal((p0) => p0.value, [
|
|
1005
|
+
webpSrcSet
|
|
1006
|
+
], "p0.value")
|
|
890
1007
|
}, null, 3, "0A_0") : null,
|
|
891
|
-
/* @__PURE__ */ _jsxQ("img", {
|
|
892
|
-
style: {
|
|
893
|
-
objectPosition: props.backgroundPosition || "center",
|
|
894
|
-
objectFit: props.backgroundSize || "cover",
|
|
895
|
-
...aspectRatioCss(props)
|
|
896
|
-
},
|
|
897
|
-
srcSet: srcSetToUse(props)
|
|
898
|
-
}, {
|
|
1008
|
+
/* @__PURE__ */ _jsxQ("img", null, {
|
|
899
1009
|
loading: "lazy",
|
|
900
1010
|
alt: _fnSignal((p0) => p0.altText, [
|
|
901
1011
|
props
|
|
@@ -903,12 +1013,23 @@ const Image = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
903
1013
|
role: _fnSignal((p0) => p0.altText ? "presentation" : void 0, [
|
|
904
1014
|
props
|
|
905
1015
|
], 'p0.altText?"presentation":undefined'),
|
|
1016
|
+
style: _fnSignal((p0, p1) => ({
|
|
1017
|
+
objectPosition: p1.backgroundPosition || "center",
|
|
1018
|
+
objectFit: p1.backgroundSize || "cover",
|
|
1019
|
+
...p0.value
|
|
1020
|
+
}), [
|
|
1021
|
+
aspectRatioCss,
|
|
1022
|
+
props
|
|
1023
|
+
], '{objectPosition:p1.backgroundPosition||"center",objectFit:p1.backgroundSize||"cover",...p0.value}'),
|
|
906
1024
|
class: _fnSignal((p0) => "builder-image" + (p0.className ? " " + p0.className : "") + " img-Image", [
|
|
907
1025
|
props
|
|
908
1026
|
], '"builder-image"+(p0.className?" "+p0.className:"")+" img-Image"'),
|
|
909
1027
|
src: _fnSignal((p0) => p0.image, [
|
|
910
1028
|
props
|
|
911
1029
|
], "p0.image"),
|
|
1030
|
+
srcSet: _fnSignal((p0) => p0.value, [
|
|
1031
|
+
srcSetToUse
|
|
1032
|
+
], "p0.value"),
|
|
912
1033
|
sizes: _fnSignal((p0) => p0.sizes, [
|
|
913
1034
|
props
|
|
914
1035
|
], "p0.sizes")
|
|
@@ -1432,7 +1553,7 @@ const componentInfo$6 = {
|
|
|
1432
1553
|
]
|
|
1433
1554
|
};
|
|
1434
1555
|
const SectionComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
1435
|
-
return /* @__PURE__ */
|
|
1556
|
+
return /* @__PURE__ */ _jsxS("section", {
|
|
1436
1557
|
...props.attributes,
|
|
1437
1558
|
style: {
|
|
1438
1559
|
width: "100%",
|
|
@@ -1445,8 +1566,9 @@ const SectionComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl
|
|
|
1445
1566
|
alignItems: "stretch",
|
|
1446
1567
|
marginLeft: "auto",
|
|
1447
1568
|
marginRight: "auto"
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1569
|
+
},
|
|
1570
|
+
children: /* @__PURE__ */ _jsxC(Slot, null, 3, "2Y_0")
|
|
1571
|
+
}, null, 0, "2Y_1");
|
|
1450
1572
|
}, "SectionComponent_component_ZWF9iD5WeLg"));
|
|
1451
1573
|
const componentInfo$5 = {
|
|
1452
1574
|
name: "Symbol",
|
|
@@ -1487,6 +1609,11 @@ const componentInfo$5 = {
|
|
|
1487
1609
|
}
|
|
1488
1610
|
]
|
|
1489
1611
|
};
|
|
1612
|
+
const logger = {
|
|
1613
|
+
log: (...message) => console.log("[Builder.io]: ", ...message),
|
|
1614
|
+
error: (...message) => console.error("[Builder.io]: ", ...message),
|
|
1615
|
+
warn: (...message) => console.warn("[Builder.io]: ", ...message)
|
|
1616
|
+
};
|
|
1490
1617
|
function getGlobalThis() {
|
|
1491
1618
|
if (typeof globalThis !== "undefined")
|
|
1492
1619
|
return globalThis;
|
|
@@ -1739,30 +1866,35 @@ async function getContent(options) {
|
|
|
1739
1866
|
...options,
|
|
1740
1867
|
limit: 1
|
|
1741
1868
|
});
|
|
1742
|
-
if ("results" in allContent)
|
|
1869
|
+
if (allContent && "results" in allContent)
|
|
1743
1870
|
return allContent?.results[0] || null;
|
|
1744
1871
|
return null;
|
|
1745
1872
|
}
|
|
1746
1873
|
async function getAllContent(options) {
|
|
1747
|
-
const url = generateContentUrl(options);
|
|
1748
|
-
const res = await fetch$1(url.href);
|
|
1749
|
-
const content = await res.json();
|
|
1750
|
-
if ("status" in content && !("results" in content)) {
|
|
1751
|
-
console.error("[Builder.io]: Error fetching data. ", content, options);
|
|
1752
|
-
return content;
|
|
1753
|
-
}
|
|
1754
|
-
const canTrack = options.canTrack !== false;
|
|
1755
1874
|
try {
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1875
|
+
const url = generateContentUrl(options);
|
|
1876
|
+
const res = await fetch$1(url.href);
|
|
1877
|
+
const content = await res.json();
|
|
1878
|
+
if ("status" in content && !("results" in content)) {
|
|
1879
|
+
logger.error("Error fetching data. ", content, options);
|
|
1880
|
+
return content;
|
|
1881
|
+
}
|
|
1882
|
+
const canTrack = options.canTrack !== false;
|
|
1883
|
+
try {
|
|
1884
|
+
if (canTrack && Array.isArray(content.results))
|
|
1885
|
+
for (const item of content.results)
|
|
1886
|
+
await handleABTesting({
|
|
1887
|
+
item,
|
|
1888
|
+
canTrack
|
|
1889
|
+
});
|
|
1890
|
+
} catch (e) {
|
|
1891
|
+
logger.error("Could not setup A/B testing. ", e);
|
|
1892
|
+
}
|
|
1893
|
+
return content;
|
|
1894
|
+
} catch (error) {
|
|
1895
|
+
logger.error("Error fetching data. ", error);
|
|
1896
|
+
return null;
|
|
1764
1897
|
}
|
|
1765
|
-
return content;
|
|
1766
1898
|
}
|
|
1767
1899
|
const fetchContent = function fetchContent2(props, state, builderContext2) {
|
|
1768
1900
|
if (!state.contentToUse && props.symbol?.model && builderContext2?.apiKey)
|
|
@@ -1777,7 +1909,7 @@ const fetchContent = function fetchContent2(props, state, builderContext2) {
|
|
|
1777
1909
|
if (response)
|
|
1778
1910
|
state.contentToUse = response;
|
|
1779
1911
|
}).catch((err) => {
|
|
1780
|
-
|
|
1912
|
+
logger.error("Could not fetch symbol content: ", err);
|
|
1781
1913
|
});
|
|
1782
1914
|
};
|
|
1783
1915
|
const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
@@ -1810,68 +1942,69 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
1810
1942
|
props,
|
|
1811
1943
|
state
|
|
1812
1944
|
]));
|
|
1813
|
-
return /* @__PURE__ */
|
|
1814
|
-
...props.attributes
|
|
1945
|
+
return /* @__PURE__ */ _jsxS("div", {
|
|
1946
|
+
...props.attributes,
|
|
1947
|
+
children: /* @__PURE__ */ _jsxC(RenderContent, {
|
|
1948
|
+
get apiVersion() {
|
|
1949
|
+
return builderContext$1.apiVersion;
|
|
1950
|
+
},
|
|
1951
|
+
get apiKey() {
|
|
1952
|
+
return builderContext$1.apiKey;
|
|
1953
|
+
},
|
|
1954
|
+
get context() {
|
|
1955
|
+
return builderContext$1.context;
|
|
1956
|
+
},
|
|
1957
|
+
get customComponents() {
|
|
1958
|
+
return Object.values(builderContext$1.registeredComponents);
|
|
1959
|
+
},
|
|
1960
|
+
get data() {
|
|
1961
|
+
return {
|
|
1962
|
+
...props.symbol?.data,
|
|
1963
|
+
...builderContext$1.state,
|
|
1964
|
+
...state.contentToUse?.data?.state
|
|
1965
|
+
};
|
|
1966
|
+
},
|
|
1967
|
+
get model() {
|
|
1968
|
+
return props.symbol?.model;
|
|
1969
|
+
},
|
|
1970
|
+
get content() {
|
|
1971
|
+
return state.contentToUse;
|
|
1972
|
+
},
|
|
1973
|
+
[_IMMUTABLE]: {
|
|
1974
|
+
apiVersion: _fnSignal((p0) => p0.apiVersion, [
|
|
1975
|
+
builderContext$1
|
|
1976
|
+
], "p0.apiVersion"),
|
|
1977
|
+
apiKey: _fnSignal((p0) => p0.apiKey, [
|
|
1978
|
+
builderContext$1
|
|
1979
|
+
], "p0.apiKey"),
|
|
1980
|
+
context: _fnSignal((p0) => p0.context, [
|
|
1981
|
+
builderContext$1
|
|
1982
|
+
], "p0.context"),
|
|
1983
|
+
customComponents: _fnSignal((p0) => Object.values(p0.registeredComponents), [
|
|
1984
|
+
builderContext$1
|
|
1985
|
+
], "Object.values(p0.registeredComponents)"),
|
|
1986
|
+
data: _fnSignal((p0, p1, p2) => ({
|
|
1987
|
+
...p1.symbol?.data,
|
|
1988
|
+
...p0.state,
|
|
1989
|
+
...p2.contentToUse?.data?.state
|
|
1990
|
+
}), [
|
|
1991
|
+
builderContext$1,
|
|
1992
|
+
props,
|
|
1993
|
+
state
|
|
1994
|
+
], "{...p1.symbol?.data,...p0.state,...p2.contentToUse?.data?.state}"),
|
|
1995
|
+
model: _fnSignal((p0) => p0.symbol?.model, [
|
|
1996
|
+
props
|
|
1997
|
+
], "p0.symbol?.model"),
|
|
1998
|
+
content: _fnSignal((p0) => p0.contentToUse, [
|
|
1999
|
+
state
|
|
2000
|
+
], "p0.contentToUse")
|
|
2001
|
+
}
|
|
2002
|
+
}, 3, "Wt_0")
|
|
1815
2003
|
}, {
|
|
1816
2004
|
class: _fnSignal((p0) => p0.className, [
|
|
1817
2005
|
state
|
|
1818
2006
|
], "p0.className")
|
|
1819
|
-
},
|
|
1820
|
-
get apiVersion() {
|
|
1821
|
-
return builderContext$1.apiVersion;
|
|
1822
|
-
},
|
|
1823
|
-
get apiKey() {
|
|
1824
|
-
return builderContext$1.apiKey;
|
|
1825
|
-
},
|
|
1826
|
-
get context() {
|
|
1827
|
-
return builderContext$1.context;
|
|
1828
|
-
},
|
|
1829
|
-
get customComponents() {
|
|
1830
|
-
return Object.values(builderContext$1.registeredComponents);
|
|
1831
|
-
},
|
|
1832
|
-
get data() {
|
|
1833
|
-
return {
|
|
1834
|
-
...props.symbol?.data,
|
|
1835
|
-
...builderContext$1.state,
|
|
1836
|
-
...state.contentToUse?.data?.state
|
|
1837
|
-
};
|
|
1838
|
-
},
|
|
1839
|
-
get model() {
|
|
1840
|
-
return props.symbol?.model;
|
|
1841
|
-
},
|
|
1842
|
-
get content() {
|
|
1843
|
-
return state.contentToUse;
|
|
1844
|
-
},
|
|
1845
|
-
[_IMMUTABLE]: {
|
|
1846
|
-
apiVersion: _fnSignal((p0) => p0.apiVersion, [
|
|
1847
|
-
builderContext$1
|
|
1848
|
-
], "p0.apiVersion"),
|
|
1849
|
-
apiKey: _fnSignal((p0) => p0.apiKey, [
|
|
1850
|
-
builderContext$1
|
|
1851
|
-
], "p0.apiKey"),
|
|
1852
|
-
context: _fnSignal((p0) => p0.context, [
|
|
1853
|
-
builderContext$1
|
|
1854
|
-
], "p0.context"),
|
|
1855
|
-
customComponents: _fnSignal((p0) => Object.values(p0.registeredComponents), [
|
|
1856
|
-
builderContext$1
|
|
1857
|
-
], "Object.values(p0.registeredComponents)"),
|
|
1858
|
-
data: _fnSignal((p0, p1, p2) => ({
|
|
1859
|
-
...p1.symbol?.data,
|
|
1860
|
-
...p0.state,
|
|
1861
|
-
...p2.contentToUse?.data?.state
|
|
1862
|
-
}), [
|
|
1863
|
-
builderContext$1,
|
|
1864
|
-
props,
|
|
1865
|
-
state
|
|
1866
|
-
], "{...p1.symbol?.data,...p0.state,...p2.contentToUse?.data?.state}"),
|
|
1867
|
-
model: _fnSignal((p0) => p0.symbol?.model, [
|
|
1868
|
-
props
|
|
1869
|
-
], "p0.symbol?.model"),
|
|
1870
|
-
content: _fnSignal((p0) => p0.contentToUse, [
|
|
1871
|
-
state
|
|
1872
|
-
], "p0.contentToUse")
|
|
1873
|
-
}
|
|
1874
|
-
}, 3, "Wt_0"), 0, "Wt_1");
|
|
2007
|
+
}, 0, "Wt_1");
|
|
1875
2008
|
}, "Symbol_component_WVvggdkUPdk"));
|
|
1876
2009
|
const componentInfo$4 = {
|
|
1877
2010
|
name: "Text",
|
|
@@ -2017,34 +2150,41 @@ const componentInfo$3 = {
|
|
|
2017
2150
|
}
|
|
2018
2151
|
]
|
|
2019
2152
|
};
|
|
2020
|
-
const videoProps = function videoProps2(props, state) {
|
|
2021
|
-
return {
|
|
2022
|
-
...props.autoPlay === true ? {
|
|
2023
|
-
autoPlay: true
|
|
2024
|
-
} : {},
|
|
2025
|
-
...props.muted === true ? {
|
|
2026
|
-
muted: true
|
|
2027
|
-
} : {},
|
|
2028
|
-
...props.controls === true ? {
|
|
2029
|
-
controls: true
|
|
2030
|
-
} : {},
|
|
2031
|
-
...props.loop === true ? {
|
|
2032
|
-
loop: true
|
|
2033
|
-
} : {},
|
|
2034
|
-
...props.playsInline === true ? {
|
|
2035
|
-
playsInline: true
|
|
2036
|
-
} : {}
|
|
2037
|
-
};
|
|
2038
|
-
};
|
|
2039
|
-
const spreadProps = function spreadProps2(props, state) {
|
|
2040
|
-
return {
|
|
2041
|
-
...props.attributes,
|
|
2042
|
-
...videoProps(props)
|
|
2043
|
-
};
|
|
2044
|
-
};
|
|
2045
2153
|
const Video = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
2046
|
-
|
|
2047
|
-
|
|
2154
|
+
const videoProps = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
2155
|
+
const [props2] = useLexicalScope();
|
|
2156
|
+
return {
|
|
2157
|
+
...props2.autoPlay === true ? {
|
|
2158
|
+
autoPlay: true
|
|
2159
|
+
} : {},
|
|
2160
|
+
...props2.muted === true ? {
|
|
2161
|
+
muted: true
|
|
2162
|
+
} : {},
|
|
2163
|
+
...props2.controls === true ? {
|
|
2164
|
+
controls: true
|
|
2165
|
+
} : {},
|
|
2166
|
+
...props2.loop === true ? {
|
|
2167
|
+
loop: true
|
|
2168
|
+
} : {},
|
|
2169
|
+
...props2.playsInline === true ? {
|
|
2170
|
+
playsInline: true
|
|
2171
|
+
} : {}
|
|
2172
|
+
};
|
|
2173
|
+
}, "Video_component_videoProps_useComputed_60AadUGY06E", [
|
|
2174
|
+
props
|
|
2175
|
+
]));
|
|
2176
|
+
const spreadProps = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
2177
|
+
const [props2, videoProps2] = useLexicalScope();
|
|
2178
|
+
return {
|
|
2179
|
+
...props2.attributes,
|
|
2180
|
+
...videoProps2.value
|
|
2181
|
+
};
|
|
2182
|
+
}, "Video_component_spreadProps_useComputed_ZdLsx18NYH4", [
|
|
2183
|
+
props,
|
|
2184
|
+
videoProps
|
|
2185
|
+
]));
|
|
2186
|
+
return /* @__PURE__ */ _jsxS("video", {
|
|
2187
|
+
...spreadProps.value
|
|
2048
2188
|
}, {
|
|
2049
2189
|
style: _fnSignal((p0) => ({
|
|
2050
2190
|
width: "100%",
|
|
@@ -2062,7 +2202,7 @@ const Video = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
2062
2202
|
poster: _fnSignal((p0) => p0.posterImage, [
|
|
2063
2203
|
props
|
|
2064
2204
|
], "p0.posterImage")
|
|
2065
|
-
},
|
|
2205
|
+
}, 0, "j7_0");
|
|
2066
2206
|
}, "Video_component_qdcTZflYyoQ"));
|
|
2067
2207
|
const componentInfo$2 = {
|
|
2068
2208
|
name: "Embed",
|
|
@@ -2157,7 +2297,7 @@ const Embed = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
2157
2297
|
}, null, 3, "9r_0");
|
|
2158
2298
|
}, "Embed_component_Uji08ORjXbE"));
|
|
2159
2299
|
const ImgComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
2160
|
-
return /* @__PURE__ */
|
|
2300
|
+
return /* @__PURE__ */ _jsxS("img", {
|
|
2161
2301
|
...props.attributes
|
|
2162
2302
|
}, {
|
|
2163
2303
|
style: _fnSignal((p0) => ({
|
|
@@ -2172,7 +2312,7 @@ const ImgComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
2172
2312
|
src: _fnSignal((p0) => p0.imgSrc || p0.image, [
|
|
2173
2313
|
props
|
|
2174
2314
|
], "p0.imgSrc||p0.image")
|
|
2175
|
-
},
|
|
2315
|
+
}, 0, isEditing() && props.imgSrc || "default-key");
|
|
2176
2316
|
}, "ImgComponent_component_FXvIDBSffO8"));
|
|
2177
2317
|
const componentInfo$1 = {
|
|
2178
2318
|
name: "Raw:Img",
|
|
@@ -2333,13 +2473,13 @@ function isPreviewing() {
|
|
|
2333
2473
|
return Boolean(location.search.indexOf("builder.preview=") !== -1);
|
|
2334
2474
|
}
|
|
2335
2475
|
const components = [];
|
|
2336
|
-
function registerComponent(
|
|
2476
|
+
function registerComponent(component, info) {
|
|
2337
2477
|
components.push({
|
|
2338
|
-
component
|
|
2478
|
+
component,
|
|
2339
2479
|
...info
|
|
2340
2480
|
});
|
|
2341
2481
|
console.warn("registerComponent is deprecated. Use the `customComponents` prop in RenderContent instead to provide your custom components to the builder SDK.");
|
|
2342
|
-
return
|
|
2482
|
+
return component;
|
|
2343
2483
|
}
|
|
2344
2484
|
const createRegisterComponentMessage = ({ component: _, ...info }) => ({
|
|
2345
2485
|
type: "builder.registerComponent",
|
|
@@ -2505,7 +2645,7 @@ const createEvent = async ({ type: eventType, canTrack, apiKey, metadata, ...pro
|
|
|
2505
2645
|
});
|
|
2506
2646
|
async function _track(eventProps) {
|
|
2507
2647
|
if (!eventProps.apiKey) {
|
|
2508
|
-
|
|
2648
|
+
logger.error("Missing API key for track call. Please provide your API key.");
|
|
2509
2649
|
return;
|
|
2510
2650
|
}
|
|
2511
2651
|
if (!eventProps.canTrack)
|
|
@@ -2962,6 +3102,8 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
2962
3102
|
content: props.content,
|
|
2963
3103
|
data: props.data
|
|
2964
3104
|
})
|
|
3105
|
+
}, {
|
|
3106
|
+
deep: true
|
|
2965
3107
|
});
|
|
2966
3108
|
useContextProvider(builderContext, useStore({
|
|
2967
3109
|
content: state.useContent,
|
|
@@ -2974,7 +3116,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
2974
3116
|
useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
2975
3117
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
2976
3118
|
if (!props2.apiKey)
|
|
2977
|
-
|
|
3119
|
+
logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
|
|
2978
3120
|
if (isBrowser()) {
|
|
2979
3121
|
if (isEditing()) {
|
|
2980
3122
|
state2.forceReRenderCount = state2.forceReRenderCount + 1;
|
|
@@ -3007,9 +3149,10 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3007
3149
|
}
|
|
3008
3150
|
if (isPreviewing()) {
|
|
3009
3151
|
const searchParams = new URL(location.href).searchParams;
|
|
3010
|
-
const
|
|
3152
|
+
const searchParamPreviewModel = searchParams.get("builder.preview");
|
|
3153
|
+
const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
|
|
3011
3154
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
3012
|
-
if (
|
|
3155
|
+
if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
|
|
3013
3156
|
getContent({
|
|
3014
3157
|
model: props2.model,
|
|
3015
3158
|
apiKey: props2.apiKey,
|