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