@builder.io/sdk-solid 0.13.1 → 0.13.3
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/dist/index.d.ts +12 -10
- package/lib/browser/dev.js +1140 -371
- package/lib/browser/dev.jsx +964 -296
- package/lib/browser/index.js +1138 -369
- package/lib/browser/index.jsx +964 -296
- package/lib/edge/dev.js +1142 -373
- package/lib/edge/dev.jsx +964 -296
- package/lib/edge/index.js +1140 -371
- package/lib/edge/index.jsx +964 -296
- package/lib/node/dev.js +1140 -371
- package/lib/node/dev.jsx +964 -296
- package/lib/node/index.js +1138 -369
- package/lib/node/index.jsx +964 -296
- package/package.json +1 -1
package/lib/edge/index.js
CHANGED
|
@@ -3959,7 +3959,7 @@ function BlockStyles(props) {
|
|
|
3959
3959
|
}
|
|
3960
3960
|
return true;
|
|
3961
3961
|
}
|
|
3962
|
-
function
|
|
3962
|
+
function css5() {
|
|
3963
3963
|
const processedBlock = getProcessedBlock({
|
|
3964
3964
|
block: props.block,
|
|
3965
3965
|
localState: props.context.localState,
|
|
@@ -3996,12 +3996,12 @@ function BlockStyles(props) {
|
|
|
3996
3996
|
}
|
|
3997
3997
|
return createComponent(Show, {
|
|
3998
3998
|
get when() {
|
|
3999
|
-
return memo(() => !!(TARGET !== "reactNative" &&
|
|
3999
|
+
return memo(() => !!(TARGET !== "reactNative" && css5()))() && canShowBlock();
|
|
4000
4000
|
},
|
|
4001
4001
|
get children() {
|
|
4002
4002
|
return createComponent(inlined_styles_default, {
|
|
4003
4003
|
get styles() {
|
|
4004
|
-
return
|
|
4004
|
+
return css5();
|
|
4005
4005
|
}
|
|
4006
4006
|
});
|
|
4007
4007
|
}
|
|
@@ -4336,10 +4336,10 @@ function Block(props) {
|
|
|
4336
4336
|
componentOptions: {
|
|
4337
4337
|
...getBlockComponentOptions(processedBlock()),
|
|
4338
4338
|
builderContext: props.context,
|
|
4339
|
-
...blockComponent()?.name === "Core:Button" || blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" ? {
|
|
4339
|
+
...blockComponent()?.name === "Core:Button" || blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" || blockComponent()?.name === "Form:Form" ? {
|
|
4340
4340
|
builderLinkComponent: props.linkComponent
|
|
4341
4341
|
} : {},
|
|
4342
|
-
...blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" ? {
|
|
4342
|
+
...blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" || blockComponent()?.name === "Form:Form" ? {
|
|
4343
4343
|
builderComponents: props.registeredComponents
|
|
4344
4344
|
} : {}
|
|
4345
4345
|
},
|
|
@@ -5465,170 +5465,8 @@ var componentInfo2 = {
|
|
|
5465
5465
|
}]
|
|
5466
5466
|
};
|
|
5467
5467
|
|
|
5468
|
-
// src/blocks/custom-code/component-info.ts
|
|
5469
|
-
var componentInfo3 = {
|
|
5470
|
-
name: "Custom Code",
|
|
5471
|
-
static: true,
|
|
5472
|
-
requiredPermissions: ["editCode"],
|
|
5473
|
-
inputs: [{
|
|
5474
|
-
name: "code",
|
|
5475
|
-
type: "html",
|
|
5476
|
-
required: true,
|
|
5477
|
-
defaultValue: "<p>Hello there, I am custom HTML code!</p>",
|
|
5478
|
-
code: true
|
|
5479
|
-
}, {
|
|
5480
|
-
name: "replaceNodes",
|
|
5481
|
-
type: "boolean",
|
|
5482
|
-
helperText: "Preserve server rendered dom nodes",
|
|
5483
|
-
advanced: true
|
|
5484
|
-
}, {
|
|
5485
|
-
name: "scriptsClientOnly",
|
|
5486
|
-
type: "boolean",
|
|
5487
|
-
defaultValue: false,
|
|
5488
|
-
helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
|
|
5489
|
-
advanced: true
|
|
5490
|
-
}]
|
|
5491
|
-
};
|
|
5492
|
-
var _tmpl$6 = /* @__PURE__ */ template(`<div>`);
|
|
5493
|
-
function CustomCode(props) {
|
|
5494
|
-
const [scriptsInserted, setScriptsInserted] = createSignal([]);
|
|
5495
|
-
const [scriptsRun, setScriptsRun] = createSignal([]);
|
|
5496
|
-
let elementRef;
|
|
5497
|
-
onMount(() => {
|
|
5498
|
-
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
5499
|
-
return;
|
|
5500
|
-
}
|
|
5501
|
-
const scripts = elementRef.getElementsByTagName("script");
|
|
5502
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
5503
|
-
const script = scripts[i];
|
|
5504
|
-
if (script.src) {
|
|
5505
|
-
if (scriptsInserted().includes(script.src)) {
|
|
5506
|
-
continue;
|
|
5507
|
-
}
|
|
5508
|
-
scriptsInserted().push(script.src);
|
|
5509
|
-
const newScript = document.createElement("script");
|
|
5510
|
-
newScript.async = true;
|
|
5511
|
-
newScript.src = script.src;
|
|
5512
|
-
document.head.appendChild(newScript);
|
|
5513
|
-
} else if (!script.type || ["text/javascript", "application/javascript", "application/ecmascript"].includes(script.type)) {
|
|
5514
|
-
if (scriptsRun().includes(script.innerText)) {
|
|
5515
|
-
continue;
|
|
5516
|
-
}
|
|
5517
|
-
try {
|
|
5518
|
-
scriptsRun().push(script.innerText);
|
|
5519
|
-
new Function(script.innerText)();
|
|
5520
|
-
} catch (error) {
|
|
5521
|
-
}
|
|
5522
|
-
}
|
|
5523
|
-
}
|
|
5524
|
-
});
|
|
5525
|
-
return (() => {
|
|
5526
|
-
const _el$ = _tmpl$6();
|
|
5527
|
-
const _ref$ = elementRef;
|
|
5528
|
-
typeof _ref$ === "function" ? use(_ref$, _el$) : elementRef = _el$;
|
|
5529
|
-
effect((_p$) => {
|
|
5530
|
-
const _v$ = "builder-custom-code" + (props.replaceNodes ? " replace-nodes" : ""), _v$2 = props.code;
|
|
5531
|
-
_v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
|
|
5532
|
-
_v$2 !== _p$._v$2 && (_el$.innerHTML = _p$._v$2 = _v$2);
|
|
5533
|
-
return _p$;
|
|
5534
|
-
}, {
|
|
5535
|
-
_v$: void 0,
|
|
5536
|
-
_v$2: void 0
|
|
5537
|
-
});
|
|
5538
|
-
return _el$;
|
|
5539
|
-
})();
|
|
5540
|
-
}
|
|
5541
|
-
var custom_code_default = CustomCode;
|
|
5542
|
-
|
|
5543
|
-
// src/blocks/embed/component-info.ts
|
|
5544
|
-
var componentInfo4 = {
|
|
5545
|
-
name: "Embed",
|
|
5546
|
-
static: true,
|
|
5547
|
-
inputs: [{
|
|
5548
|
-
name: "url",
|
|
5549
|
-
type: "url",
|
|
5550
|
-
required: true,
|
|
5551
|
-
defaultValue: "",
|
|
5552
|
-
helperText: "e.g. enter a youtube url, google map, etc",
|
|
5553
|
-
onChange: (options) => {
|
|
5554
|
-
const url = options.get("url");
|
|
5555
|
-
if (url) {
|
|
5556
|
-
options.set("content", "Loading...");
|
|
5557
|
-
const apiKey = "ae0e60e78201a3f2b0de4b";
|
|
5558
|
-
return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
|
|
5559
|
-
if (options.get("url") === url) {
|
|
5560
|
-
if (data.html) {
|
|
5561
|
-
options.set("content", data.html);
|
|
5562
|
-
} else {
|
|
5563
|
-
options.set("content", "Invalid url, please try another");
|
|
5564
|
-
}
|
|
5565
|
-
}
|
|
5566
|
-
}).catch((_err) => {
|
|
5567
|
-
options.set("content", "There was an error embedding this URL, please try again or another URL");
|
|
5568
|
-
});
|
|
5569
|
-
} else {
|
|
5570
|
-
options.delete("content");
|
|
5571
|
-
}
|
|
5572
|
-
}
|
|
5573
|
-
}, {
|
|
5574
|
-
name: "content",
|
|
5575
|
-
type: "html",
|
|
5576
|
-
defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
|
|
5577
|
-
hideFromUI: true
|
|
5578
|
-
}]
|
|
5579
|
-
};
|
|
5580
|
-
|
|
5581
|
-
// src/blocks/embed/helpers.ts
|
|
5582
|
-
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
5583
|
-
var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
5584
|
-
|
|
5585
|
-
// src/blocks/embed/embed.tsx
|
|
5586
|
-
var _tmpl$7 = /* @__PURE__ */ template(`<div class=builder-embed>`);
|
|
5587
|
-
function Embed(props) {
|
|
5588
|
-
const [scriptsInserted, setScriptsInserted] = createSignal([]);
|
|
5589
|
-
const [scriptsRun, setScriptsRun] = createSignal([]);
|
|
5590
|
-
const [ranInitFn, setRanInitFn] = createSignal(false);
|
|
5591
|
-
function findAndRunScripts() {
|
|
5592
|
-
if (!elem || !elem.getElementsByTagName)
|
|
5593
|
-
return;
|
|
5594
|
-
const scripts = elem.getElementsByTagName("script");
|
|
5595
|
-
for (let i = 0; i < scripts.length; i++) {
|
|
5596
|
-
const script = scripts[i];
|
|
5597
|
-
if (script.src && !scriptsInserted().includes(script.src)) {
|
|
5598
|
-
scriptsInserted().push(script.src);
|
|
5599
|
-
const newScript = document.createElement("script");
|
|
5600
|
-
newScript.async = true;
|
|
5601
|
-
newScript.src = script.src;
|
|
5602
|
-
document.head.appendChild(newScript);
|
|
5603
|
-
} else if (isJsScript(script) && !scriptsRun().includes(script.innerText)) {
|
|
5604
|
-
try {
|
|
5605
|
-
scriptsRun().push(script.innerText);
|
|
5606
|
-
new Function(script.innerText)();
|
|
5607
|
-
} catch (error) {
|
|
5608
|
-
}
|
|
5609
|
-
}
|
|
5610
|
-
}
|
|
5611
|
-
}
|
|
5612
|
-
let elem;
|
|
5613
|
-
function onUpdateFn_0() {
|
|
5614
|
-
if (elem && !ranInitFn()) {
|
|
5615
|
-
setRanInitFn(true);
|
|
5616
|
-
findAndRunScripts();
|
|
5617
|
-
}
|
|
5618
|
-
}
|
|
5619
|
-
createEffect(on(() => [elem, ranInitFn()], onUpdateFn_0));
|
|
5620
|
-
return (() => {
|
|
5621
|
-
const _el$ = _tmpl$7();
|
|
5622
|
-
const _ref$ = elem;
|
|
5623
|
-
typeof _ref$ === "function" ? use(_ref$, _el$) : elem = _el$;
|
|
5624
|
-
effect(() => _el$.innerHTML = props.content);
|
|
5625
|
-
return _el$;
|
|
5626
|
-
})();
|
|
5627
|
-
}
|
|
5628
|
-
var embed_default = Embed;
|
|
5629
|
-
|
|
5630
5468
|
// src/blocks/fragment/component-info.ts
|
|
5631
|
-
var
|
|
5469
|
+
var componentInfo3 = {
|
|
5632
5470
|
name: "Fragment",
|
|
5633
5471
|
static: true,
|
|
5634
5472
|
hidden: true,
|
|
@@ -5637,7 +5475,7 @@ var componentInfo5 = {
|
|
|
5637
5475
|
};
|
|
5638
5476
|
|
|
5639
5477
|
// src/blocks/image/component-info.ts
|
|
5640
|
-
var
|
|
5478
|
+
var componentInfo4 = {
|
|
5641
5479
|
name: "Image",
|
|
5642
5480
|
static: true,
|
|
5643
5481
|
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
|
|
@@ -5736,30 +5574,1097 @@ var componentInfo6 = {
|
|
|
5736
5574
|
type: "string",
|
|
5737
5575
|
hideFromUI: true
|
|
5738
5576
|
}, {
|
|
5739
|
-
name: "srcset",
|
|
5577
|
+
name: "srcset",
|
|
5578
|
+
type: "string",
|
|
5579
|
+
hideFromUI: true
|
|
5580
|
+
}, {
|
|
5581
|
+
name: "lazy",
|
|
5582
|
+
type: "boolean",
|
|
5583
|
+
defaultValue: true,
|
|
5584
|
+
hideFromUI: true
|
|
5585
|
+
}, {
|
|
5586
|
+
name: "fitContent",
|
|
5587
|
+
type: "boolean",
|
|
5588
|
+
helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
|
|
5589
|
+
defaultValue: true
|
|
5590
|
+
}, {
|
|
5591
|
+
name: "aspectRatio",
|
|
5592
|
+
type: "number",
|
|
5593
|
+
helperText: "This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",
|
|
5594
|
+
advanced: true,
|
|
5595
|
+
defaultValue: 0.7041
|
|
5596
|
+
}]
|
|
5597
|
+
};
|
|
5598
|
+
|
|
5599
|
+
// src/blocks/section/component-info.ts
|
|
5600
|
+
var componentInfo5 = {
|
|
5601
|
+
name: "Core:Section",
|
|
5602
|
+
static: true,
|
|
5603
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
5604
|
+
inputs: [{
|
|
5605
|
+
name: "maxWidth",
|
|
5606
|
+
type: "number",
|
|
5607
|
+
defaultValue: 1200
|
|
5608
|
+
}, {
|
|
5609
|
+
name: "lazyLoad",
|
|
5610
|
+
type: "boolean",
|
|
5611
|
+
defaultValue: false,
|
|
5612
|
+
advanced: true,
|
|
5613
|
+
description: "Only render this section when in view"
|
|
5614
|
+
}],
|
|
5615
|
+
defaultStyles: {
|
|
5616
|
+
paddingLeft: "20px",
|
|
5617
|
+
paddingRight: "20px",
|
|
5618
|
+
paddingTop: "50px",
|
|
5619
|
+
paddingBottom: "50px",
|
|
5620
|
+
marginTop: "0px",
|
|
5621
|
+
width: "100vw",
|
|
5622
|
+
marginLeft: "calc(50% - 50vw)"
|
|
5623
|
+
},
|
|
5624
|
+
canHaveChildren: true,
|
|
5625
|
+
defaultChildren: [{
|
|
5626
|
+
"@type": "@builder.io/sdk:Element",
|
|
5627
|
+
responsiveStyles: {
|
|
5628
|
+
large: {
|
|
5629
|
+
textAlign: "center"
|
|
5630
|
+
}
|
|
5631
|
+
},
|
|
5632
|
+
component: {
|
|
5633
|
+
name: "Text",
|
|
5634
|
+
options: {
|
|
5635
|
+
text: "<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>"
|
|
5636
|
+
}
|
|
5637
|
+
}
|
|
5638
|
+
}]
|
|
5639
|
+
};
|
|
5640
|
+
|
|
5641
|
+
// src/blocks/slot/component-info.ts
|
|
5642
|
+
var componentInfo6 = {
|
|
5643
|
+
name: "Slot",
|
|
5644
|
+
isRSC: true,
|
|
5645
|
+
description: "Allow child blocks to be inserted into this content when used as a Symbol",
|
|
5646
|
+
docsLink: "https://www.builder.io/c/docs/symbols-with-blocks",
|
|
5647
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",
|
|
5648
|
+
// Maybe wrap this for canHaveChildren so bind children to this hm
|
|
5649
|
+
inputs: [{
|
|
5650
|
+
name: "name",
|
|
5651
|
+
type: "string",
|
|
5652
|
+
required: true,
|
|
5653
|
+
defaultValue: "children"
|
|
5654
|
+
}]
|
|
5655
|
+
};
|
|
5656
|
+
var _tmpl$6 = /* @__PURE__ */ template(`<div>`);
|
|
5657
|
+
function Slot(props) {
|
|
5658
|
+
return (() => {
|
|
5659
|
+
const _el$ = _tmpl$6();
|
|
5660
|
+
_el$.style.setProperty("pointer-events", "auto");
|
|
5661
|
+
spread(_el$, mergeProps(() => !props.builderContext.context?.symbolId && {
|
|
5662
|
+
"builder-slot": props.name
|
|
5663
|
+
}), false, true);
|
|
5664
|
+
insert(_el$, createComponent(blocks_default, {
|
|
5665
|
+
get parent() {
|
|
5666
|
+
return props.builderContext.context?.symbolId;
|
|
5667
|
+
},
|
|
5668
|
+
get path() {
|
|
5669
|
+
return `symbol.data.${props.name}`;
|
|
5670
|
+
},
|
|
5671
|
+
get context() {
|
|
5672
|
+
return props.builderContext;
|
|
5673
|
+
},
|
|
5674
|
+
get blocks() {
|
|
5675
|
+
return props.builderContext.rootState?.[props.name];
|
|
5676
|
+
}
|
|
5677
|
+
}));
|
|
5678
|
+
return _el$;
|
|
5679
|
+
})();
|
|
5680
|
+
}
|
|
5681
|
+
var slot_default = Slot;
|
|
5682
|
+
|
|
5683
|
+
// src/blocks/symbol/component-info.ts
|
|
5684
|
+
var componentInfo7 = {
|
|
5685
|
+
name: "Symbol",
|
|
5686
|
+
noWrap: true,
|
|
5687
|
+
static: true,
|
|
5688
|
+
isRSC: true,
|
|
5689
|
+
inputs: [{
|
|
5690
|
+
name: "symbol",
|
|
5691
|
+
type: "uiSymbol"
|
|
5692
|
+
}, {
|
|
5693
|
+
name: "dataOnly",
|
|
5694
|
+
helperText: "Make this a data symbol that doesn't display any UI",
|
|
5695
|
+
type: "boolean",
|
|
5696
|
+
defaultValue: false,
|
|
5697
|
+
advanced: true,
|
|
5698
|
+
hideFromUI: true
|
|
5699
|
+
}, {
|
|
5700
|
+
name: "inheritState",
|
|
5701
|
+
helperText: "Inherit the parent component state and data",
|
|
5702
|
+
type: "boolean",
|
|
5703
|
+
defaultValue: false,
|
|
5704
|
+
advanced: true
|
|
5705
|
+
}, {
|
|
5706
|
+
name: "renderToLiquid",
|
|
5707
|
+
helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
|
|
5708
|
+
type: "boolean",
|
|
5709
|
+
defaultValue: false,
|
|
5710
|
+
advanced: true,
|
|
5711
|
+
hideFromUI: true
|
|
5712
|
+
}, {
|
|
5713
|
+
name: "useChildren",
|
|
5714
|
+
hideFromUI: true,
|
|
5715
|
+
type: "boolean"
|
|
5716
|
+
}]
|
|
5717
|
+
};
|
|
5718
|
+
|
|
5719
|
+
// src/blocks/text/component-info.ts
|
|
5720
|
+
var componentInfo8 = {
|
|
5721
|
+
name: "Text",
|
|
5722
|
+
static: true,
|
|
5723
|
+
isRSC: true,
|
|
5724
|
+
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",
|
|
5725
|
+
inputs: [{
|
|
5726
|
+
name: "text",
|
|
5727
|
+
type: "html",
|
|
5728
|
+
required: true,
|
|
5729
|
+
autoFocus: true,
|
|
5730
|
+
bubble: true,
|
|
5731
|
+
defaultValue: "Enter some text..."
|
|
5732
|
+
}],
|
|
5733
|
+
defaultStyles: {
|
|
5734
|
+
lineHeight: "normal",
|
|
5735
|
+
height: "auto",
|
|
5736
|
+
textAlign: "center"
|
|
5737
|
+
}
|
|
5738
|
+
};
|
|
5739
|
+
var _tmpl$7 = /* @__PURE__ */ template(`<div class=builder-text>`);
|
|
5740
|
+
function Text(props) {
|
|
5741
|
+
return (() => {
|
|
5742
|
+
const _el$ = _tmpl$7();
|
|
5743
|
+
_el$.style.setProperty("outline", "none");
|
|
5744
|
+
effect(() => _el$.innerHTML = props.text?.toString() || "");
|
|
5745
|
+
return _el$;
|
|
5746
|
+
})();
|
|
5747
|
+
}
|
|
5748
|
+
var text_default = Text;
|
|
5749
|
+
|
|
5750
|
+
// src/blocks/custom-code/component-info.ts
|
|
5751
|
+
var componentInfo9 = {
|
|
5752
|
+
name: "Custom Code",
|
|
5753
|
+
static: true,
|
|
5754
|
+
requiredPermissions: ["editCode"],
|
|
5755
|
+
inputs: [{
|
|
5756
|
+
name: "code",
|
|
5757
|
+
type: "html",
|
|
5758
|
+
required: true,
|
|
5759
|
+
defaultValue: "<p>Hello there, I am custom HTML code!</p>",
|
|
5760
|
+
code: true
|
|
5761
|
+
}, {
|
|
5762
|
+
name: "replaceNodes",
|
|
5763
|
+
type: "boolean",
|
|
5764
|
+
helperText: "Preserve server rendered dom nodes",
|
|
5765
|
+
advanced: true
|
|
5766
|
+
}, {
|
|
5767
|
+
name: "scriptsClientOnly",
|
|
5768
|
+
type: "boolean",
|
|
5769
|
+
defaultValue: false,
|
|
5770
|
+
helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
|
|
5771
|
+
advanced: true
|
|
5772
|
+
}]
|
|
5773
|
+
};
|
|
5774
|
+
var _tmpl$8 = /* @__PURE__ */ template(`<div>`);
|
|
5775
|
+
function CustomCode(props) {
|
|
5776
|
+
const [scriptsInserted, setScriptsInserted] = createSignal([]);
|
|
5777
|
+
const [scriptsRun, setScriptsRun] = createSignal([]);
|
|
5778
|
+
let elementRef;
|
|
5779
|
+
onMount(() => {
|
|
5780
|
+
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
5781
|
+
return;
|
|
5782
|
+
}
|
|
5783
|
+
const scripts = elementRef.getElementsByTagName("script");
|
|
5784
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
5785
|
+
const script = scripts[i];
|
|
5786
|
+
if (script.src) {
|
|
5787
|
+
if (scriptsInserted().includes(script.src)) {
|
|
5788
|
+
continue;
|
|
5789
|
+
}
|
|
5790
|
+
scriptsInserted().push(script.src);
|
|
5791
|
+
const newScript = document.createElement("script");
|
|
5792
|
+
newScript.async = true;
|
|
5793
|
+
newScript.src = script.src;
|
|
5794
|
+
document.head.appendChild(newScript);
|
|
5795
|
+
} else if (!script.type || ["text/javascript", "application/javascript", "application/ecmascript"].includes(script.type)) {
|
|
5796
|
+
if (scriptsRun().includes(script.innerText)) {
|
|
5797
|
+
continue;
|
|
5798
|
+
}
|
|
5799
|
+
try {
|
|
5800
|
+
scriptsRun().push(script.innerText);
|
|
5801
|
+
new Function(script.innerText)();
|
|
5802
|
+
} catch (error) {
|
|
5803
|
+
}
|
|
5804
|
+
}
|
|
5805
|
+
}
|
|
5806
|
+
});
|
|
5807
|
+
return (() => {
|
|
5808
|
+
const _el$ = _tmpl$8();
|
|
5809
|
+
const _ref$ = elementRef;
|
|
5810
|
+
typeof _ref$ === "function" ? use(_ref$, _el$) : elementRef = _el$;
|
|
5811
|
+
effect((_p$) => {
|
|
5812
|
+
const _v$ = "builder-custom-code" + (props.replaceNodes ? " replace-nodes" : ""), _v$2 = props.code;
|
|
5813
|
+
_v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
|
|
5814
|
+
_v$2 !== _p$._v$2 && (_el$.innerHTML = _p$._v$2 = _v$2);
|
|
5815
|
+
return _p$;
|
|
5816
|
+
}, {
|
|
5817
|
+
_v$: void 0,
|
|
5818
|
+
_v$2: void 0
|
|
5819
|
+
});
|
|
5820
|
+
return _el$;
|
|
5821
|
+
})();
|
|
5822
|
+
}
|
|
5823
|
+
var custom_code_default = CustomCode;
|
|
5824
|
+
|
|
5825
|
+
// src/blocks/embed/component-info.ts
|
|
5826
|
+
var componentInfo10 = {
|
|
5827
|
+
name: "Embed",
|
|
5828
|
+
static: true,
|
|
5829
|
+
inputs: [{
|
|
5830
|
+
name: "url",
|
|
5831
|
+
type: "url",
|
|
5832
|
+
required: true,
|
|
5833
|
+
defaultValue: "",
|
|
5834
|
+
helperText: "e.g. enter a youtube url, google map, etc",
|
|
5835
|
+
onChange: (options) => {
|
|
5836
|
+
const url = options.get("url");
|
|
5837
|
+
if (url) {
|
|
5838
|
+
options.set("content", "Loading...");
|
|
5839
|
+
const apiKey = "ae0e60e78201a3f2b0de4b";
|
|
5840
|
+
return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
|
|
5841
|
+
if (options.get("url") === url) {
|
|
5842
|
+
if (data.html) {
|
|
5843
|
+
options.set("content", data.html);
|
|
5844
|
+
} else {
|
|
5845
|
+
options.set("content", "Invalid url, please try another");
|
|
5846
|
+
}
|
|
5847
|
+
}
|
|
5848
|
+
}).catch((_err) => {
|
|
5849
|
+
options.set("content", "There was an error embedding this URL, please try again or another URL");
|
|
5850
|
+
});
|
|
5851
|
+
} else {
|
|
5852
|
+
options.delete("content");
|
|
5853
|
+
}
|
|
5854
|
+
}
|
|
5855
|
+
}, {
|
|
5856
|
+
name: "content",
|
|
5857
|
+
type: "html",
|
|
5858
|
+
defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
|
|
5859
|
+
hideFromUI: true
|
|
5860
|
+
}]
|
|
5861
|
+
};
|
|
5862
|
+
|
|
5863
|
+
// src/blocks/embed/helpers.ts
|
|
5864
|
+
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
5865
|
+
var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
5866
|
+
|
|
5867
|
+
// src/blocks/embed/embed.tsx
|
|
5868
|
+
var _tmpl$9 = /* @__PURE__ */ template(`<div class=builder-embed>`);
|
|
5869
|
+
function Embed(props) {
|
|
5870
|
+
const [scriptsInserted, setScriptsInserted] = createSignal([]);
|
|
5871
|
+
const [scriptsRun, setScriptsRun] = createSignal([]);
|
|
5872
|
+
const [ranInitFn, setRanInitFn] = createSignal(false);
|
|
5873
|
+
function findAndRunScripts() {
|
|
5874
|
+
if (!elem || !elem.getElementsByTagName)
|
|
5875
|
+
return;
|
|
5876
|
+
const scripts = elem.getElementsByTagName("script");
|
|
5877
|
+
for (let i = 0; i < scripts.length; i++) {
|
|
5878
|
+
const script = scripts[i];
|
|
5879
|
+
if (script.src && !scriptsInserted().includes(script.src)) {
|
|
5880
|
+
scriptsInserted().push(script.src);
|
|
5881
|
+
const newScript = document.createElement("script");
|
|
5882
|
+
newScript.async = true;
|
|
5883
|
+
newScript.src = script.src;
|
|
5884
|
+
document.head.appendChild(newScript);
|
|
5885
|
+
} else if (isJsScript(script) && !scriptsRun().includes(script.innerText)) {
|
|
5886
|
+
try {
|
|
5887
|
+
scriptsRun().push(script.innerText);
|
|
5888
|
+
new Function(script.innerText)();
|
|
5889
|
+
} catch (error) {
|
|
5890
|
+
}
|
|
5891
|
+
}
|
|
5892
|
+
}
|
|
5893
|
+
}
|
|
5894
|
+
let elem;
|
|
5895
|
+
function onUpdateFn_0() {
|
|
5896
|
+
if (elem && !ranInitFn()) {
|
|
5897
|
+
setRanInitFn(true);
|
|
5898
|
+
findAndRunScripts();
|
|
5899
|
+
}
|
|
5900
|
+
}
|
|
5901
|
+
createEffect(on(() => [elem, ranInitFn()], onUpdateFn_0));
|
|
5902
|
+
return (() => {
|
|
5903
|
+
const _el$ = _tmpl$9();
|
|
5904
|
+
const _ref$ = elem;
|
|
5905
|
+
typeof _ref$ === "function" ? use(_ref$, _el$) : elem = _el$;
|
|
5906
|
+
effect(() => _el$.innerHTML = props.content);
|
|
5907
|
+
return _el$;
|
|
5908
|
+
})();
|
|
5909
|
+
}
|
|
5910
|
+
var embed_default = Embed;
|
|
5911
|
+
|
|
5912
|
+
// src/blocks/form/form/component-info.ts
|
|
5913
|
+
var componentInfo11 = {
|
|
5914
|
+
name: "Form:Form",
|
|
5915
|
+
// editableTags: ['builder-form-error']
|
|
5916
|
+
defaults: {
|
|
5917
|
+
responsiveStyles: {
|
|
5918
|
+
large: {
|
|
5919
|
+
marginTop: "15px",
|
|
5920
|
+
paddingBottom: "15px"
|
|
5921
|
+
}
|
|
5922
|
+
}
|
|
5923
|
+
},
|
|
5924
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fef36d2a846134910b64b88e6d18c5ca5",
|
|
5925
|
+
inputs: [{
|
|
5926
|
+
name: "sendSubmissionsTo",
|
|
5927
|
+
type: "string",
|
|
5928
|
+
// TODO: save to builder data and user can download as csv
|
|
5929
|
+
// TODO: easy for mode too or computed add/remove fields form mode
|
|
5930
|
+
// so you can edit details and high level mode at same time...
|
|
5931
|
+
// Later - more integrations like mailchimp
|
|
5932
|
+
// /api/v1/form-submit?to=mailchimp
|
|
5933
|
+
enum: [{
|
|
5934
|
+
label: "Send to email",
|
|
5935
|
+
value: "email",
|
|
5936
|
+
helperText: "Send form submissions to the email address of your choosing"
|
|
5937
|
+
}, {
|
|
5938
|
+
label: "Custom",
|
|
5939
|
+
value: "custom",
|
|
5940
|
+
helperText: "Handle where the form requests go manually with a little code, e.g. to your own custom backend"
|
|
5941
|
+
}],
|
|
5942
|
+
defaultValue: "email"
|
|
5943
|
+
}, {
|
|
5944
|
+
name: "sendSubmissionsToEmail",
|
|
5945
|
+
type: "string",
|
|
5946
|
+
required: true,
|
|
5947
|
+
// TODO: required: () => options.get("sendSubmissionsTo") === "email"
|
|
5948
|
+
defaultValue: "your@email.com",
|
|
5949
|
+
showIf: 'options.get("sendSubmissionsTo") === "email"'
|
|
5950
|
+
}, {
|
|
5951
|
+
name: "sendWithJs",
|
|
5952
|
+
type: "boolean",
|
|
5953
|
+
helperText: "Set to false to use basic html form action",
|
|
5954
|
+
defaultValue: true,
|
|
5955
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
5956
|
+
}, {
|
|
5957
|
+
name: "name",
|
|
5958
|
+
type: "string",
|
|
5959
|
+
defaultValue: "My form"
|
|
5960
|
+
// advanced: true
|
|
5961
|
+
}, {
|
|
5962
|
+
name: "action",
|
|
5963
|
+
type: "string",
|
|
5964
|
+
helperText: "URL to send the form data to",
|
|
5965
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom"'
|
|
5966
|
+
}, {
|
|
5967
|
+
name: "contentType",
|
|
5968
|
+
type: "string",
|
|
5969
|
+
defaultValue: "application/json",
|
|
5970
|
+
advanced: true,
|
|
5971
|
+
// TODO: do automatically if file input
|
|
5972
|
+
enum: ["application/json", "multipart/form-data", "application/x-www-form-urlencoded"],
|
|
5973
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
|
|
5974
|
+
}, {
|
|
5975
|
+
name: "method",
|
|
5976
|
+
type: "string",
|
|
5977
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom"',
|
|
5978
|
+
defaultValue: "POST",
|
|
5979
|
+
advanced: true
|
|
5980
|
+
}, {
|
|
5981
|
+
name: "previewState",
|
|
5982
|
+
type: "string",
|
|
5983
|
+
// TODO: persist: false flag
|
|
5984
|
+
enum: ["unsubmitted", "sending", "success", "error"],
|
|
5985
|
+
defaultValue: "unsubmitted",
|
|
5986
|
+
helperText: 'Choose a state to edit, e.g. choose "success" to show what users see on success and edit the message',
|
|
5987
|
+
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
5988
|
+
}, {
|
|
5989
|
+
name: "successUrl",
|
|
5990
|
+
type: "url",
|
|
5991
|
+
helperText: "Optional URL to redirect the user to on form submission success",
|
|
5992
|
+
showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
|
|
5993
|
+
}, {
|
|
5994
|
+
name: "resetFormOnSubmit",
|
|
5995
|
+
type: "boolean",
|
|
5996
|
+
showIf: "options.get('sendSubmissionsTo') === 'custom' && options.get('sendWithJs') === true",
|
|
5997
|
+
advanced: true
|
|
5998
|
+
}, {
|
|
5999
|
+
name: "successMessage",
|
|
6000
|
+
type: "uiBlocks",
|
|
6001
|
+
hideFromUI: true,
|
|
6002
|
+
defaultValue: [{
|
|
6003
|
+
"@type": "@builder.io/sdk:Element",
|
|
6004
|
+
responsiveStyles: {
|
|
6005
|
+
large: {
|
|
6006
|
+
marginTop: "10px"
|
|
6007
|
+
}
|
|
6008
|
+
},
|
|
6009
|
+
component: {
|
|
6010
|
+
name: "Text",
|
|
6011
|
+
options: {
|
|
6012
|
+
text: "<span>Thanks!</span>"
|
|
6013
|
+
}
|
|
6014
|
+
}
|
|
6015
|
+
}]
|
|
6016
|
+
}, {
|
|
6017
|
+
name: "validate",
|
|
6018
|
+
type: "boolean",
|
|
6019
|
+
defaultValue: true,
|
|
6020
|
+
advanced: true
|
|
6021
|
+
}, {
|
|
6022
|
+
name: "errorMessagePath",
|
|
6023
|
+
type: "text",
|
|
6024
|
+
advanced: true,
|
|
6025
|
+
helperText: 'Path to where to get the error message from in a JSON response to display to the user, e.g. "error.message" for a response like { "error": { "message": "this username is taken" }}'
|
|
6026
|
+
}, {
|
|
6027
|
+
name: "errorMessage",
|
|
6028
|
+
type: "uiBlocks",
|
|
6029
|
+
hideFromUI: true,
|
|
6030
|
+
defaultValue: [{
|
|
6031
|
+
"@type": "@builder.io/sdk:Element",
|
|
6032
|
+
responsiveStyles: {
|
|
6033
|
+
large: {
|
|
6034
|
+
marginTop: "10px"
|
|
6035
|
+
}
|
|
6036
|
+
},
|
|
6037
|
+
bindings: {
|
|
6038
|
+
"component.options.text": "state.formErrorMessage || block.component.options.text"
|
|
6039
|
+
},
|
|
6040
|
+
component: {
|
|
6041
|
+
name: "Text",
|
|
6042
|
+
options: {
|
|
6043
|
+
text: "<span>Form submission error :( Please check your answers and try again</span>"
|
|
6044
|
+
}
|
|
6045
|
+
}
|
|
6046
|
+
}]
|
|
6047
|
+
}, {
|
|
6048
|
+
name: "sendingMessage",
|
|
6049
|
+
type: "uiBlocks",
|
|
6050
|
+
hideFromUI: true,
|
|
6051
|
+
defaultValue: [{
|
|
6052
|
+
"@type": "@builder.io/sdk:Element",
|
|
6053
|
+
responsiveStyles: {
|
|
6054
|
+
large: {
|
|
6055
|
+
marginTop: "10px"
|
|
6056
|
+
}
|
|
6057
|
+
},
|
|
6058
|
+
component: {
|
|
6059
|
+
name: "Text",
|
|
6060
|
+
options: {
|
|
6061
|
+
text: "<span>Sending...</span>"
|
|
6062
|
+
}
|
|
6063
|
+
}
|
|
6064
|
+
}]
|
|
6065
|
+
}, {
|
|
6066
|
+
name: "customHeaders",
|
|
6067
|
+
type: "map",
|
|
6068
|
+
valueType: {
|
|
6069
|
+
type: "string"
|
|
6070
|
+
},
|
|
6071
|
+
advanced: true,
|
|
6072
|
+
showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
|
|
6073
|
+
}],
|
|
6074
|
+
noWrap: true,
|
|
6075
|
+
canHaveChildren: true,
|
|
6076
|
+
defaultChildren: [{
|
|
6077
|
+
"@type": "@builder.io/sdk:Element",
|
|
6078
|
+
responsiveStyles: {
|
|
6079
|
+
large: {
|
|
6080
|
+
marginTop: "10px"
|
|
6081
|
+
}
|
|
6082
|
+
},
|
|
6083
|
+
component: {
|
|
6084
|
+
name: "Text",
|
|
6085
|
+
options: {
|
|
6086
|
+
text: "<span>Enter your name</span>"
|
|
6087
|
+
}
|
|
6088
|
+
}
|
|
6089
|
+
}, {
|
|
6090
|
+
"@type": "@builder.io/sdk:Element",
|
|
6091
|
+
responsiveStyles: {
|
|
6092
|
+
large: {
|
|
6093
|
+
marginTop: "10px"
|
|
6094
|
+
}
|
|
6095
|
+
},
|
|
6096
|
+
component: {
|
|
6097
|
+
name: "Form:Input",
|
|
6098
|
+
options: {
|
|
6099
|
+
name: "name",
|
|
6100
|
+
placeholder: "Jane Doe"
|
|
6101
|
+
}
|
|
6102
|
+
}
|
|
6103
|
+
}, {
|
|
6104
|
+
"@type": "@builder.io/sdk:Element",
|
|
6105
|
+
responsiveStyles: {
|
|
6106
|
+
large: {
|
|
6107
|
+
marginTop: "10px"
|
|
6108
|
+
}
|
|
6109
|
+
},
|
|
6110
|
+
component: {
|
|
6111
|
+
name: "Text",
|
|
6112
|
+
options: {
|
|
6113
|
+
text: "<span>Enter your email</span>"
|
|
6114
|
+
}
|
|
6115
|
+
}
|
|
6116
|
+
}, {
|
|
6117
|
+
"@type": "@builder.io/sdk:Element",
|
|
6118
|
+
responsiveStyles: {
|
|
6119
|
+
large: {
|
|
6120
|
+
marginTop: "10px"
|
|
6121
|
+
}
|
|
6122
|
+
},
|
|
6123
|
+
component: {
|
|
6124
|
+
name: "Form:Input",
|
|
6125
|
+
options: {
|
|
6126
|
+
name: "email",
|
|
6127
|
+
placeholder: "jane@doe.com"
|
|
6128
|
+
}
|
|
6129
|
+
}
|
|
6130
|
+
}, {
|
|
6131
|
+
"@type": "@builder.io/sdk:Element",
|
|
6132
|
+
responsiveStyles: {
|
|
6133
|
+
large: {
|
|
6134
|
+
marginTop: "10px"
|
|
6135
|
+
}
|
|
6136
|
+
},
|
|
6137
|
+
component: {
|
|
6138
|
+
name: "Form:SubmitButton",
|
|
6139
|
+
options: {
|
|
6140
|
+
text: "Submit"
|
|
6141
|
+
}
|
|
6142
|
+
}
|
|
6143
|
+
}]
|
|
6144
|
+
};
|
|
6145
|
+
|
|
6146
|
+
// src/functions/get-env.ts
|
|
6147
|
+
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
6148
|
+
var getEnv = () => {
|
|
6149
|
+
const env = "production";
|
|
6150
|
+
return validEnvList.includes(env) ? env : "production";
|
|
6151
|
+
};
|
|
6152
|
+
|
|
6153
|
+
// src/functions/get.ts
|
|
6154
|
+
var get = (obj, path, defaultValue) => {
|
|
6155
|
+
const result = String.prototype.split.call(path, /[,[\].]+?/).filter(Boolean).reduce((res, key) => res !== null && res !== void 0 ? res[key] : res, obj);
|
|
6156
|
+
return result === void 0 || result === obj ? defaultValue : result;
|
|
6157
|
+
};
|
|
6158
|
+
|
|
6159
|
+
// src/blocks/form/form/form.tsx
|
|
6160
|
+
var _tmpl$10 = /* @__PURE__ */ template(`<pre>`);
|
|
6161
|
+
var _tmpl$23 = /* @__PURE__ */ template(`<form>`);
|
|
6162
|
+
function FormComponent(props) {
|
|
6163
|
+
const [formState, setFormState] = createSignal("unsubmitted");
|
|
6164
|
+
const [responseData, setResponseData] = createSignal(null);
|
|
6165
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal("");
|
|
6166
|
+
function mergeNewRootState(newData) {
|
|
6167
|
+
const combinedState = {
|
|
6168
|
+
...props.builderContext.rootState,
|
|
6169
|
+
...newData
|
|
6170
|
+
};
|
|
6171
|
+
if (props.builderContext.rootSetState) {
|
|
6172
|
+
props.builderContext.rootSetState?.(combinedState);
|
|
6173
|
+
} else {
|
|
6174
|
+
props.builderContext.rootState = combinedState;
|
|
6175
|
+
}
|
|
6176
|
+
}
|
|
6177
|
+
function submissionState() {
|
|
6178
|
+
return isEditing() && props.previewState || formState();
|
|
6179
|
+
}
|
|
6180
|
+
function onSubmit(event) {
|
|
6181
|
+
const sendWithJsProp = props.sendWithJs || props.sendSubmissionsTo === "email";
|
|
6182
|
+
if (props.sendSubmissionsTo === "zapier") {
|
|
6183
|
+
event.preventDefault();
|
|
6184
|
+
} else if (sendWithJsProp) {
|
|
6185
|
+
if (!(props.action || props.sendSubmissionsTo === "email")) {
|
|
6186
|
+
event.preventDefault();
|
|
6187
|
+
return;
|
|
6188
|
+
}
|
|
6189
|
+
event.preventDefault();
|
|
6190
|
+
const el = event.currentTarget;
|
|
6191
|
+
const headers = props.customHeaders || {};
|
|
6192
|
+
let body;
|
|
6193
|
+
const formData = new FormData(el);
|
|
6194
|
+
const formPairs = Array.from(event.currentTarget.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
|
|
6195
|
+
let value;
|
|
6196
|
+
const key = el2.name;
|
|
6197
|
+
if (el2 instanceof HTMLInputElement) {
|
|
6198
|
+
if (el2.type === "radio") {
|
|
6199
|
+
if (el2.checked) {
|
|
6200
|
+
value = el2.name;
|
|
6201
|
+
return {
|
|
6202
|
+
key,
|
|
6203
|
+
value
|
|
6204
|
+
};
|
|
6205
|
+
}
|
|
6206
|
+
} else if (el2.type === "checkbox") {
|
|
6207
|
+
value = el2.checked;
|
|
6208
|
+
} else if (el2.type === "number" || el2.type === "range") {
|
|
6209
|
+
const num = el2.valueAsNumber;
|
|
6210
|
+
if (!isNaN(num)) {
|
|
6211
|
+
value = num;
|
|
6212
|
+
}
|
|
6213
|
+
} else if (el2.type === "file") {
|
|
6214
|
+
value = el2.files;
|
|
6215
|
+
} else {
|
|
6216
|
+
value = el2.value;
|
|
6217
|
+
}
|
|
6218
|
+
} else {
|
|
6219
|
+
value = el2.value;
|
|
6220
|
+
}
|
|
6221
|
+
return {
|
|
6222
|
+
key,
|
|
6223
|
+
value
|
|
6224
|
+
};
|
|
6225
|
+
});
|
|
6226
|
+
let formContentType = props.contentType;
|
|
6227
|
+
if (props.sendSubmissionsTo === "email") {
|
|
6228
|
+
formContentType = "multipart/form-data";
|
|
6229
|
+
}
|
|
6230
|
+
Array.from(formPairs).forEach(({
|
|
6231
|
+
value
|
|
6232
|
+
}) => {
|
|
6233
|
+
if (value instanceof File || Array.isArray(value) && value[0] instanceof File || value instanceof FileList) {
|
|
6234
|
+
formContentType = "multipart/form-data";
|
|
6235
|
+
}
|
|
6236
|
+
});
|
|
6237
|
+
if (formContentType !== "application/json") {
|
|
6238
|
+
body = formData;
|
|
6239
|
+
} else {
|
|
6240
|
+
const json = {};
|
|
6241
|
+
Array.from(formPairs).forEach(({
|
|
6242
|
+
value,
|
|
6243
|
+
key
|
|
6244
|
+
}) => {
|
|
6245
|
+
set(json, key, value);
|
|
6246
|
+
});
|
|
6247
|
+
body = JSON.stringify(json);
|
|
6248
|
+
}
|
|
6249
|
+
if (formContentType && formContentType !== "multipart/form-data") {
|
|
6250
|
+
if (
|
|
6251
|
+
/* Zapier doesn't allow content-type header to be sent from browsers */
|
|
6252
|
+
!(sendWithJsProp && props.action?.includes("zapier.com"))
|
|
6253
|
+
) {
|
|
6254
|
+
headers["content-type"] = formContentType;
|
|
6255
|
+
}
|
|
6256
|
+
}
|
|
6257
|
+
const presubmitEvent = new CustomEvent("presubmit", {
|
|
6258
|
+
detail: {
|
|
6259
|
+
body
|
|
6260
|
+
}
|
|
6261
|
+
});
|
|
6262
|
+
if (formRef) {
|
|
6263
|
+
formRef.dispatchEvent(presubmitEvent);
|
|
6264
|
+
if (presubmitEvent.defaultPrevented) {
|
|
6265
|
+
return;
|
|
6266
|
+
}
|
|
6267
|
+
}
|
|
6268
|
+
setFormState("sending");
|
|
6269
|
+
const formUrl = `${getEnv() === "dev" ? "http://localhost:5000" : "https://builder.io"}/api/v1/form-submit?apiKey=${props.builderContext.apiKey}&to=${btoa(props.sendSubmissionsToEmail || "")}&name=${encodeURIComponent(props.name || "")}`;
|
|
6270
|
+
fetch(props.sendSubmissionsTo === "email" ? formUrl : props.action, {
|
|
6271
|
+
body,
|
|
6272
|
+
headers,
|
|
6273
|
+
method: props.method || "post"
|
|
6274
|
+
}).then(async (res) => {
|
|
6275
|
+
let body2;
|
|
6276
|
+
const contentType = res.headers.get("content-type");
|
|
6277
|
+
if (contentType && contentType.indexOf("application/json") !== -1) {
|
|
6278
|
+
body2 = await res.json();
|
|
6279
|
+
} else {
|
|
6280
|
+
body2 = await res.text();
|
|
6281
|
+
}
|
|
6282
|
+
if (!res.ok && props.errorMessagePath) {
|
|
6283
|
+
let message = get(body2, props.errorMessagePath);
|
|
6284
|
+
if (message) {
|
|
6285
|
+
if (typeof message !== "string") {
|
|
6286
|
+
message = JSON.stringify(message);
|
|
6287
|
+
}
|
|
6288
|
+
setFormErrorMessage(message);
|
|
6289
|
+
mergeNewRootState({
|
|
6290
|
+
formErrorMessage: message
|
|
6291
|
+
});
|
|
6292
|
+
}
|
|
6293
|
+
}
|
|
6294
|
+
setResponseData(body2);
|
|
6295
|
+
setFormState(res.ok ? "success" : "error");
|
|
6296
|
+
if (res.ok) {
|
|
6297
|
+
const submitSuccessEvent = new CustomEvent("submit:success", {
|
|
6298
|
+
detail: {
|
|
6299
|
+
res,
|
|
6300
|
+
body: body2
|
|
6301
|
+
}
|
|
6302
|
+
});
|
|
6303
|
+
if (formRef) {
|
|
6304
|
+
formRef.dispatchEvent(submitSuccessEvent);
|
|
6305
|
+
if (submitSuccessEvent.defaultPrevented) {
|
|
6306
|
+
return;
|
|
6307
|
+
}
|
|
6308
|
+
if (props.resetFormOnSubmit !== false) {
|
|
6309
|
+
formRef.reset();
|
|
6310
|
+
}
|
|
6311
|
+
}
|
|
6312
|
+
if (props.successUrl) {
|
|
6313
|
+
if (formRef) {
|
|
6314
|
+
const event2 = new CustomEvent("route", {
|
|
6315
|
+
detail: {
|
|
6316
|
+
url: props.successUrl
|
|
6317
|
+
}
|
|
6318
|
+
});
|
|
6319
|
+
formRef.dispatchEvent(event2);
|
|
6320
|
+
if (!event2.defaultPrevented) {
|
|
6321
|
+
location.href = props.successUrl;
|
|
6322
|
+
}
|
|
6323
|
+
} else {
|
|
6324
|
+
location.href = props.successUrl;
|
|
6325
|
+
}
|
|
6326
|
+
}
|
|
6327
|
+
}
|
|
6328
|
+
}, (err) => {
|
|
6329
|
+
const submitErrorEvent = new CustomEvent("submit:error", {
|
|
6330
|
+
detail: {
|
|
6331
|
+
error: err
|
|
6332
|
+
}
|
|
6333
|
+
});
|
|
6334
|
+
if (formRef) {
|
|
6335
|
+
formRef.dispatchEvent(submitErrorEvent);
|
|
6336
|
+
if (submitErrorEvent.defaultPrevented) {
|
|
6337
|
+
return;
|
|
6338
|
+
}
|
|
6339
|
+
}
|
|
6340
|
+
setResponseData(err);
|
|
6341
|
+
setFormState("error");
|
|
6342
|
+
});
|
|
6343
|
+
}
|
|
6344
|
+
}
|
|
6345
|
+
let formRef;
|
|
6346
|
+
return (() => {
|
|
6347
|
+
const _el$ = _tmpl$23();
|
|
6348
|
+
_el$.addEventListener("submit", (event) => onSubmit(event));
|
|
6349
|
+
const _ref$ = formRef;
|
|
6350
|
+
typeof _ref$ === "function" ? use(_ref$, _el$) : formRef = _el$;
|
|
6351
|
+
spread(_el$, mergeProps({
|
|
6352
|
+
get validate() {
|
|
6353
|
+
return props.validate;
|
|
6354
|
+
},
|
|
6355
|
+
get action() {
|
|
6356
|
+
return !props.sendWithJs && props.action;
|
|
6357
|
+
},
|
|
6358
|
+
get method() {
|
|
6359
|
+
return props.method;
|
|
6360
|
+
},
|
|
6361
|
+
get name() {
|
|
6362
|
+
return props.name;
|
|
6363
|
+
}
|
|
6364
|
+
}, {}, () => props.attributes), false, true);
|
|
6365
|
+
insert(_el$, createComponent(Show, {
|
|
6366
|
+
get when() {
|
|
6367
|
+
return props.builderBlock && props.builderBlock.children;
|
|
6368
|
+
},
|
|
6369
|
+
get children() {
|
|
6370
|
+
return createComponent(For, {
|
|
6371
|
+
get each() {
|
|
6372
|
+
return props.builderBlock?.children;
|
|
6373
|
+
},
|
|
6374
|
+
children: (block, _index) => {
|
|
6375
|
+
const idx = _index();
|
|
6376
|
+
return createComponent(block_default, {
|
|
6377
|
+
key: `form-block-${idx}`,
|
|
6378
|
+
block,
|
|
6379
|
+
get context() {
|
|
6380
|
+
return props.builderContext;
|
|
6381
|
+
},
|
|
6382
|
+
get registeredComponents() {
|
|
6383
|
+
return props.builderComponents;
|
|
6384
|
+
},
|
|
6385
|
+
get linkComponent() {
|
|
6386
|
+
return props.builderLinkComponent;
|
|
6387
|
+
}
|
|
6388
|
+
});
|
|
6389
|
+
}
|
|
6390
|
+
});
|
|
6391
|
+
}
|
|
6392
|
+
}), null);
|
|
6393
|
+
insert(_el$, createComponent(Show, {
|
|
6394
|
+
get when() {
|
|
6395
|
+
return submissionState() === "error";
|
|
6396
|
+
},
|
|
6397
|
+
get children() {
|
|
6398
|
+
return createComponent(blocks_default, {
|
|
6399
|
+
path: "errorMessage",
|
|
6400
|
+
get blocks() {
|
|
6401
|
+
return props.errorMessage;
|
|
6402
|
+
},
|
|
6403
|
+
get context() {
|
|
6404
|
+
return props.builderContext;
|
|
6405
|
+
}
|
|
6406
|
+
});
|
|
6407
|
+
}
|
|
6408
|
+
}), null);
|
|
6409
|
+
insert(_el$, createComponent(Show, {
|
|
6410
|
+
get when() {
|
|
6411
|
+
return submissionState() === "sending";
|
|
6412
|
+
},
|
|
6413
|
+
get children() {
|
|
6414
|
+
return createComponent(blocks_default, {
|
|
6415
|
+
path: "sendingMessage",
|
|
6416
|
+
get blocks() {
|
|
6417
|
+
return props.sendingMessage;
|
|
6418
|
+
},
|
|
6419
|
+
get context() {
|
|
6420
|
+
return props.builderContext;
|
|
6421
|
+
}
|
|
6422
|
+
});
|
|
6423
|
+
}
|
|
6424
|
+
}), null);
|
|
6425
|
+
insert(_el$, createComponent(Show, {
|
|
6426
|
+
get when() {
|
|
6427
|
+
return memo(() => submissionState() === "error")() && responseData();
|
|
6428
|
+
},
|
|
6429
|
+
get children() {
|
|
6430
|
+
const _el$2 = _tmpl$10();
|
|
6431
|
+
insert(_el$2, () => JSON.stringify(responseData(), null, 2));
|
|
6432
|
+
effect(() => className(_el$2, "builder-form-error-text " + css({
|
|
6433
|
+
padding: "10px",
|
|
6434
|
+
color: "red",
|
|
6435
|
+
textAlign: "center"
|
|
6436
|
+
})));
|
|
6437
|
+
return _el$2;
|
|
6438
|
+
}
|
|
6439
|
+
}), null);
|
|
6440
|
+
insert(_el$, createComponent(Show, {
|
|
6441
|
+
get when() {
|
|
6442
|
+
return submissionState() === "success";
|
|
6443
|
+
},
|
|
6444
|
+
get children() {
|
|
6445
|
+
return createComponent(blocks_default, {
|
|
6446
|
+
path: "successMessage",
|
|
6447
|
+
get blocks() {
|
|
6448
|
+
return props.successMessage;
|
|
6449
|
+
},
|
|
6450
|
+
get context() {
|
|
6451
|
+
return props.builderContext;
|
|
6452
|
+
}
|
|
6453
|
+
});
|
|
6454
|
+
}
|
|
6455
|
+
}), null);
|
|
6456
|
+
return _el$;
|
|
6457
|
+
})();
|
|
6458
|
+
}
|
|
6459
|
+
var form_default = FormComponent;
|
|
6460
|
+
|
|
6461
|
+
// src/blocks/form/input/component-info.ts
|
|
6462
|
+
var componentInfo12 = {
|
|
6463
|
+
name: "Form:Input",
|
|
6464
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
|
|
6465
|
+
inputs: [
|
|
6466
|
+
{
|
|
6467
|
+
name: "type",
|
|
6468
|
+
type: "text",
|
|
6469
|
+
enum: ["text", "number", "email", "url", "checkbox", "radio", "range", "date", "datetime-local", "search", "tel", "time", "file", "month", "week", "password", "color", "hidden"],
|
|
6470
|
+
defaultValue: "text"
|
|
6471
|
+
},
|
|
6472
|
+
{
|
|
6473
|
+
name: "name",
|
|
6474
|
+
type: "string",
|
|
6475
|
+
required: true,
|
|
6476
|
+
helperText: 'Every input in a form needs a unique name describing what it takes, e.g. "email"'
|
|
6477
|
+
},
|
|
6478
|
+
{
|
|
6479
|
+
name: "placeholder",
|
|
6480
|
+
type: "string",
|
|
6481
|
+
defaultValue: "Hello there",
|
|
6482
|
+
helperText: "Text to display when there is no value"
|
|
6483
|
+
},
|
|
6484
|
+
// TODO: handle value vs default value automatically like ng-model
|
|
6485
|
+
{
|
|
6486
|
+
name: "defaultValue",
|
|
6487
|
+
type: "string"
|
|
6488
|
+
},
|
|
6489
|
+
{
|
|
6490
|
+
name: "value",
|
|
6491
|
+
type: "string",
|
|
6492
|
+
advanced: true
|
|
6493
|
+
},
|
|
6494
|
+
{
|
|
6495
|
+
name: "required",
|
|
6496
|
+
type: "boolean",
|
|
6497
|
+
helperText: "Is this input required to be filled out to submit a form",
|
|
6498
|
+
defaultValue: false
|
|
6499
|
+
}
|
|
6500
|
+
],
|
|
6501
|
+
noWrap: true,
|
|
6502
|
+
static: true,
|
|
6503
|
+
defaultStyles: {
|
|
6504
|
+
paddingTop: "10px",
|
|
6505
|
+
paddingBottom: "10px",
|
|
6506
|
+
paddingLeft: "10px",
|
|
6507
|
+
paddingRight: "10px",
|
|
6508
|
+
borderRadius: "3px",
|
|
6509
|
+
borderWidth: "1px",
|
|
6510
|
+
borderStyle: "solid",
|
|
6511
|
+
borderColor: "#ccc"
|
|
6512
|
+
}
|
|
6513
|
+
};
|
|
6514
|
+
var _tmpl$11 = /* @__PURE__ */ template(`<input>`);
|
|
6515
|
+
function FormInputComponent(props) {
|
|
6516
|
+
return (() => {
|
|
6517
|
+
const _el$ = _tmpl$11();
|
|
6518
|
+
spread(_el$, mergeProps({}, () => props.attributes, {
|
|
6519
|
+
get key() {
|
|
6520
|
+
return isEditing() && props.defaultValue ? props.defaultValue : "default-key";
|
|
6521
|
+
},
|
|
6522
|
+
get placeholder() {
|
|
6523
|
+
return props.placeholder;
|
|
6524
|
+
},
|
|
6525
|
+
get type() {
|
|
6526
|
+
return props.type;
|
|
6527
|
+
},
|
|
6528
|
+
get name() {
|
|
6529
|
+
return props.name;
|
|
6530
|
+
},
|
|
6531
|
+
get value() {
|
|
6532
|
+
return props.value;
|
|
6533
|
+
},
|
|
6534
|
+
get defaultValue() {
|
|
6535
|
+
return props.defaultValue;
|
|
6536
|
+
},
|
|
6537
|
+
get required() {
|
|
6538
|
+
return props.required;
|
|
6539
|
+
}
|
|
6540
|
+
}), false, false);
|
|
6541
|
+
return _el$;
|
|
6542
|
+
})();
|
|
6543
|
+
}
|
|
6544
|
+
var input_default = FormInputComponent;
|
|
6545
|
+
|
|
6546
|
+
// src/blocks/form/select/component-info.ts
|
|
6547
|
+
var componentInfo13 = {
|
|
6548
|
+
name: "Form:Select",
|
|
6549
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
|
|
6550
|
+
defaultStyles: {
|
|
6551
|
+
alignSelf: "flex-start"
|
|
6552
|
+
},
|
|
6553
|
+
inputs: [{
|
|
6554
|
+
name: "options",
|
|
6555
|
+
type: "list",
|
|
6556
|
+
required: true,
|
|
6557
|
+
subFields: [{
|
|
6558
|
+
name: "value",
|
|
6559
|
+
type: "text",
|
|
6560
|
+
required: true
|
|
6561
|
+
}, {
|
|
6562
|
+
name: "name",
|
|
6563
|
+
type: "text"
|
|
6564
|
+
}],
|
|
6565
|
+
defaultValue: [{
|
|
6566
|
+
value: "option 1"
|
|
6567
|
+
}, {
|
|
6568
|
+
value: "option 2"
|
|
6569
|
+
}]
|
|
6570
|
+
}, {
|
|
6571
|
+
name: "name",
|
|
6572
|
+
type: "string",
|
|
6573
|
+
required: true,
|
|
6574
|
+
helperText: 'Every select in a form needs a unique name describing what it gets, e.g. "email"'
|
|
6575
|
+
}, {
|
|
6576
|
+
name: "defaultValue",
|
|
6577
|
+
type: "string"
|
|
6578
|
+
}, {
|
|
6579
|
+
name: "value",
|
|
5740
6580
|
type: "string",
|
|
5741
|
-
|
|
5742
|
-
}, {
|
|
5743
|
-
name: "lazy",
|
|
5744
|
-
type: "boolean",
|
|
5745
|
-
defaultValue: true,
|
|
5746
|
-
hideFromUI: true
|
|
6581
|
+
advanced: true
|
|
5747
6582
|
}, {
|
|
5748
|
-
name: "
|
|
6583
|
+
name: "required",
|
|
5749
6584
|
type: "boolean",
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
6585
|
+
defaultValue: false
|
|
6586
|
+
}],
|
|
6587
|
+
static: true,
|
|
6588
|
+
noWrap: true
|
|
6589
|
+
};
|
|
6590
|
+
var _tmpl$12 = /* @__PURE__ */ template(`<select>`);
|
|
6591
|
+
var _tmpl$24 = /* @__PURE__ */ template(`<option>`);
|
|
6592
|
+
function SelectComponent(props) {
|
|
6593
|
+
return (() => {
|
|
6594
|
+
const _el$ = _tmpl$12();
|
|
6595
|
+
spread(_el$, mergeProps({}, () => props.attributes, {
|
|
6596
|
+
get value() {
|
|
6597
|
+
return props.value;
|
|
6598
|
+
},
|
|
6599
|
+
get key() {
|
|
6600
|
+
return isEditing() && props.defaultValue ? props.defaultValue : "default-key";
|
|
6601
|
+
},
|
|
6602
|
+
get defaultValue() {
|
|
6603
|
+
return props.defaultValue;
|
|
6604
|
+
},
|
|
6605
|
+
get name() {
|
|
6606
|
+
return props.name;
|
|
6607
|
+
}
|
|
6608
|
+
}), false, true);
|
|
6609
|
+
insert(_el$, createComponent(For, {
|
|
6610
|
+
get each() {
|
|
6611
|
+
return props.options;
|
|
6612
|
+
},
|
|
6613
|
+
children: (option, _index) => {
|
|
6614
|
+
_index();
|
|
6615
|
+
return (() => {
|
|
6616
|
+
const _el$2 = _tmpl$24();
|
|
6617
|
+
insert(_el$2, () => option.name || option.value);
|
|
6618
|
+
effect(() => _el$2.value = option.value);
|
|
6619
|
+
return _el$2;
|
|
6620
|
+
})();
|
|
6621
|
+
}
|
|
6622
|
+
}));
|
|
6623
|
+
return _el$;
|
|
6624
|
+
})();
|
|
6625
|
+
}
|
|
6626
|
+
var select_default = SelectComponent;
|
|
6627
|
+
|
|
6628
|
+
// src/blocks/form/submit-button/component-info.ts
|
|
6629
|
+
var componentInfo14 = {
|
|
6630
|
+
name: "Form:SubmitButton",
|
|
6631
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
|
|
6632
|
+
defaultStyles: {
|
|
6633
|
+
appearance: "none",
|
|
6634
|
+
paddingTop: "15px",
|
|
6635
|
+
paddingBottom: "15px",
|
|
6636
|
+
paddingLeft: "25px",
|
|
6637
|
+
paddingRight: "25px",
|
|
6638
|
+
backgroundColor: "#3898EC",
|
|
6639
|
+
color: "white",
|
|
6640
|
+
borderRadius: "4px",
|
|
6641
|
+
cursor: "pointer"
|
|
6642
|
+
},
|
|
6643
|
+
inputs: [{
|
|
6644
|
+
name: "text",
|
|
6645
|
+
type: "text",
|
|
6646
|
+
defaultValue: "Click me"
|
|
6647
|
+
}],
|
|
6648
|
+
static: true,
|
|
6649
|
+
noWrap: true
|
|
6650
|
+
// TODO: optional children? maybe as optional form input
|
|
6651
|
+
// that only shows if advanced setting is flipped
|
|
6652
|
+
// TODO: defaultChildren
|
|
6653
|
+
// canHaveChildren: true,
|
|
5759
6654
|
};
|
|
6655
|
+
var _tmpl$13 = /* @__PURE__ */ template(`<button type=submit>`);
|
|
6656
|
+
function SubmitButton(props) {
|
|
6657
|
+
return (() => {
|
|
6658
|
+
const _el$ = _tmpl$13();
|
|
6659
|
+
spread(_el$, mergeProps({}, () => props.attributes), false, true);
|
|
6660
|
+
insert(_el$, () => props.text);
|
|
6661
|
+
return _el$;
|
|
6662
|
+
})();
|
|
6663
|
+
}
|
|
6664
|
+
var submit_button_default = SubmitButton;
|
|
5760
6665
|
|
|
5761
6666
|
// src/blocks/img/component-info.ts
|
|
5762
|
-
var
|
|
6667
|
+
var componentInfo15 = {
|
|
5763
6668
|
// friendlyName?
|
|
5764
6669
|
name: "Raw:Img",
|
|
5765
6670
|
hideFromInsertMenu: true,
|
|
@@ -5774,10 +6679,10 @@ var componentInfo7 = {
|
|
|
5774
6679
|
noWrap: true,
|
|
5775
6680
|
static: true
|
|
5776
6681
|
};
|
|
5777
|
-
var _tmpl$
|
|
6682
|
+
var _tmpl$14 = /* @__PURE__ */ template(`<img>`);
|
|
5778
6683
|
function ImgComponent(props) {
|
|
5779
6684
|
return (() => {
|
|
5780
|
-
const _el$ = _tmpl$
|
|
6685
|
+
const _el$ = _tmpl$14();
|
|
5781
6686
|
spread(_el$, mergeProps({
|
|
5782
6687
|
get style() {
|
|
5783
6688
|
return {
|
|
@@ -5800,159 +6705,8 @@ function ImgComponent(props) {
|
|
|
5800
6705
|
}
|
|
5801
6706
|
var img_default = ImgComponent;
|
|
5802
6707
|
|
|
5803
|
-
// src/blocks/section/component-info.ts
|
|
5804
|
-
var componentInfo8 = {
|
|
5805
|
-
name: "Core:Section",
|
|
5806
|
-
static: true,
|
|
5807
|
-
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
5808
|
-
inputs: [{
|
|
5809
|
-
name: "maxWidth",
|
|
5810
|
-
type: "number",
|
|
5811
|
-
defaultValue: 1200
|
|
5812
|
-
}, {
|
|
5813
|
-
name: "lazyLoad",
|
|
5814
|
-
type: "boolean",
|
|
5815
|
-
defaultValue: false,
|
|
5816
|
-
advanced: true,
|
|
5817
|
-
description: "Only render this section when in view"
|
|
5818
|
-
}],
|
|
5819
|
-
defaultStyles: {
|
|
5820
|
-
paddingLeft: "20px",
|
|
5821
|
-
paddingRight: "20px",
|
|
5822
|
-
paddingTop: "50px",
|
|
5823
|
-
paddingBottom: "50px",
|
|
5824
|
-
marginTop: "0px",
|
|
5825
|
-
width: "100vw",
|
|
5826
|
-
marginLeft: "calc(50% - 50vw)"
|
|
5827
|
-
},
|
|
5828
|
-
canHaveChildren: true,
|
|
5829
|
-
defaultChildren: [{
|
|
5830
|
-
"@type": "@builder.io/sdk:Element",
|
|
5831
|
-
responsiveStyles: {
|
|
5832
|
-
large: {
|
|
5833
|
-
textAlign: "center"
|
|
5834
|
-
}
|
|
5835
|
-
},
|
|
5836
|
-
component: {
|
|
5837
|
-
name: "Text",
|
|
5838
|
-
options: {
|
|
5839
|
-
text: "<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>"
|
|
5840
|
-
}
|
|
5841
|
-
}
|
|
5842
|
-
}]
|
|
5843
|
-
};
|
|
5844
|
-
|
|
5845
|
-
// src/blocks/slot/component-info.ts
|
|
5846
|
-
var componentInfo9 = {
|
|
5847
|
-
name: "Slot",
|
|
5848
|
-
isRSC: true,
|
|
5849
|
-
description: "Allow child blocks to be inserted into this content when used as a Symbol",
|
|
5850
|
-
docsLink: "https://www.builder.io/c/docs/symbols-with-blocks",
|
|
5851
|
-
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",
|
|
5852
|
-
// Maybe wrap this for canHaveChildren so bind children to this hm
|
|
5853
|
-
inputs: [{
|
|
5854
|
-
name: "name",
|
|
5855
|
-
type: "string",
|
|
5856
|
-
required: true,
|
|
5857
|
-
defaultValue: "children"
|
|
5858
|
-
}]
|
|
5859
|
-
};
|
|
5860
|
-
var _tmpl$9 = /* @__PURE__ */ template(`<div>`);
|
|
5861
|
-
function Slot(props) {
|
|
5862
|
-
return (() => {
|
|
5863
|
-
const _el$ = _tmpl$9();
|
|
5864
|
-
_el$.style.setProperty("pointer-events", "auto");
|
|
5865
|
-
spread(_el$, mergeProps(() => !props.builderContext.context?.symbolId && {
|
|
5866
|
-
"builder-slot": props.name
|
|
5867
|
-
}), false, true);
|
|
5868
|
-
insert(_el$, createComponent(blocks_default, {
|
|
5869
|
-
get parent() {
|
|
5870
|
-
return props.builderContext.context?.symbolId;
|
|
5871
|
-
},
|
|
5872
|
-
get path() {
|
|
5873
|
-
return `symbol.data.${props.name}`;
|
|
5874
|
-
},
|
|
5875
|
-
get context() {
|
|
5876
|
-
return props.builderContext;
|
|
5877
|
-
},
|
|
5878
|
-
get blocks() {
|
|
5879
|
-
return props.builderContext.rootState?.[props.name];
|
|
5880
|
-
}
|
|
5881
|
-
}));
|
|
5882
|
-
return _el$;
|
|
5883
|
-
})();
|
|
5884
|
-
}
|
|
5885
|
-
var slot_default = Slot;
|
|
5886
|
-
|
|
5887
|
-
// src/blocks/symbol/component-info.ts
|
|
5888
|
-
var componentInfo10 = {
|
|
5889
|
-
name: "Symbol",
|
|
5890
|
-
noWrap: true,
|
|
5891
|
-
static: true,
|
|
5892
|
-
isRSC: true,
|
|
5893
|
-
inputs: [{
|
|
5894
|
-
name: "symbol",
|
|
5895
|
-
type: "uiSymbol"
|
|
5896
|
-
}, {
|
|
5897
|
-
name: "dataOnly",
|
|
5898
|
-
helperText: "Make this a data symbol that doesn't display any UI",
|
|
5899
|
-
type: "boolean",
|
|
5900
|
-
defaultValue: false,
|
|
5901
|
-
advanced: true,
|
|
5902
|
-
hideFromUI: true
|
|
5903
|
-
}, {
|
|
5904
|
-
name: "inheritState",
|
|
5905
|
-
helperText: "Inherit the parent component state and data",
|
|
5906
|
-
type: "boolean",
|
|
5907
|
-
defaultValue: false,
|
|
5908
|
-
advanced: true
|
|
5909
|
-
}, {
|
|
5910
|
-
name: "renderToLiquid",
|
|
5911
|
-
helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
|
|
5912
|
-
type: "boolean",
|
|
5913
|
-
defaultValue: false,
|
|
5914
|
-
advanced: true,
|
|
5915
|
-
hideFromUI: true
|
|
5916
|
-
}, {
|
|
5917
|
-
name: "useChildren",
|
|
5918
|
-
hideFromUI: true,
|
|
5919
|
-
type: "boolean"
|
|
5920
|
-
}]
|
|
5921
|
-
};
|
|
5922
|
-
|
|
5923
|
-
// src/blocks/text/component-info.ts
|
|
5924
|
-
var componentInfo11 = {
|
|
5925
|
-
name: "Text",
|
|
5926
|
-
static: true,
|
|
5927
|
-
isRSC: true,
|
|
5928
|
-
image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",
|
|
5929
|
-
inputs: [{
|
|
5930
|
-
name: "text",
|
|
5931
|
-
type: "html",
|
|
5932
|
-
required: true,
|
|
5933
|
-
autoFocus: true,
|
|
5934
|
-
bubble: true,
|
|
5935
|
-
defaultValue: "Enter some text..."
|
|
5936
|
-
}],
|
|
5937
|
-
defaultStyles: {
|
|
5938
|
-
lineHeight: "normal",
|
|
5939
|
-
height: "auto",
|
|
5940
|
-
textAlign: "center"
|
|
5941
|
-
}
|
|
5942
|
-
};
|
|
5943
|
-
var _tmpl$10 = /* @__PURE__ */ template(`<div class=builder-text>`);
|
|
5944
|
-
function Text(props) {
|
|
5945
|
-
return (() => {
|
|
5946
|
-
const _el$ = _tmpl$10();
|
|
5947
|
-
_el$.style.setProperty("outline", "none");
|
|
5948
|
-
effect(() => _el$.innerHTML = props.text?.toString() || "");
|
|
5949
|
-
return _el$;
|
|
5950
|
-
})();
|
|
5951
|
-
}
|
|
5952
|
-
var text_default = Text;
|
|
5953
|
-
|
|
5954
6708
|
// src/blocks/video/component-info.ts
|
|
5955
|
-
var
|
|
6709
|
+
var componentInfo16 = {
|
|
5956
6710
|
name: "Video",
|
|
5957
6711
|
canHaveChildren: true,
|
|
5958
6712
|
defaultStyles: {
|
|
@@ -6034,8 +6788,8 @@ var componentInfo12 = {
|
|
|
6034
6788
|
advanced: true
|
|
6035
6789
|
}]
|
|
6036
6790
|
};
|
|
6037
|
-
var _tmpl$
|
|
6038
|
-
var _tmpl$
|
|
6791
|
+
var _tmpl$15 = /* @__PURE__ */ template(`<source type=video/mp4>`);
|
|
6792
|
+
var _tmpl$25 = /* @__PURE__ */ template(`<div>`);
|
|
6039
6793
|
var _tmpl$33 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
6040
6794
|
function Video(props) {
|
|
6041
6795
|
function videoProps() {
|
|
@@ -6097,7 +6851,7 @@ function Video(props) {
|
|
|
6097
6851
|
return !props.lazyLoad;
|
|
6098
6852
|
},
|
|
6099
6853
|
get children() {
|
|
6100
|
-
const _el$3 = _tmpl$
|
|
6854
|
+
const _el$3 = _tmpl$15();
|
|
6101
6855
|
effect(() => setAttribute(_el$3, "src", props.video));
|
|
6102
6856
|
return _el$3;
|
|
6103
6857
|
}
|
|
@@ -6107,7 +6861,7 @@ function Video(props) {
|
|
|
6107
6861
|
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
6108
6862
|
},
|
|
6109
6863
|
get children() {
|
|
6110
|
-
const _el$4 = _tmpl$
|
|
6864
|
+
const _el$4 = _tmpl$25();
|
|
6111
6865
|
_el$4.style.setProperty("width", "100%");
|
|
6112
6866
|
_el$4.style.setProperty("pointer-events", "none");
|
|
6113
6867
|
_el$4.style.setProperty("font-size", "0px");
|
|
@@ -6120,7 +6874,7 @@ function Video(props) {
|
|
|
6120
6874
|
return props.builderBlock?.children?.length && props.fitContent;
|
|
6121
6875
|
},
|
|
6122
6876
|
get children() {
|
|
6123
|
-
const _el$5 = _tmpl$
|
|
6877
|
+
const _el$5 = _tmpl$25();
|
|
6124
6878
|
_el$5.style.setProperty("display", "flex");
|
|
6125
6879
|
_el$5.style.setProperty("flex-direction", "column");
|
|
6126
6880
|
_el$5.style.setProperty("align-items", "stretch");
|
|
@@ -6133,7 +6887,7 @@ function Video(props) {
|
|
|
6133
6887
|
return props.builderBlock?.children?.length && !props.fitContent;
|
|
6134
6888
|
},
|
|
6135
6889
|
get children() {
|
|
6136
|
-
const _el$6 = _tmpl$
|
|
6890
|
+
const _el$6 = _tmpl$25();
|
|
6137
6891
|
_el$6.style.setProperty("pointer-events", "none");
|
|
6138
6892
|
_el$6.style.setProperty("display", "flex");
|
|
6139
6893
|
_el$6.style.setProperty("flex-direction", "column");
|
|
@@ -6152,6 +6906,33 @@ function Video(props) {
|
|
|
6152
6906
|
}
|
|
6153
6907
|
var video_default = Video;
|
|
6154
6908
|
|
|
6909
|
+
// src/constants/extra-components.ts
|
|
6910
|
+
var getExtraComponents = () => [{
|
|
6911
|
+
component: custom_code_default,
|
|
6912
|
+
...componentInfo9
|
|
6913
|
+
}, {
|
|
6914
|
+
component: embed_default,
|
|
6915
|
+
...componentInfo10
|
|
6916
|
+
}, ...TARGET === "rsc" ? [] : [{
|
|
6917
|
+
component: form_default,
|
|
6918
|
+
...componentInfo11
|
|
6919
|
+
}, {
|
|
6920
|
+
component: input_default,
|
|
6921
|
+
...componentInfo12
|
|
6922
|
+
}, {
|
|
6923
|
+
component: submit_button_default,
|
|
6924
|
+
...componentInfo14
|
|
6925
|
+
}, {
|
|
6926
|
+
component: select_default,
|
|
6927
|
+
...componentInfo13
|
|
6928
|
+
}], {
|
|
6929
|
+
component: img_default,
|
|
6930
|
+
...componentInfo15
|
|
6931
|
+
}, {
|
|
6932
|
+
component: video_default,
|
|
6933
|
+
...componentInfo16
|
|
6934
|
+
}];
|
|
6935
|
+
|
|
6155
6936
|
// src/constants/builder-registered-components.ts
|
|
6156
6937
|
var getDefaultRegisteredComponents = () => [{
|
|
6157
6938
|
component: button_default,
|
|
@@ -6160,36 +6941,24 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
6160
6941
|
component: columns_default,
|
|
6161
6942
|
...componentInfo2
|
|
6162
6943
|
}, {
|
|
6163
|
-
component:
|
|
6944
|
+
component: fragment_default,
|
|
6164
6945
|
...componentInfo3
|
|
6165
6946
|
}, {
|
|
6166
|
-
component:
|
|
6947
|
+
component: image_default,
|
|
6167
6948
|
...componentInfo4
|
|
6168
6949
|
}, {
|
|
6169
|
-
component:
|
|
6950
|
+
component: section_default,
|
|
6170
6951
|
...componentInfo5
|
|
6171
6952
|
}, {
|
|
6172
|
-
component:
|
|
6953
|
+
component: slot_default,
|
|
6173
6954
|
...componentInfo6
|
|
6174
|
-
}, {
|
|
6175
|
-
component: img_default,
|
|
6176
|
-
...componentInfo7
|
|
6177
|
-
}, {
|
|
6178
|
-
component: section_default,
|
|
6179
|
-
...componentInfo8
|
|
6180
6955
|
}, {
|
|
6181
6956
|
component: symbol_default,
|
|
6182
|
-
...
|
|
6957
|
+
...componentInfo7
|
|
6183
6958
|
}, {
|
|
6184
6959
|
component: text_default,
|
|
6185
|
-
...
|
|
6186
|
-
},
|
|
6187
|
-
component: video_default,
|
|
6188
|
-
...componentInfo12
|
|
6189
|
-
}, {
|
|
6190
|
-
component: slot_default,
|
|
6191
|
-
...componentInfo9
|
|
6192
|
-
}];
|
|
6960
|
+
...componentInfo8
|
|
6961
|
+
}, ...getExtraComponents()];
|
|
6193
6962
|
|
|
6194
6963
|
// src/functions/register-component.ts
|
|
6195
6964
|
var components = [];
|
|
@@ -6259,10 +7028,10 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
6259
7028
|
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
6260
7029
|
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
6261
7030
|
)`;
|
|
6262
|
-
var _tmpl$
|
|
7031
|
+
var _tmpl$16 = /* @__PURE__ */ template(`<script>`);
|
|
6263
7032
|
function InlinedScript(props) {
|
|
6264
7033
|
return (() => {
|
|
6265
|
-
const _el$ = _tmpl$
|
|
7034
|
+
const _el$ = _tmpl$16();
|
|
6266
7035
|
effect((_p$) => {
|
|
6267
7036
|
const _v$ = props.scriptStr, _v$2 = props.id || "";
|
|
6268
7037
|
_v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
|
|
@@ -6764,7 +7533,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
6764
7533
|
}
|
|
6765
7534
|
|
|
6766
7535
|
// src/constants/sdk-version.ts
|
|
6767
|
-
var SDK_VERSION = "0.13.
|
|
7536
|
+
var SDK_VERSION = "0.13.3";
|
|
6768
7537
|
|
|
6769
7538
|
// src/functions/register.ts
|
|
6770
7539
|
var registry = {};
|
|
@@ -7765,7 +8534,7 @@ var fetchSymbolContent = async ({
|
|
|
7765
8534
|
};
|
|
7766
8535
|
|
|
7767
8536
|
// src/blocks/symbol/symbol.tsx
|
|
7768
|
-
var _tmpl$
|
|
8537
|
+
var _tmpl$17 = /* @__PURE__ */ template(`<div>`);
|
|
7769
8538
|
function Symbol2(props) {
|
|
7770
8539
|
const [contentToUse, setContentToUse] = createSignal(props.symbol?.content);
|
|
7771
8540
|
function className() {
|
|
@@ -7791,7 +8560,7 @@ function Symbol2(props) {
|
|
|
7791
8560
|
}
|
|
7792
8561
|
createEffect(on(() => [props.symbol], onUpdateFn_0));
|
|
7793
8562
|
return (() => {
|
|
7794
|
-
const _el$ = _tmpl$
|
|
8563
|
+
const _el$ = _tmpl$17();
|
|
7795
8564
|
spread(_el$, mergeProps({
|
|
7796
8565
|
get ["class"]() {
|
|
7797
8566
|
return className();
|