@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/node/dev.js CHANGED
@@ -936,7 +936,7 @@ function BlockStyles(props) {
936
936
  }
937
937
  return true;
938
938
  }
939
- function css4() {
939
+ function css5() {
940
940
  const processedBlock = getProcessedBlock({
941
941
  block: props.block,
942
942
  localState: props.context.localState,
@@ -973,12 +973,12 @@ function BlockStyles(props) {
973
973
  }
974
974
  return createComponent(Show, {
975
975
  get when() {
976
- return memo(() => !!(TARGET !== "reactNative" && css4()))() && canShowBlock();
976
+ return memo(() => !!(TARGET !== "reactNative" && css5()))() && canShowBlock();
977
977
  },
978
978
  get children() {
979
979
  return createComponent(inlined_styles_default, {
980
980
  get styles() {
981
- return css4();
981
+ return css5();
982
982
  }
983
983
  });
984
984
  }
@@ -1313,10 +1313,10 @@ function Block(props) {
1313
1313
  componentOptions: {
1314
1314
  ...getBlockComponentOptions(processedBlock()),
1315
1315
  builderContext: props.context,
1316
- ...blockComponent()?.name === "Core:Button" || blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" ? {
1316
+ ...blockComponent()?.name === "Core:Button" || blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" || blockComponent()?.name === "Form:Form" ? {
1317
1317
  builderLinkComponent: props.linkComponent
1318
1318
  } : {},
1319
- ...blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" ? {
1319
+ ...blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" || blockComponent()?.name === "Form:Form" ? {
1320
1320
  builderComponents: props.registeredComponents
1321
1321
  } : {}
1322
1322
  },
@@ -2443,172 +2443,8 @@ var componentInfo2 = {
2443
2443
  }]
2444
2444
  };
2445
2445
 
2446
- // src/blocks/custom-code/component-info.ts
2447
- var componentInfo3 = {
2448
- name: "Custom Code",
2449
- static: true,
2450
- requiredPermissions: ["editCode"],
2451
- inputs: [{
2452
- name: "code",
2453
- type: "html",
2454
- required: true,
2455
- defaultValue: "<p>Hello there, I am custom HTML code!</p>",
2456
- code: true
2457
- }, {
2458
- name: "replaceNodes",
2459
- type: "boolean",
2460
- helperText: "Preserve server rendered dom nodes",
2461
- advanced: true
2462
- }, {
2463
- name: "scriptsClientOnly",
2464
- type: "boolean",
2465
- defaultValue: false,
2466
- helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
2467
- advanced: true
2468
- }]
2469
- };
2470
- var _tmpl$6 = /* @__PURE__ */ template(`<div>`);
2471
- function CustomCode(props) {
2472
- const [scriptsInserted, setScriptsInserted] = createSignal([]);
2473
- const [scriptsRun, setScriptsRun] = createSignal([]);
2474
- let elementRef;
2475
- onMount(() => {
2476
- if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
2477
- return;
2478
- }
2479
- const scripts = elementRef.getElementsByTagName("script");
2480
- for (let i = 0; i < scripts.length; i++) {
2481
- const script = scripts[i];
2482
- if (script.src) {
2483
- if (scriptsInserted().includes(script.src)) {
2484
- continue;
2485
- }
2486
- scriptsInserted().push(script.src);
2487
- const newScript = document.createElement("script");
2488
- newScript.async = true;
2489
- newScript.src = script.src;
2490
- document.head.appendChild(newScript);
2491
- } else if (!script.type || ["text/javascript", "application/javascript", "application/ecmascript"].includes(script.type)) {
2492
- if (scriptsRun().includes(script.innerText)) {
2493
- continue;
2494
- }
2495
- try {
2496
- scriptsRun().push(script.innerText);
2497
- new Function(script.innerText)();
2498
- } catch (error2) {
2499
- console.warn("`CustomCode`: Error running script:", error2);
2500
- }
2501
- }
2502
- }
2503
- });
2504
- return (() => {
2505
- const _el$ = _tmpl$6();
2506
- const _ref$ = elementRef;
2507
- typeof _ref$ === "function" ? use(_ref$, _el$) : elementRef = _el$;
2508
- effect((_p$) => {
2509
- const _v$ = "builder-custom-code" + (props.replaceNodes ? " replace-nodes" : ""), _v$2 = props.code;
2510
- _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
2511
- _v$2 !== _p$._v$2 && (_el$.innerHTML = _p$._v$2 = _v$2);
2512
- return _p$;
2513
- }, {
2514
- _v$: void 0,
2515
- _v$2: void 0
2516
- });
2517
- return _el$;
2518
- })();
2519
- }
2520
- var custom_code_default = CustomCode;
2521
-
2522
- // src/blocks/embed/component-info.ts
2523
- var componentInfo4 = {
2524
- name: "Embed",
2525
- static: true,
2526
- inputs: [{
2527
- name: "url",
2528
- type: "url",
2529
- required: true,
2530
- defaultValue: "",
2531
- helperText: "e.g. enter a youtube url, google map, etc",
2532
- onChange: (options) => {
2533
- const url = options.get("url");
2534
- if (url) {
2535
- options.set("content", "Loading...");
2536
- const apiKey = "ae0e60e78201a3f2b0de4b";
2537
- return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
2538
- if (options.get("url") === url) {
2539
- if (data.html) {
2540
- options.set("content", data.html);
2541
- } else {
2542
- options.set("content", "Invalid url, please try another");
2543
- }
2544
- }
2545
- }).catch((_err) => {
2546
- options.set("content", "There was an error embedding this URL, please try again or another URL");
2547
- });
2548
- } else {
2549
- options.delete("content");
2550
- }
2551
- }
2552
- }, {
2553
- name: "content",
2554
- type: "html",
2555
- defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
2556
- hideFromUI: true
2557
- }]
2558
- };
2559
-
2560
- // src/blocks/embed/helpers.ts
2561
- var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
2562
- var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
2563
-
2564
- // src/blocks/embed/embed.tsx
2565
- var _tmpl$7 = /* @__PURE__ */ template(`<div class=builder-embed>`);
2566
- function Embed(props) {
2567
- const [scriptsInserted, setScriptsInserted] = createSignal([]);
2568
- const [scriptsRun, setScriptsRun] = createSignal([]);
2569
- const [ranInitFn, setRanInitFn] = createSignal(false);
2570
- function findAndRunScripts() {
2571
- if (!elem || !elem.getElementsByTagName)
2572
- return;
2573
- const scripts = elem.getElementsByTagName("script");
2574
- for (let i = 0; i < scripts.length; i++) {
2575
- const script = scripts[i];
2576
- if (script.src && !scriptsInserted().includes(script.src)) {
2577
- scriptsInserted().push(script.src);
2578
- const newScript = document.createElement("script");
2579
- newScript.async = true;
2580
- newScript.src = script.src;
2581
- document.head.appendChild(newScript);
2582
- } else if (isJsScript(script) && !scriptsRun().includes(script.innerText)) {
2583
- try {
2584
- scriptsRun().push(script.innerText);
2585
- new Function(script.innerText)();
2586
- } catch (error2) {
2587
- console.warn("`Embed`: Error running script:", error2);
2588
- }
2589
- }
2590
- }
2591
- }
2592
- let elem;
2593
- function onUpdateFn_0() {
2594
- if (elem && !ranInitFn()) {
2595
- setRanInitFn(true);
2596
- findAndRunScripts();
2597
- }
2598
- }
2599
- createEffect(on(() => [elem, ranInitFn()], onUpdateFn_0));
2600
- return (() => {
2601
- const _el$ = _tmpl$7();
2602
- const _ref$ = elem;
2603
- typeof _ref$ === "function" ? use(_ref$, _el$) : elem = _el$;
2604
- effect(() => _el$.innerHTML = props.content);
2605
- return _el$;
2606
- })();
2607
- }
2608
- var embed_default = Embed;
2609
-
2610
2446
  // src/blocks/fragment/component-info.ts
2611
- var componentInfo5 = {
2447
+ var componentInfo3 = {
2612
2448
  name: "Fragment",
2613
2449
  static: true,
2614
2450
  hidden: true,
@@ -2617,7 +2453,7 @@ var componentInfo5 = {
2617
2453
  };
2618
2454
 
2619
2455
  // src/blocks/image/component-info.ts
2620
- var componentInfo6 = {
2456
+ var componentInfo4 = {
2621
2457
  name: "Image",
2622
2458
  static: true,
2623
2459
  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",
@@ -2719,28 +2555,1097 @@ var componentInfo6 = {
2719
2555
  }, {
2720
2556
  name: "srcset",
2721
2557
  type: "string",
2722
- hideFromUI: true
2558
+ hideFromUI: true
2559
+ }, {
2560
+ name: "lazy",
2561
+ type: "boolean",
2562
+ defaultValue: true,
2563
+ hideFromUI: true
2564
+ }, {
2565
+ name: "fitContent",
2566
+ type: "boolean",
2567
+ helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
2568
+ defaultValue: true
2569
+ }, {
2570
+ name: "aspectRatio",
2571
+ type: "number",
2572
+ 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",
2573
+ advanced: true,
2574
+ defaultValue: 0.7041
2575
+ }]
2576
+ };
2577
+
2578
+ // src/blocks/section/component-info.ts
2579
+ var componentInfo5 = {
2580
+ name: "Core:Section",
2581
+ static: true,
2582
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
2583
+ inputs: [{
2584
+ name: "maxWidth",
2585
+ type: "number",
2586
+ defaultValue: 1200
2587
+ }, {
2588
+ name: "lazyLoad",
2589
+ type: "boolean",
2590
+ defaultValue: false,
2591
+ advanced: true,
2592
+ description: "Only render this section when in view"
2593
+ }],
2594
+ defaultStyles: {
2595
+ paddingLeft: "20px",
2596
+ paddingRight: "20px",
2597
+ paddingTop: "50px",
2598
+ paddingBottom: "50px",
2599
+ marginTop: "0px",
2600
+ width: "100vw",
2601
+ marginLeft: "calc(50% - 50vw)"
2602
+ },
2603
+ canHaveChildren: true,
2604
+ defaultChildren: [{
2605
+ "@type": "@builder.io/sdk:Element",
2606
+ responsiveStyles: {
2607
+ large: {
2608
+ textAlign: "center"
2609
+ }
2610
+ },
2611
+ component: {
2612
+ name: "Text",
2613
+ options: {
2614
+ 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>"
2615
+ }
2616
+ }
2617
+ }]
2618
+ };
2619
+
2620
+ // src/blocks/slot/component-info.ts
2621
+ var componentInfo6 = {
2622
+ name: "Slot",
2623
+ isRSC: true,
2624
+ description: "Allow child blocks to be inserted into this content when used as a Symbol",
2625
+ docsLink: "https://www.builder.io/c/docs/symbols-with-blocks",
2626
+ image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",
2627
+ // Maybe wrap this for canHaveChildren so bind children to this hm
2628
+ inputs: [{
2629
+ name: "name",
2630
+ type: "string",
2631
+ required: true,
2632
+ defaultValue: "children"
2633
+ }]
2634
+ };
2635
+ var _tmpl$6 = /* @__PURE__ */ template(`<div>`);
2636
+ function Slot(props) {
2637
+ return (() => {
2638
+ const _el$ = _tmpl$6();
2639
+ _el$.style.setProperty("pointer-events", "auto");
2640
+ spread(_el$, mergeProps(() => !props.builderContext.context?.symbolId && {
2641
+ "builder-slot": props.name
2642
+ }), false, true);
2643
+ insert(_el$, createComponent(blocks_default, {
2644
+ get parent() {
2645
+ return props.builderContext.context?.symbolId;
2646
+ },
2647
+ get path() {
2648
+ return `symbol.data.${props.name}`;
2649
+ },
2650
+ get context() {
2651
+ return props.builderContext;
2652
+ },
2653
+ get blocks() {
2654
+ return props.builderContext.rootState?.[props.name];
2655
+ }
2656
+ }));
2657
+ return _el$;
2658
+ })();
2659
+ }
2660
+ var slot_default = Slot;
2661
+
2662
+ // src/blocks/symbol/component-info.ts
2663
+ var componentInfo7 = {
2664
+ name: "Symbol",
2665
+ noWrap: true,
2666
+ static: true,
2667
+ isRSC: true,
2668
+ inputs: [{
2669
+ name: "symbol",
2670
+ type: "uiSymbol"
2671
+ }, {
2672
+ name: "dataOnly",
2673
+ helperText: "Make this a data symbol that doesn't display any UI",
2674
+ type: "boolean",
2675
+ defaultValue: false,
2676
+ advanced: true,
2677
+ hideFromUI: true
2678
+ }, {
2679
+ name: "inheritState",
2680
+ helperText: "Inherit the parent component state and data",
2681
+ type: "boolean",
2682
+ defaultValue: false,
2683
+ advanced: true
2684
+ }, {
2685
+ name: "renderToLiquid",
2686
+ helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
2687
+ type: "boolean",
2688
+ defaultValue: false,
2689
+ advanced: true,
2690
+ hideFromUI: true
2691
+ }, {
2692
+ name: "useChildren",
2693
+ hideFromUI: true,
2694
+ type: "boolean"
2695
+ }]
2696
+ };
2697
+
2698
+ // src/blocks/text/component-info.ts
2699
+ var componentInfo8 = {
2700
+ name: "Text",
2701
+ static: true,
2702
+ isRSC: true,
2703
+ 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",
2704
+ inputs: [{
2705
+ name: "text",
2706
+ type: "html",
2707
+ required: true,
2708
+ autoFocus: true,
2709
+ bubble: true,
2710
+ defaultValue: "Enter some text..."
2711
+ }],
2712
+ defaultStyles: {
2713
+ lineHeight: "normal",
2714
+ height: "auto",
2715
+ textAlign: "center"
2716
+ }
2717
+ };
2718
+ var _tmpl$7 = /* @__PURE__ */ template(`<div class=builder-text>`);
2719
+ function Text(props) {
2720
+ return (() => {
2721
+ const _el$ = _tmpl$7();
2722
+ _el$.style.setProperty("outline", "none");
2723
+ effect(() => _el$.innerHTML = props.text?.toString() || "");
2724
+ return _el$;
2725
+ })();
2726
+ }
2727
+ var text_default = Text;
2728
+
2729
+ // src/blocks/custom-code/component-info.ts
2730
+ var componentInfo9 = {
2731
+ name: "Custom Code",
2732
+ static: true,
2733
+ requiredPermissions: ["editCode"],
2734
+ inputs: [{
2735
+ name: "code",
2736
+ type: "html",
2737
+ required: true,
2738
+ defaultValue: "<p>Hello there, I am custom HTML code!</p>",
2739
+ code: true
2740
+ }, {
2741
+ name: "replaceNodes",
2742
+ type: "boolean",
2743
+ helperText: "Preserve server rendered dom nodes",
2744
+ advanced: true
2745
+ }, {
2746
+ name: "scriptsClientOnly",
2747
+ type: "boolean",
2748
+ defaultValue: false,
2749
+ helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
2750
+ advanced: true
2751
+ }]
2752
+ };
2753
+ var _tmpl$8 = /* @__PURE__ */ template(`<div>`);
2754
+ function CustomCode(props) {
2755
+ const [scriptsInserted, setScriptsInserted] = createSignal([]);
2756
+ const [scriptsRun, setScriptsRun] = createSignal([]);
2757
+ let elementRef;
2758
+ onMount(() => {
2759
+ if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
2760
+ return;
2761
+ }
2762
+ const scripts = elementRef.getElementsByTagName("script");
2763
+ for (let i = 0; i < scripts.length; i++) {
2764
+ const script = scripts[i];
2765
+ if (script.src) {
2766
+ if (scriptsInserted().includes(script.src)) {
2767
+ continue;
2768
+ }
2769
+ scriptsInserted().push(script.src);
2770
+ const newScript = document.createElement("script");
2771
+ newScript.async = true;
2772
+ newScript.src = script.src;
2773
+ document.head.appendChild(newScript);
2774
+ } else if (!script.type || ["text/javascript", "application/javascript", "application/ecmascript"].includes(script.type)) {
2775
+ if (scriptsRun().includes(script.innerText)) {
2776
+ continue;
2777
+ }
2778
+ try {
2779
+ scriptsRun().push(script.innerText);
2780
+ new Function(script.innerText)();
2781
+ } catch (error2) {
2782
+ console.warn("`CustomCode`: Error running script:", error2);
2783
+ }
2784
+ }
2785
+ }
2786
+ });
2787
+ return (() => {
2788
+ const _el$ = _tmpl$8();
2789
+ const _ref$ = elementRef;
2790
+ typeof _ref$ === "function" ? use(_ref$, _el$) : elementRef = _el$;
2791
+ effect((_p$) => {
2792
+ const _v$ = "builder-custom-code" + (props.replaceNodes ? " replace-nodes" : ""), _v$2 = props.code;
2793
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
2794
+ _v$2 !== _p$._v$2 && (_el$.innerHTML = _p$._v$2 = _v$2);
2795
+ return _p$;
2796
+ }, {
2797
+ _v$: void 0,
2798
+ _v$2: void 0
2799
+ });
2800
+ return _el$;
2801
+ })();
2802
+ }
2803
+ var custom_code_default = CustomCode;
2804
+
2805
+ // src/blocks/embed/component-info.ts
2806
+ var componentInfo10 = {
2807
+ name: "Embed",
2808
+ static: true,
2809
+ inputs: [{
2810
+ name: "url",
2811
+ type: "url",
2812
+ required: true,
2813
+ defaultValue: "",
2814
+ helperText: "e.g. enter a youtube url, google map, etc",
2815
+ onChange: (options) => {
2816
+ const url = options.get("url");
2817
+ if (url) {
2818
+ options.set("content", "Loading...");
2819
+ const apiKey = "ae0e60e78201a3f2b0de4b";
2820
+ return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
2821
+ if (options.get("url") === url) {
2822
+ if (data.html) {
2823
+ options.set("content", data.html);
2824
+ } else {
2825
+ options.set("content", "Invalid url, please try another");
2826
+ }
2827
+ }
2828
+ }).catch((_err) => {
2829
+ options.set("content", "There was an error embedding this URL, please try again or another URL");
2830
+ });
2831
+ } else {
2832
+ options.delete("content");
2833
+ }
2834
+ }
2835
+ }, {
2836
+ name: "content",
2837
+ type: "html",
2838
+ defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
2839
+ hideFromUI: true
2840
+ }]
2841
+ };
2842
+
2843
+ // src/blocks/embed/helpers.ts
2844
+ var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
2845
+ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
2846
+
2847
+ // src/blocks/embed/embed.tsx
2848
+ var _tmpl$9 = /* @__PURE__ */ template(`<div class=builder-embed>`);
2849
+ function Embed(props) {
2850
+ const [scriptsInserted, setScriptsInserted] = createSignal([]);
2851
+ const [scriptsRun, setScriptsRun] = createSignal([]);
2852
+ const [ranInitFn, setRanInitFn] = createSignal(false);
2853
+ function findAndRunScripts() {
2854
+ if (!elem || !elem.getElementsByTagName)
2855
+ return;
2856
+ const scripts = elem.getElementsByTagName("script");
2857
+ for (let i = 0; i < scripts.length; i++) {
2858
+ const script = scripts[i];
2859
+ if (script.src && !scriptsInserted().includes(script.src)) {
2860
+ scriptsInserted().push(script.src);
2861
+ const newScript = document.createElement("script");
2862
+ newScript.async = true;
2863
+ newScript.src = script.src;
2864
+ document.head.appendChild(newScript);
2865
+ } else if (isJsScript(script) && !scriptsRun().includes(script.innerText)) {
2866
+ try {
2867
+ scriptsRun().push(script.innerText);
2868
+ new Function(script.innerText)();
2869
+ } catch (error2) {
2870
+ console.warn("`Embed`: Error running script:", error2);
2871
+ }
2872
+ }
2873
+ }
2874
+ }
2875
+ let elem;
2876
+ function onUpdateFn_0() {
2877
+ if (elem && !ranInitFn()) {
2878
+ setRanInitFn(true);
2879
+ findAndRunScripts();
2880
+ }
2881
+ }
2882
+ createEffect(on(() => [elem, ranInitFn()], onUpdateFn_0));
2883
+ return (() => {
2884
+ const _el$ = _tmpl$9();
2885
+ const _ref$ = elem;
2886
+ typeof _ref$ === "function" ? use(_ref$, _el$) : elem = _el$;
2887
+ effect(() => _el$.innerHTML = props.content);
2888
+ return _el$;
2889
+ })();
2890
+ }
2891
+ var embed_default = Embed;
2892
+
2893
+ // src/blocks/form/form/component-info.ts
2894
+ var componentInfo11 = {
2895
+ name: "Form:Form",
2896
+ // editableTags: ['builder-form-error']
2897
+ defaults: {
2898
+ responsiveStyles: {
2899
+ large: {
2900
+ marginTop: "15px",
2901
+ paddingBottom: "15px"
2902
+ }
2903
+ }
2904
+ },
2905
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fef36d2a846134910b64b88e6d18c5ca5",
2906
+ inputs: [{
2907
+ name: "sendSubmissionsTo",
2908
+ type: "string",
2909
+ // TODO: save to builder data and user can download as csv
2910
+ // TODO: easy for mode too or computed add/remove fields form mode
2911
+ // so you can edit details and high level mode at same time...
2912
+ // Later - more integrations like mailchimp
2913
+ // /api/v1/form-submit?to=mailchimp
2914
+ enum: [{
2915
+ label: "Send to email",
2916
+ value: "email",
2917
+ helperText: "Send form submissions to the email address of your choosing"
2918
+ }, {
2919
+ label: "Custom",
2920
+ value: "custom",
2921
+ helperText: "Handle where the form requests go manually with a little code, e.g. to your own custom backend"
2922
+ }],
2923
+ defaultValue: "email"
2924
+ }, {
2925
+ name: "sendSubmissionsToEmail",
2926
+ type: "string",
2927
+ required: true,
2928
+ // TODO: required: () => options.get("sendSubmissionsTo") === "email"
2929
+ defaultValue: "your@email.com",
2930
+ showIf: 'options.get("sendSubmissionsTo") === "email"'
2931
+ }, {
2932
+ name: "sendWithJs",
2933
+ type: "boolean",
2934
+ helperText: "Set to false to use basic html form action",
2935
+ defaultValue: true,
2936
+ showIf: 'options.get("sendSubmissionsTo") === "custom"'
2937
+ }, {
2938
+ name: "name",
2939
+ type: "string",
2940
+ defaultValue: "My form"
2941
+ // advanced: true
2942
+ }, {
2943
+ name: "action",
2944
+ type: "string",
2945
+ helperText: "URL to send the form data to",
2946
+ showIf: 'options.get("sendSubmissionsTo") === "custom"'
2947
+ }, {
2948
+ name: "contentType",
2949
+ type: "string",
2950
+ defaultValue: "application/json",
2951
+ advanced: true,
2952
+ // TODO: do automatically if file input
2953
+ enum: ["application/json", "multipart/form-data", "application/x-www-form-urlencoded"],
2954
+ showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
2955
+ }, {
2956
+ name: "method",
2957
+ type: "string",
2958
+ showIf: 'options.get("sendSubmissionsTo") === "custom"',
2959
+ defaultValue: "POST",
2960
+ advanced: true
2961
+ }, {
2962
+ name: "previewState",
2963
+ type: "string",
2964
+ // TODO: persist: false flag
2965
+ enum: ["unsubmitted", "sending", "success", "error"],
2966
+ defaultValue: "unsubmitted",
2967
+ helperText: 'Choose a state to edit, e.g. choose "success" to show what users see on success and edit the message',
2968
+ showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
2969
+ }, {
2970
+ name: "successUrl",
2971
+ type: "url",
2972
+ helperText: "Optional URL to redirect the user to on form submission success",
2973
+ showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
2974
+ }, {
2975
+ name: "resetFormOnSubmit",
2976
+ type: "boolean",
2977
+ showIf: "options.get('sendSubmissionsTo') === 'custom' && options.get('sendWithJs') === true",
2978
+ advanced: true
2979
+ }, {
2980
+ name: "successMessage",
2981
+ type: "uiBlocks",
2982
+ hideFromUI: true,
2983
+ defaultValue: [{
2984
+ "@type": "@builder.io/sdk:Element",
2985
+ responsiveStyles: {
2986
+ large: {
2987
+ marginTop: "10px"
2988
+ }
2989
+ },
2990
+ component: {
2991
+ name: "Text",
2992
+ options: {
2993
+ text: "<span>Thanks!</span>"
2994
+ }
2995
+ }
2996
+ }]
2997
+ }, {
2998
+ name: "validate",
2999
+ type: "boolean",
3000
+ defaultValue: true,
3001
+ advanced: true
3002
+ }, {
3003
+ name: "errorMessagePath",
3004
+ type: "text",
3005
+ advanced: true,
3006
+ 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" }}'
3007
+ }, {
3008
+ name: "errorMessage",
3009
+ type: "uiBlocks",
3010
+ hideFromUI: true,
3011
+ defaultValue: [{
3012
+ "@type": "@builder.io/sdk:Element",
3013
+ responsiveStyles: {
3014
+ large: {
3015
+ marginTop: "10px"
3016
+ }
3017
+ },
3018
+ bindings: {
3019
+ "component.options.text": "state.formErrorMessage || block.component.options.text"
3020
+ },
3021
+ component: {
3022
+ name: "Text",
3023
+ options: {
3024
+ text: "<span>Form submission error :( Please check your answers and try again</span>"
3025
+ }
3026
+ }
3027
+ }]
3028
+ }, {
3029
+ name: "sendingMessage",
3030
+ type: "uiBlocks",
3031
+ hideFromUI: true,
3032
+ defaultValue: [{
3033
+ "@type": "@builder.io/sdk:Element",
3034
+ responsiveStyles: {
3035
+ large: {
3036
+ marginTop: "10px"
3037
+ }
3038
+ },
3039
+ component: {
3040
+ name: "Text",
3041
+ options: {
3042
+ text: "<span>Sending...</span>"
3043
+ }
3044
+ }
3045
+ }]
3046
+ }, {
3047
+ name: "customHeaders",
3048
+ type: "map",
3049
+ valueType: {
3050
+ type: "string"
3051
+ },
3052
+ advanced: true,
3053
+ showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
3054
+ }],
3055
+ noWrap: true,
3056
+ canHaveChildren: true,
3057
+ defaultChildren: [{
3058
+ "@type": "@builder.io/sdk:Element",
3059
+ responsiveStyles: {
3060
+ large: {
3061
+ marginTop: "10px"
3062
+ }
3063
+ },
3064
+ component: {
3065
+ name: "Text",
3066
+ options: {
3067
+ text: "<span>Enter your name</span>"
3068
+ }
3069
+ }
3070
+ }, {
3071
+ "@type": "@builder.io/sdk:Element",
3072
+ responsiveStyles: {
3073
+ large: {
3074
+ marginTop: "10px"
3075
+ }
3076
+ },
3077
+ component: {
3078
+ name: "Form:Input",
3079
+ options: {
3080
+ name: "name",
3081
+ placeholder: "Jane Doe"
3082
+ }
3083
+ }
3084
+ }, {
3085
+ "@type": "@builder.io/sdk:Element",
3086
+ responsiveStyles: {
3087
+ large: {
3088
+ marginTop: "10px"
3089
+ }
3090
+ },
3091
+ component: {
3092
+ name: "Text",
3093
+ options: {
3094
+ text: "<span>Enter your email</span>"
3095
+ }
3096
+ }
3097
+ }, {
3098
+ "@type": "@builder.io/sdk:Element",
3099
+ responsiveStyles: {
3100
+ large: {
3101
+ marginTop: "10px"
3102
+ }
3103
+ },
3104
+ component: {
3105
+ name: "Form:Input",
3106
+ options: {
3107
+ name: "email",
3108
+ placeholder: "jane@doe.com"
3109
+ }
3110
+ }
3111
+ }, {
3112
+ "@type": "@builder.io/sdk:Element",
3113
+ responsiveStyles: {
3114
+ large: {
3115
+ marginTop: "10px"
3116
+ }
3117
+ },
3118
+ component: {
3119
+ name: "Form:SubmitButton",
3120
+ options: {
3121
+ text: "Submit"
3122
+ }
3123
+ }
3124
+ }]
3125
+ };
3126
+
3127
+ // src/functions/get-env.ts
3128
+ var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
3129
+ var getEnv = () => {
3130
+ const env = "development";
3131
+ return validEnvList.includes(env) ? env : "production";
3132
+ };
3133
+
3134
+ // src/functions/get.ts
3135
+ var get = (obj, path, defaultValue) => {
3136
+ const result = String.prototype.split.call(path, /[,[\].]+?/).filter(Boolean).reduce((res, key) => res !== null && res !== void 0 ? res[key] : res, obj);
3137
+ return result === void 0 || result === obj ? defaultValue : result;
3138
+ };
3139
+
3140
+ // src/blocks/form/form/form.tsx
3141
+ var _tmpl$10 = /* @__PURE__ */ template(`<pre>`);
3142
+ var _tmpl$23 = /* @__PURE__ */ template(`<form>`);
3143
+ function FormComponent(props) {
3144
+ const [formState, setFormState] = createSignal("unsubmitted");
3145
+ const [responseData, setResponseData] = createSignal(null);
3146
+ const [formErrorMessage, setFormErrorMessage] = createSignal("");
3147
+ function mergeNewRootState(newData) {
3148
+ const combinedState = {
3149
+ ...props.builderContext.rootState,
3150
+ ...newData
3151
+ };
3152
+ if (props.builderContext.rootSetState) {
3153
+ props.builderContext.rootSetState?.(combinedState);
3154
+ } else {
3155
+ props.builderContext.rootState = combinedState;
3156
+ }
3157
+ }
3158
+ function submissionState() {
3159
+ return isEditing() && props.previewState || formState();
3160
+ }
3161
+ function onSubmit(event) {
3162
+ const sendWithJsProp = props.sendWithJs || props.sendSubmissionsTo === "email";
3163
+ if (props.sendSubmissionsTo === "zapier") {
3164
+ event.preventDefault();
3165
+ } else if (sendWithJsProp) {
3166
+ if (!(props.action || props.sendSubmissionsTo === "email")) {
3167
+ event.preventDefault();
3168
+ return;
3169
+ }
3170
+ event.preventDefault();
3171
+ const el = event.currentTarget;
3172
+ const headers = props.customHeaders || {};
3173
+ let body;
3174
+ const formData = new FormData(el);
3175
+ const formPairs = Array.from(event.currentTarget.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
3176
+ let value;
3177
+ const key = el2.name;
3178
+ if (el2 instanceof HTMLInputElement) {
3179
+ if (el2.type === "radio") {
3180
+ if (el2.checked) {
3181
+ value = el2.name;
3182
+ return {
3183
+ key,
3184
+ value
3185
+ };
3186
+ }
3187
+ } else if (el2.type === "checkbox") {
3188
+ value = el2.checked;
3189
+ } else if (el2.type === "number" || el2.type === "range") {
3190
+ const num = el2.valueAsNumber;
3191
+ if (!isNaN(num)) {
3192
+ value = num;
3193
+ }
3194
+ } else if (el2.type === "file") {
3195
+ value = el2.files;
3196
+ } else {
3197
+ value = el2.value;
3198
+ }
3199
+ } else {
3200
+ value = el2.value;
3201
+ }
3202
+ return {
3203
+ key,
3204
+ value
3205
+ };
3206
+ });
3207
+ let formContentType = props.contentType;
3208
+ if (props.sendSubmissionsTo === "email") {
3209
+ formContentType = "multipart/form-data";
3210
+ }
3211
+ Array.from(formPairs).forEach(({
3212
+ value
3213
+ }) => {
3214
+ if (value instanceof File || Array.isArray(value) && value[0] instanceof File || value instanceof FileList) {
3215
+ formContentType = "multipart/form-data";
3216
+ }
3217
+ });
3218
+ if (formContentType !== "application/json") {
3219
+ body = formData;
3220
+ } else {
3221
+ const json = {};
3222
+ Array.from(formPairs).forEach(({
3223
+ value,
3224
+ key
3225
+ }) => {
3226
+ set(json, key, value);
3227
+ });
3228
+ body = JSON.stringify(json);
3229
+ }
3230
+ if (formContentType && formContentType !== "multipart/form-data") {
3231
+ if (
3232
+ /* Zapier doesn't allow content-type header to be sent from browsers */
3233
+ !(sendWithJsProp && props.action?.includes("zapier.com"))
3234
+ ) {
3235
+ headers["content-type"] = formContentType;
3236
+ }
3237
+ }
3238
+ const presubmitEvent = new CustomEvent("presubmit", {
3239
+ detail: {
3240
+ body
3241
+ }
3242
+ });
3243
+ if (formRef) {
3244
+ formRef.dispatchEvent(presubmitEvent);
3245
+ if (presubmitEvent.defaultPrevented) {
3246
+ return;
3247
+ }
3248
+ }
3249
+ setFormState("sending");
3250
+ 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 || "")}`;
3251
+ fetch(props.sendSubmissionsTo === "email" ? formUrl : props.action, {
3252
+ body,
3253
+ headers,
3254
+ method: props.method || "post"
3255
+ }).then(async (res) => {
3256
+ let body2;
3257
+ const contentType = res.headers.get("content-type");
3258
+ if (contentType && contentType.indexOf("application/json") !== -1) {
3259
+ body2 = await res.json();
3260
+ } else {
3261
+ body2 = await res.text();
3262
+ }
3263
+ if (!res.ok && props.errorMessagePath) {
3264
+ let message = get(body2, props.errorMessagePath);
3265
+ if (message) {
3266
+ if (typeof message !== "string") {
3267
+ message = JSON.stringify(message);
3268
+ }
3269
+ setFormErrorMessage(message);
3270
+ mergeNewRootState({
3271
+ formErrorMessage: message
3272
+ });
3273
+ }
3274
+ }
3275
+ setResponseData(body2);
3276
+ setFormState(res.ok ? "success" : "error");
3277
+ if (res.ok) {
3278
+ const submitSuccessEvent = new CustomEvent("submit:success", {
3279
+ detail: {
3280
+ res,
3281
+ body: body2
3282
+ }
3283
+ });
3284
+ if (formRef) {
3285
+ formRef.dispatchEvent(submitSuccessEvent);
3286
+ if (submitSuccessEvent.defaultPrevented) {
3287
+ return;
3288
+ }
3289
+ if (props.resetFormOnSubmit !== false) {
3290
+ formRef.reset();
3291
+ }
3292
+ }
3293
+ if (props.successUrl) {
3294
+ if (formRef) {
3295
+ const event2 = new CustomEvent("route", {
3296
+ detail: {
3297
+ url: props.successUrl
3298
+ }
3299
+ });
3300
+ formRef.dispatchEvent(event2);
3301
+ if (!event2.defaultPrevented) {
3302
+ location.href = props.successUrl;
3303
+ }
3304
+ } else {
3305
+ location.href = props.successUrl;
3306
+ }
3307
+ }
3308
+ }
3309
+ }, (err) => {
3310
+ const submitErrorEvent = new CustomEvent("submit:error", {
3311
+ detail: {
3312
+ error: err
3313
+ }
3314
+ });
3315
+ if (formRef) {
3316
+ formRef.dispatchEvent(submitErrorEvent);
3317
+ if (submitErrorEvent.defaultPrevented) {
3318
+ return;
3319
+ }
3320
+ }
3321
+ setResponseData(err);
3322
+ setFormState("error");
3323
+ });
3324
+ }
3325
+ }
3326
+ let formRef;
3327
+ return (() => {
3328
+ const _el$ = _tmpl$23();
3329
+ _el$.addEventListener("submit", (event) => onSubmit(event));
3330
+ const _ref$ = formRef;
3331
+ typeof _ref$ === "function" ? use(_ref$, _el$) : formRef = _el$;
3332
+ spread(_el$, mergeProps({
3333
+ get validate() {
3334
+ return props.validate;
3335
+ },
3336
+ get action() {
3337
+ return !props.sendWithJs && props.action;
3338
+ },
3339
+ get method() {
3340
+ return props.method;
3341
+ },
3342
+ get name() {
3343
+ return props.name;
3344
+ }
3345
+ }, {}, () => props.attributes), false, true);
3346
+ insert(_el$, createComponent(Show, {
3347
+ get when() {
3348
+ return props.builderBlock && props.builderBlock.children;
3349
+ },
3350
+ get children() {
3351
+ return createComponent(For, {
3352
+ get each() {
3353
+ return props.builderBlock?.children;
3354
+ },
3355
+ children: (block, _index) => {
3356
+ const idx = _index();
3357
+ return createComponent(block_default, {
3358
+ key: `form-block-${idx}`,
3359
+ block,
3360
+ get context() {
3361
+ return props.builderContext;
3362
+ },
3363
+ get registeredComponents() {
3364
+ return props.builderComponents;
3365
+ },
3366
+ get linkComponent() {
3367
+ return props.builderLinkComponent;
3368
+ }
3369
+ });
3370
+ }
3371
+ });
3372
+ }
3373
+ }), null);
3374
+ insert(_el$, createComponent(Show, {
3375
+ get when() {
3376
+ return submissionState() === "error";
3377
+ },
3378
+ get children() {
3379
+ return createComponent(blocks_default, {
3380
+ path: "errorMessage",
3381
+ get blocks() {
3382
+ return props.errorMessage;
3383
+ },
3384
+ get context() {
3385
+ return props.builderContext;
3386
+ }
3387
+ });
3388
+ }
3389
+ }), null);
3390
+ insert(_el$, createComponent(Show, {
3391
+ get when() {
3392
+ return submissionState() === "sending";
3393
+ },
3394
+ get children() {
3395
+ return createComponent(blocks_default, {
3396
+ path: "sendingMessage",
3397
+ get blocks() {
3398
+ return props.sendingMessage;
3399
+ },
3400
+ get context() {
3401
+ return props.builderContext;
3402
+ }
3403
+ });
3404
+ }
3405
+ }), null);
3406
+ insert(_el$, createComponent(Show, {
3407
+ get when() {
3408
+ return memo(() => submissionState() === "error")() && responseData();
3409
+ },
3410
+ get children() {
3411
+ const _el$2 = _tmpl$10();
3412
+ insert(_el$2, () => JSON.stringify(responseData(), null, 2));
3413
+ effect(() => className(_el$2, "builder-form-error-text " + css({
3414
+ padding: "10px",
3415
+ color: "red",
3416
+ textAlign: "center"
3417
+ })));
3418
+ return _el$2;
3419
+ }
3420
+ }), null);
3421
+ insert(_el$, createComponent(Show, {
3422
+ get when() {
3423
+ return submissionState() === "success";
3424
+ },
3425
+ get children() {
3426
+ return createComponent(blocks_default, {
3427
+ path: "successMessage",
3428
+ get blocks() {
3429
+ return props.successMessage;
3430
+ },
3431
+ get context() {
3432
+ return props.builderContext;
3433
+ }
3434
+ });
3435
+ }
3436
+ }), null);
3437
+ return _el$;
3438
+ })();
3439
+ }
3440
+ var form_default = FormComponent;
3441
+
3442
+ // src/blocks/form/input/component-info.ts
3443
+ var componentInfo12 = {
3444
+ name: "Form:Input",
3445
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
3446
+ inputs: [
3447
+ {
3448
+ name: "type",
3449
+ type: "text",
3450
+ enum: ["text", "number", "email", "url", "checkbox", "radio", "range", "date", "datetime-local", "search", "tel", "time", "file", "month", "week", "password", "color", "hidden"],
3451
+ defaultValue: "text"
3452
+ },
3453
+ {
3454
+ name: "name",
3455
+ type: "string",
3456
+ required: true,
3457
+ helperText: 'Every input in a form needs a unique name describing what it takes, e.g. "email"'
3458
+ },
3459
+ {
3460
+ name: "placeholder",
3461
+ type: "string",
3462
+ defaultValue: "Hello there",
3463
+ helperText: "Text to display when there is no value"
3464
+ },
3465
+ // TODO: handle value vs default value automatically like ng-model
3466
+ {
3467
+ name: "defaultValue",
3468
+ type: "string"
3469
+ },
3470
+ {
3471
+ name: "value",
3472
+ type: "string",
3473
+ advanced: true
3474
+ },
3475
+ {
3476
+ name: "required",
3477
+ type: "boolean",
3478
+ helperText: "Is this input required to be filled out to submit a form",
3479
+ defaultValue: false
3480
+ }
3481
+ ],
3482
+ noWrap: true,
3483
+ static: true,
3484
+ defaultStyles: {
3485
+ paddingTop: "10px",
3486
+ paddingBottom: "10px",
3487
+ paddingLeft: "10px",
3488
+ paddingRight: "10px",
3489
+ borderRadius: "3px",
3490
+ borderWidth: "1px",
3491
+ borderStyle: "solid",
3492
+ borderColor: "#ccc"
3493
+ }
3494
+ };
3495
+ var _tmpl$11 = /* @__PURE__ */ template(`<input>`);
3496
+ function FormInputComponent(props) {
3497
+ return (() => {
3498
+ const _el$ = _tmpl$11();
3499
+ spread(_el$, mergeProps({}, () => props.attributes, {
3500
+ get key() {
3501
+ return isEditing() && props.defaultValue ? props.defaultValue : "default-key";
3502
+ },
3503
+ get placeholder() {
3504
+ return props.placeholder;
3505
+ },
3506
+ get type() {
3507
+ return props.type;
3508
+ },
3509
+ get name() {
3510
+ return props.name;
3511
+ },
3512
+ get value() {
3513
+ return props.value;
3514
+ },
3515
+ get defaultValue() {
3516
+ return props.defaultValue;
3517
+ },
3518
+ get required() {
3519
+ return props.required;
3520
+ }
3521
+ }), false, false);
3522
+ return _el$;
3523
+ })();
3524
+ }
3525
+ var input_default = FormInputComponent;
3526
+
3527
+ // src/blocks/form/select/component-info.ts
3528
+ var componentInfo13 = {
3529
+ name: "Form:Select",
3530
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
3531
+ defaultStyles: {
3532
+ alignSelf: "flex-start"
3533
+ },
3534
+ inputs: [{
3535
+ name: "options",
3536
+ type: "list",
3537
+ required: true,
3538
+ subFields: [{
3539
+ name: "value",
3540
+ type: "text",
3541
+ required: true
3542
+ }, {
3543
+ name: "name",
3544
+ type: "text"
3545
+ }],
3546
+ defaultValue: [{
3547
+ value: "option 1"
3548
+ }, {
3549
+ value: "option 2"
3550
+ }]
3551
+ }, {
3552
+ name: "name",
3553
+ type: "string",
3554
+ required: true,
3555
+ helperText: 'Every select in a form needs a unique name describing what it gets, e.g. "email"'
2723
3556
  }, {
2724
- name: "lazy",
2725
- type: "boolean",
2726
- defaultValue: true,
2727
- hideFromUI: true
3557
+ name: "defaultValue",
3558
+ type: "string"
2728
3559
  }, {
2729
- name: "fitContent",
2730
- type: "boolean",
2731
- helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
2732
- defaultValue: true
3560
+ name: "value",
3561
+ type: "string",
3562
+ advanced: true
2733
3563
  }, {
2734
- name: "aspectRatio",
2735
- type: "number",
2736
- 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",
2737
- advanced: true,
2738
- defaultValue: 0.7041
2739
- }]
3564
+ name: "required",
3565
+ type: "boolean",
3566
+ defaultValue: false
3567
+ }],
3568
+ static: true,
3569
+ noWrap: true
3570
+ };
3571
+ var _tmpl$12 = /* @__PURE__ */ template(`<select>`);
3572
+ var _tmpl$24 = /* @__PURE__ */ template(`<option>`);
3573
+ function SelectComponent(props) {
3574
+ return (() => {
3575
+ const _el$ = _tmpl$12();
3576
+ spread(_el$, mergeProps({}, () => props.attributes, {
3577
+ get value() {
3578
+ return props.value;
3579
+ },
3580
+ get key() {
3581
+ return isEditing() && props.defaultValue ? props.defaultValue : "default-key";
3582
+ },
3583
+ get defaultValue() {
3584
+ return props.defaultValue;
3585
+ },
3586
+ get name() {
3587
+ return props.name;
3588
+ }
3589
+ }), false, true);
3590
+ insert(_el$, createComponent(For, {
3591
+ get each() {
3592
+ return props.options;
3593
+ },
3594
+ children: (option, _index) => {
3595
+ _index();
3596
+ return (() => {
3597
+ const _el$2 = _tmpl$24();
3598
+ insert(_el$2, () => option.name || option.value);
3599
+ effect(() => _el$2.value = option.value);
3600
+ return _el$2;
3601
+ })();
3602
+ }
3603
+ }));
3604
+ return _el$;
3605
+ })();
3606
+ }
3607
+ var select_default = SelectComponent;
3608
+
3609
+ // src/blocks/form/submit-button/component-info.ts
3610
+ var componentInfo14 = {
3611
+ name: "Form:SubmitButton",
3612
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
3613
+ defaultStyles: {
3614
+ appearance: "none",
3615
+ paddingTop: "15px",
3616
+ paddingBottom: "15px",
3617
+ paddingLeft: "25px",
3618
+ paddingRight: "25px",
3619
+ backgroundColor: "#3898EC",
3620
+ color: "white",
3621
+ borderRadius: "4px",
3622
+ cursor: "pointer"
3623
+ },
3624
+ inputs: [{
3625
+ name: "text",
3626
+ type: "text",
3627
+ defaultValue: "Click me"
3628
+ }],
3629
+ static: true,
3630
+ noWrap: true
3631
+ // TODO: optional children? maybe as optional form input
3632
+ // that only shows if advanced setting is flipped
3633
+ // TODO: defaultChildren
3634
+ // canHaveChildren: true,
2740
3635
  };
3636
+ var _tmpl$13 = /* @__PURE__ */ template(`<button type=submit>`);
3637
+ function SubmitButton(props) {
3638
+ return (() => {
3639
+ const _el$ = _tmpl$13();
3640
+ spread(_el$, mergeProps({}, () => props.attributes), false, true);
3641
+ insert(_el$, () => props.text);
3642
+ return _el$;
3643
+ })();
3644
+ }
3645
+ var submit_button_default = SubmitButton;
2741
3646
 
2742
3647
  // src/blocks/img/component-info.ts
2743
- var componentInfo7 = {
3648
+ var componentInfo15 = {
2744
3649
  // friendlyName?
2745
3650
  name: "Raw:Img",
2746
3651
  hideFromInsertMenu: true,
@@ -2755,10 +3660,10 @@ var componentInfo7 = {
2755
3660
  noWrap: true,
2756
3661
  static: true
2757
3662
  };
2758
- var _tmpl$8 = /* @__PURE__ */ template(`<img>`);
3663
+ var _tmpl$14 = /* @__PURE__ */ template(`<img>`);
2759
3664
  function ImgComponent(props) {
2760
3665
  return (() => {
2761
- const _el$ = _tmpl$8();
3666
+ const _el$ = _tmpl$14();
2762
3667
  spread(_el$, mergeProps({
2763
3668
  get style() {
2764
3669
  return {
@@ -2781,159 +3686,8 @@ function ImgComponent(props) {
2781
3686
  }
2782
3687
  var img_default = ImgComponent;
2783
3688
 
2784
- // src/blocks/section/component-info.ts
2785
- var componentInfo8 = {
2786
- name: "Core:Section",
2787
- static: true,
2788
- image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
2789
- inputs: [{
2790
- name: "maxWidth",
2791
- type: "number",
2792
- defaultValue: 1200
2793
- }, {
2794
- name: "lazyLoad",
2795
- type: "boolean",
2796
- defaultValue: false,
2797
- advanced: true,
2798
- description: "Only render this section when in view"
2799
- }],
2800
- defaultStyles: {
2801
- paddingLeft: "20px",
2802
- paddingRight: "20px",
2803
- paddingTop: "50px",
2804
- paddingBottom: "50px",
2805
- marginTop: "0px",
2806
- width: "100vw",
2807
- marginLeft: "calc(50% - 50vw)"
2808
- },
2809
- canHaveChildren: true,
2810
- defaultChildren: [{
2811
- "@type": "@builder.io/sdk:Element",
2812
- responsiveStyles: {
2813
- large: {
2814
- textAlign: "center"
2815
- }
2816
- },
2817
- component: {
2818
- name: "Text",
2819
- options: {
2820
- 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>"
2821
- }
2822
- }
2823
- }]
2824
- };
2825
-
2826
- // src/blocks/slot/component-info.ts
2827
- var componentInfo9 = {
2828
- name: "Slot",
2829
- isRSC: true,
2830
- description: "Allow child blocks to be inserted into this content when used as a Symbol",
2831
- docsLink: "https://www.builder.io/c/docs/symbols-with-blocks",
2832
- image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",
2833
- // Maybe wrap this for canHaveChildren so bind children to this hm
2834
- inputs: [{
2835
- name: "name",
2836
- type: "string",
2837
- required: true,
2838
- defaultValue: "children"
2839
- }]
2840
- };
2841
- var _tmpl$9 = /* @__PURE__ */ template(`<div>`);
2842
- function Slot(props) {
2843
- return (() => {
2844
- const _el$ = _tmpl$9();
2845
- _el$.style.setProperty("pointer-events", "auto");
2846
- spread(_el$, mergeProps(() => !props.builderContext.context?.symbolId && {
2847
- "builder-slot": props.name
2848
- }), false, true);
2849
- insert(_el$, createComponent(blocks_default, {
2850
- get parent() {
2851
- return props.builderContext.context?.symbolId;
2852
- },
2853
- get path() {
2854
- return `symbol.data.${props.name}`;
2855
- },
2856
- get context() {
2857
- return props.builderContext;
2858
- },
2859
- get blocks() {
2860
- return props.builderContext.rootState?.[props.name];
2861
- }
2862
- }));
2863
- return _el$;
2864
- })();
2865
- }
2866
- var slot_default = Slot;
2867
-
2868
- // src/blocks/symbol/component-info.ts
2869
- var componentInfo10 = {
2870
- name: "Symbol",
2871
- noWrap: true,
2872
- static: true,
2873
- isRSC: true,
2874
- inputs: [{
2875
- name: "symbol",
2876
- type: "uiSymbol"
2877
- }, {
2878
- name: "dataOnly",
2879
- helperText: "Make this a data symbol that doesn't display any UI",
2880
- type: "boolean",
2881
- defaultValue: false,
2882
- advanced: true,
2883
- hideFromUI: true
2884
- }, {
2885
- name: "inheritState",
2886
- helperText: "Inherit the parent component state and data",
2887
- type: "boolean",
2888
- defaultValue: false,
2889
- advanced: true
2890
- }, {
2891
- name: "renderToLiquid",
2892
- helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
2893
- type: "boolean",
2894
- defaultValue: false,
2895
- advanced: true,
2896
- hideFromUI: true
2897
- }, {
2898
- name: "useChildren",
2899
- hideFromUI: true,
2900
- type: "boolean"
2901
- }]
2902
- };
2903
-
2904
- // src/blocks/text/component-info.ts
2905
- var componentInfo11 = {
2906
- name: "Text",
2907
- static: true,
2908
- isRSC: true,
2909
- 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",
2910
- inputs: [{
2911
- name: "text",
2912
- type: "html",
2913
- required: true,
2914
- autoFocus: true,
2915
- bubble: true,
2916
- defaultValue: "Enter some text..."
2917
- }],
2918
- defaultStyles: {
2919
- lineHeight: "normal",
2920
- height: "auto",
2921
- textAlign: "center"
2922
- }
2923
- };
2924
- var _tmpl$10 = /* @__PURE__ */ template(`<div class=builder-text>`);
2925
- function Text(props) {
2926
- return (() => {
2927
- const _el$ = _tmpl$10();
2928
- _el$.style.setProperty("outline", "none");
2929
- effect(() => _el$.innerHTML = props.text?.toString() || "");
2930
- return _el$;
2931
- })();
2932
- }
2933
- var text_default = Text;
2934
-
2935
3689
  // src/blocks/video/component-info.ts
2936
- var componentInfo12 = {
3690
+ var componentInfo16 = {
2937
3691
  name: "Video",
2938
3692
  canHaveChildren: true,
2939
3693
  defaultStyles: {
@@ -3015,8 +3769,8 @@ var componentInfo12 = {
3015
3769
  advanced: true
3016
3770
  }]
3017
3771
  };
3018
- var _tmpl$11 = /* @__PURE__ */ template(`<source type=video/mp4>`);
3019
- var _tmpl$23 = /* @__PURE__ */ template(`<div>`);
3772
+ var _tmpl$15 = /* @__PURE__ */ template(`<source type=video/mp4>`);
3773
+ var _tmpl$25 = /* @__PURE__ */ template(`<div>`);
3020
3774
  var _tmpl$33 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
3021
3775
  function Video(props) {
3022
3776
  function videoProps() {
@@ -3078,7 +3832,7 @@ function Video(props) {
3078
3832
  return !props.lazyLoad;
3079
3833
  },
3080
3834
  get children() {
3081
- const _el$3 = _tmpl$11();
3835
+ const _el$3 = _tmpl$15();
3082
3836
  effect(() => setAttribute(_el$3, "src", props.video));
3083
3837
  return _el$3;
3084
3838
  }
@@ -3088,7 +3842,7 @@ function Video(props) {
3088
3842
  return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
3089
3843
  },
3090
3844
  get children() {
3091
- const _el$4 = _tmpl$23();
3845
+ const _el$4 = _tmpl$25();
3092
3846
  _el$4.style.setProperty("width", "100%");
3093
3847
  _el$4.style.setProperty("pointer-events", "none");
3094
3848
  _el$4.style.setProperty("font-size", "0px");
@@ -3101,7 +3855,7 @@ function Video(props) {
3101
3855
  return props.builderBlock?.children?.length && props.fitContent;
3102
3856
  },
3103
3857
  get children() {
3104
- const _el$5 = _tmpl$23();
3858
+ const _el$5 = _tmpl$25();
3105
3859
  _el$5.style.setProperty("display", "flex");
3106
3860
  _el$5.style.setProperty("flex-direction", "column");
3107
3861
  _el$5.style.setProperty("align-items", "stretch");
@@ -3114,7 +3868,7 @@ function Video(props) {
3114
3868
  return props.builderBlock?.children?.length && !props.fitContent;
3115
3869
  },
3116
3870
  get children() {
3117
- const _el$6 = _tmpl$23();
3871
+ const _el$6 = _tmpl$25();
3118
3872
  _el$6.style.setProperty("pointer-events", "none");
3119
3873
  _el$6.style.setProperty("display", "flex");
3120
3874
  _el$6.style.setProperty("flex-direction", "column");
@@ -3133,6 +3887,33 @@ function Video(props) {
3133
3887
  }
3134
3888
  var video_default = Video;
3135
3889
 
3890
+ // src/constants/extra-components.ts
3891
+ var getExtraComponents = () => [{
3892
+ component: custom_code_default,
3893
+ ...componentInfo9
3894
+ }, {
3895
+ component: embed_default,
3896
+ ...componentInfo10
3897
+ }, ...TARGET === "rsc" ? [] : [{
3898
+ component: form_default,
3899
+ ...componentInfo11
3900
+ }, {
3901
+ component: input_default,
3902
+ ...componentInfo12
3903
+ }, {
3904
+ component: submit_button_default,
3905
+ ...componentInfo14
3906
+ }, {
3907
+ component: select_default,
3908
+ ...componentInfo13
3909
+ }], {
3910
+ component: img_default,
3911
+ ...componentInfo15
3912
+ }, {
3913
+ component: video_default,
3914
+ ...componentInfo16
3915
+ }];
3916
+
3136
3917
  // src/constants/builder-registered-components.ts
3137
3918
  var getDefaultRegisteredComponents = () => [{
3138
3919
  component: button_default,
@@ -3141,36 +3922,24 @@ var getDefaultRegisteredComponents = () => [{
3141
3922
  component: columns_default,
3142
3923
  ...componentInfo2
3143
3924
  }, {
3144
- component: custom_code_default,
3925
+ component: fragment_default,
3145
3926
  ...componentInfo3
3146
3927
  }, {
3147
- component: embed_default,
3928
+ component: image_default,
3148
3929
  ...componentInfo4
3149
3930
  }, {
3150
- component: fragment_default,
3931
+ component: section_default,
3151
3932
  ...componentInfo5
3152
3933
  }, {
3153
- component: image_default,
3934
+ component: slot_default,
3154
3935
  ...componentInfo6
3155
- }, {
3156
- component: img_default,
3157
- ...componentInfo7
3158
- }, {
3159
- component: section_default,
3160
- ...componentInfo8
3161
3936
  }, {
3162
3937
  component: symbol_default,
3163
- ...componentInfo10
3938
+ ...componentInfo7
3164
3939
  }, {
3165
3940
  component: text_default,
3166
- ...componentInfo11
3167
- }, {
3168
- component: video_default,
3169
- ...componentInfo12
3170
- }, {
3171
- component: slot_default,
3172
- ...componentInfo9
3173
- }];
3941
+ ...componentInfo8
3942
+ }, ...getExtraComponents()];
3174
3943
 
3175
3944
  // src/functions/register-component.ts
3176
3945
  var components = [];
@@ -3240,10 +4009,10 @@ var getUpdateVariantVisibilityScript = ({
3240
4009
  }) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
3241
4010
  "${variationId}", "${contentId}", ${isHydrationTarget}
3242
4011
  )`;
3243
- var _tmpl$12 = /* @__PURE__ */ template(`<script>`);
4012
+ var _tmpl$16 = /* @__PURE__ */ template(`<script>`);
3244
4013
  function InlinedScript(props) {
3245
4014
  return (() => {
3246
- const _el$ = _tmpl$12();
4015
+ const _el$ = _tmpl$16();
3247
4016
  effect((_p$) => {
3248
4017
  const _v$ = props.scriptStr, _v$2 = props.id || "";
3249
4018
  _v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
@@ -3750,7 +4519,7 @@ function isFromTrustedHost(trustedHosts, e) {
3750
4519
  }
3751
4520
 
3752
4521
  // src/constants/sdk-version.ts
3753
- var SDK_VERSION = "0.13.1";
4522
+ var SDK_VERSION = "0.13.3";
3754
4523
 
3755
4524
  // src/functions/register.ts
3756
4525
  var registry = {};
@@ -4753,7 +5522,7 @@ var fetchSymbolContent = async ({
4753
5522
  };
4754
5523
 
4755
5524
  // src/blocks/symbol/symbol.tsx
4756
- var _tmpl$13 = /* @__PURE__ */ template(`<div>`);
5525
+ var _tmpl$17 = /* @__PURE__ */ template(`<div>`);
4757
5526
  function Symbol(props) {
4758
5527
  const [contentToUse, setContentToUse] = createSignal(props.symbol?.content);
4759
5528
  function className() {
@@ -4779,7 +5548,7 @@ function Symbol(props) {
4779
5548
  }
4780
5549
  createEffect(on(() => [props.symbol], onUpdateFn_0));
4781
5550
  return (() => {
4782
- const _el$ = _tmpl$13();
5551
+ const _el$ = _tmpl$17();
4783
5552
  spread(_el$, mergeProps({
4784
5553
  get ["class"]() {
4785
5554
  return className();