@builder.io/sdk-solid 0.13.0 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -812,7 +812,7 @@ function BlockStyles(props) {
812
812
  }
813
813
  return true;
814
814
  }
815
- function css4() {
815
+ function css5() {
816
816
  const processedBlock = getProcessedBlock({
817
817
  block: props.block,
818
818
  localState: props.context.localState,
@@ -849,12 +849,12 @@ function BlockStyles(props) {
849
849
  }
850
850
  return createComponent(Show, {
851
851
  get when() {
852
- return memo(() => !!(TARGET !== "reactNative" && css4()))() && canShowBlock();
852
+ return memo(() => !!(TARGET !== "reactNative" && css5()))() && canShowBlock();
853
853
  },
854
854
  get children() {
855
855
  return createComponent(inlined_styles_default, {
856
856
  get styles() {
857
- return css4();
857
+ return css5();
858
858
  }
859
859
  });
860
860
  }
@@ -1189,10 +1189,10 @@ function Block(props) {
1189
1189
  componentOptions: {
1190
1190
  ...getBlockComponentOptions(processedBlock()),
1191
1191
  builderContext: props.context,
1192
- ...blockComponent()?.name === "Core:Button" || blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" ? {
1192
+ ...blockComponent()?.name === "Core:Button" || blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" || blockComponent()?.name === "Form:Form" ? {
1193
1193
  builderLinkComponent: props.linkComponent
1194
1194
  } : {},
1195
- ...blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" ? {
1195
+ ...blockComponent()?.name === "Symbol" || blockComponent()?.name === "Columns" || blockComponent()?.name === "Form:Form" ? {
1196
1196
  builderComponents: props.registeredComponents
1197
1197
  } : {}
1198
1198
  },
@@ -2319,172 +2319,8 @@ var componentInfo2 = {
2319
2319
  }]
2320
2320
  };
2321
2321
 
2322
- // src/blocks/custom-code/component-info.ts
2323
- var componentInfo3 = {
2324
- name: "Custom Code",
2325
- static: true,
2326
- requiredPermissions: ["editCode"],
2327
- inputs: [{
2328
- name: "code",
2329
- type: "html",
2330
- required: true,
2331
- defaultValue: "<p>Hello there, I am custom HTML code!</p>",
2332
- code: true
2333
- }, {
2334
- name: "replaceNodes",
2335
- type: "boolean",
2336
- helperText: "Preserve server rendered dom nodes",
2337
- advanced: true
2338
- }, {
2339
- name: "scriptsClientOnly",
2340
- type: "boolean",
2341
- defaultValue: false,
2342
- helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
2343
- advanced: true
2344
- }]
2345
- };
2346
- var _tmpl$6 = /* @__PURE__ */ template(`<div>`);
2347
- function CustomCode(props) {
2348
- const [scriptsInserted, setScriptsInserted] = createSignal([]);
2349
- const [scriptsRun, setScriptsRun] = createSignal([]);
2350
- let elementRef;
2351
- onMount(() => {
2352
- if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
2353
- return;
2354
- }
2355
- const scripts = elementRef.getElementsByTagName("script");
2356
- for (let i = 0; i < scripts.length; i++) {
2357
- const script = scripts[i];
2358
- if (script.src) {
2359
- if (scriptsInserted().includes(script.src)) {
2360
- continue;
2361
- }
2362
- scriptsInserted().push(script.src);
2363
- const newScript = document.createElement("script");
2364
- newScript.async = true;
2365
- newScript.src = script.src;
2366
- document.head.appendChild(newScript);
2367
- } else if (!script.type || ["text/javascript", "application/javascript", "application/ecmascript"].includes(script.type)) {
2368
- if (scriptsRun().includes(script.innerText)) {
2369
- continue;
2370
- }
2371
- try {
2372
- scriptsRun().push(script.innerText);
2373
- new Function(script.innerText)();
2374
- } catch (error) {
2375
- console.warn("`CustomCode`: Error running script:", error);
2376
- }
2377
- }
2378
- }
2379
- });
2380
- return (() => {
2381
- const _el$ = _tmpl$6();
2382
- const _ref$ = elementRef;
2383
- typeof _ref$ === "function" ? use(_ref$, _el$) : elementRef = _el$;
2384
- effect((_p$) => {
2385
- const _v$ = "builder-custom-code" + (props.replaceNodes ? " replace-nodes" : ""), _v$2 = props.code;
2386
- _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
2387
- _v$2 !== _p$._v$2 && (_el$.innerHTML = _p$._v$2 = _v$2);
2388
- return _p$;
2389
- }, {
2390
- _v$: void 0,
2391
- _v$2: void 0
2392
- });
2393
- return _el$;
2394
- })();
2395
- }
2396
- var custom_code_default = CustomCode;
2397
-
2398
- // src/blocks/embed/component-info.ts
2399
- var componentInfo4 = {
2400
- name: "Embed",
2401
- static: true,
2402
- inputs: [{
2403
- name: "url",
2404
- type: "url",
2405
- required: true,
2406
- defaultValue: "",
2407
- helperText: "e.g. enter a youtube url, google map, etc",
2408
- onChange: (options) => {
2409
- const url = options.get("url");
2410
- if (url) {
2411
- options.set("content", "Loading...");
2412
- const apiKey = "ae0e60e78201a3f2b0de4b";
2413
- return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
2414
- if (options.get("url") === url) {
2415
- if (data.html) {
2416
- options.set("content", data.html);
2417
- } else {
2418
- options.set("content", "Invalid url, please try another");
2419
- }
2420
- }
2421
- }).catch((_err) => {
2422
- options.set("content", "There was an error embedding this URL, please try again or another URL");
2423
- });
2424
- } else {
2425
- options.delete("content");
2426
- }
2427
- }
2428
- }, {
2429
- name: "content",
2430
- type: "html",
2431
- defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
2432
- hideFromUI: true
2433
- }]
2434
- };
2435
-
2436
- // src/blocks/embed/helpers.ts
2437
- var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
2438
- var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
2439
-
2440
- // src/blocks/embed/embed.tsx
2441
- var _tmpl$7 = /* @__PURE__ */ template(`<div class=builder-embed>`);
2442
- function Embed(props) {
2443
- const [scriptsInserted, setScriptsInserted] = createSignal([]);
2444
- const [scriptsRun, setScriptsRun] = createSignal([]);
2445
- const [ranInitFn, setRanInitFn] = createSignal(false);
2446
- function findAndRunScripts() {
2447
- if (!elem || !elem.getElementsByTagName)
2448
- return;
2449
- const scripts = elem.getElementsByTagName("script");
2450
- for (let i = 0; i < scripts.length; i++) {
2451
- const script = scripts[i];
2452
- if (script.src && !scriptsInserted().includes(script.src)) {
2453
- scriptsInserted().push(script.src);
2454
- const newScript = document.createElement("script");
2455
- newScript.async = true;
2456
- newScript.src = script.src;
2457
- document.head.appendChild(newScript);
2458
- } else if (isJsScript(script) && !scriptsRun().includes(script.innerText)) {
2459
- try {
2460
- scriptsRun().push(script.innerText);
2461
- new Function(script.innerText)();
2462
- } catch (error) {
2463
- console.warn("`Embed`: Error running script:", error);
2464
- }
2465
- }
2466
- }
2467
- }
2468
- let elem;
2469
- function onUpdateFn_0() {
2470
- if (elem && !ranInitFn()) {
2471
- setRanInitFn(true);
2472
- findAndRunScripts();
2473
- }
2474
- }
2475
- createEffect(on(() => [elem, ranInitFn()], onUpdateFn_0));
2476
- return (() => {
2477
- const _el$ = _tmpl$7();
2478
- const _ref$ = elem;
2479
- typeof _ref$ === "function" ? use(_ref$, _el$) : elem = _el$;
2480
- effect(() => _el$.innerHTML = props.content);
2481
- return _el$;
2482
- })();
2483
- }
2484
- var embed_default = Embed;
2485
-
2486
2322
  // src/blocks/fragment/component-info.ts
2487
- var componentInfo5 = {
2323
+ var componentInfo3 = {
2488
2324
  name: "Fragment",
2489
2325
  static: true,
2490
2326
  hidden: true,
@@ -2493,7 +2329,7 @@ var componentInfo5 = {
2493
2329
  };
2494
2330
 
2495
2331
  // src/blocks/image/component-info.ts
2496
- var componentInfo6 = {
2332
+ var componentInfo4 = {
2497
2333
  name: "Image",
2498
2334
  static: true,
2499
2335
  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",
@@ -2595,28 +2431,1097 @@ var componentInfo6 = {
2595
2431
  }, {
2596
2432
  name: "srcset",
2597
2433
  type: "string",
2598
- hideFromUI: true
2434
+ hideFromUI: true
2435
+ }, {
2436
+ name: "lazy",
2437
+ type: "boolean",
2438
+ defaultValue: true,
2439
+ hideFromUI: true
2440
+ }, {
2441
+ name: "fitContent",
2442
+ type: "boolean",
2443
+ helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
2444
+ defaultValue: true
2445
+ }, {
2446
+ name: "aspectRatio",
2447
+ type: "number",
2448
+ 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",
2449
+ advanced: true,
2450
+ defaultValue: 0.7041
2451
+ }]
2452
+ };
2453
+
2454
+ // src/blocks/section/component-info.ts
2455
+ var componentInfo5 = {
2456
+ name: "Core:Section",
2457
+ static: true,
2458
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
2459
+ inputs: [{
2460
+ name: "maxWidth",
2461
+ type: "number",
2462
+ defaultValue: 1200
2463
+ }, {
2464
+ name: "lazyLoad",
2465
+ type: "boolean",
2466
+ defaultValue: false,
2467
+ advanced: true,
2468
+ description: "Only render this section when in view"
2469
+ }],
2470
+ defaultStyles: {
2471
+ paddingLeft: "20px",
2472
+ paddingRight: "20px",
2473
+ paddingTop: "50px",
2474
+ paddingBottom: "50px",
2475
+ marginTop: "0px",
2476
+ width: "100vw",
2477
+ marginLeft: "calc(50% - 50vw)"
2478
+ },
2479
+ canHaveChildren: true,
2480
+ defaultChildren: [{
2481
+ "@type": "@builder.io/sdk:Element",
2482
+ responsiveStyles: {
2483
+ large: {
2484
+ textAlign: "center"
2485
+ }
2486
+ },
2487
+ component: {
2488
+ name: "Text",
2489
+ options: {
2490
+ 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>"
2491
+ }
2492
+ }
2493
+ }]
2494
+ };
2495
+
2496
+ // src/blocks/slot/component-info.ts
2497
+ var componentInfo6 = {
2498
+ name: "Slot",
2499
+ isRSC: true,
2500
+ description: "Allow child blocks to be inserted into this content when used as a Symbol",
2501
+ docsLink: "https://www.builder.io/c/docs/symbols-with-blocks",
2502
+ image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",
2503
+ // Maybe wrap this for canHaveChildren so bind children to this hm
2504
+ inputs: [{
2505
+ name: "name",
2506
+ type: "string",
2507
+ required: true,
2508
+ defaultValue: "children"
2509
+ }]
2510
+ };
2511
+ var _tmpl$6 = /* @__PURE__ */ template(`<div>`);
2512
+ function Slot(props) {
2513
+ return (() => {
2514
+ const _el$ = _tmpl$6();
2515
+ _el$.style.setProperty("pointer-events", "auto");
2516
+ spread(_el$, mergeProps(() => !props.builderContext.context?.symbolId && {
2517
+ "builder-slot": props.name
2518
+ }), false, true);
2519
+ insert(_el$, createComponent(blocks_default, {
2520
+ get parent() {
2521
+ return props.builderContext.context?.symbolId;
2522
+ },
2523
+ get path() {
2524
+ return `symbol.data.${props.name}`;
2525
+ },
2526
+ get context() {
2527
+ return props.builderContext;
2528
+ },
2529
+ get blocks() {
2530
+ return props.builderContext.rootState?.[props.name];
2531
+ }
2532
+ }));
2533
+ return _el$;
2534
+ })();
2535
+ }
2536
+ var slot_default = Slot;
2537
+
2538
+ // src/blocks/symbol/component-info.ts
2539
+ var componentInfo7 = {
2540
+ name: "Symbol",
2541
+ noWrap: true,
2542
+ static: true,
2543
+ isRSC: true,
2544
+ inputs: [{
2545
+ name: "symbol",
2546
+ type: "uiSymbol"
2547
+ }, {
2548
+ name: "dataOnly",
2549
+ helperText: "Make this a data symbol that doesn't display any UI",
2550
+ type: "boolean",
2551
+ defaultValue: false,
2552
+ advanced: true,
2553
+ hideFromUI: true
2554
+ }, {
2555
+ name: "inheritState",
2556
+ helperText: "Inherit the parent component state and data",
2557
+ type: "boolean",
2558
+ defaultValue: false,
2559
+ advanced: true
2560
+ }, {
2561
+ name: "renderToLiquid",
2562
+ helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
2563
+ type: "boolean",
2564
+ defaultValue: false,
2565
+ advanced: true,
2566
+ hideFromUI: true
2567
+ }, {
2568
+ name: "useChildren",
2569
+ hideFromUI: true,
2570
+ type: "boolean"
2571
+ }]
2572
+ };
2573
+
2574
+ // src/blocks/text/component-info.ts
2575
+ var componentInfo8 = {
2576
+ name: "Text",
2577
+ static: true,
2578
+ isRSC: true,
2579
+ 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",
2580
+ inputs: [{
2581
+ name: "text",
2582
+ type: "html",
2583
+ required: true,
2584
+ autoFocus: true,
2585
+ bubble: true,
2586
+ defaultValue: "Enter some text..."
2587
+ }],
2588
+ defaultStyles: {
2589
+ lineHeight: "normal",
2590
+ height: "auto",
2591
+ textAlign: "center"
2592
+ }
2593
+ };
2594
+ var _tmpl$7 = /* @__PURE__ */ template(`<div class=builder-text>`);
2595
+ function Text(props) {
2596
+ return (() => {
2597
+ const _el$ = _tmpl$7();
2598
+ _el$.style.setProperty("outline", "none");
2599
+ effect(() => _el$.innerHTML = props.text?.toString() || "");
2600
+ return _el$;
2601
+ })();
2602
+ }
2603
+ var text_default = Text;
2604
+
2605
+ // src/blocks/custom-code/component-info.ts
2606
+ var componentInfo9 = {
2607
+ name: "Custom Code",
2608
+ static: true,
2609
+ requiredPermissions: ["editCode"],
2610
+ inputs: [{
2611
+ name: "code",
2612
+ type: "html",
2613
+ required: true,
2614
+ defaultValue: "<p>Hello there, I am custom HTML code!</p>",
2615
+ code: true
2616
+ }, {
2617
+ name: "replaceNodes",
2618
+ type: "boolean",
2619
+ helperText: "Preserve server rendered dom nodes",
2620
+ advanced: true
2621
+ }, {
2622
+ name: "scriptsClientOnly",
2623
+ type: "boolean",
2624
+ defaultValue: false,
2625
+ helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
2626
+ advanced: true
2627
+ }]
2628
+ };
2629
+ var _tmpl$8 = /* @__PURE__ */ template(`<div>`);
2630
+ function CustomCode(props) {
2631
+ const [scriptsInserted, setScriptsInserted] = createSignal([]);
2632
+ const [scriptsRun, setScriptsRun] = createSignal([]);
2633
+ let elementRef;
2634
+ onMount(() => {
2635
+ if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
2636
+ return;
2637
+ }
2638
+ const scripts = elementRef.getElementsByTagName("script");
2639
+ for (let i = 0; i < scripts.length; i++) {
2640
+ const script = scripts[i];
2641
+ if (script.src) {
2642
+ if (scriptsInserted().includes(script.src)) {
2643
+ continue;
2644
+ }
2645
+ scriptsInserted().push(script.src);
2646
+ const newScript = document.createElement("script");
2647
+ newScript.async = true;
2648
+ newScript.src = script.src;
2649
+ document.head.appendChild(newScript);
2650
+ } else if (!script.type || ["text/javascript", "application/javascript", "application/ecmascript"].includes(script.type)) {
2651
+ if (scriptsRun().includes(script.innerText)) {
2652
+ continue;
2653
+ }
2654
+ try {
2655
+ scriptsRun().push(script.innerText);
2656
+ new Function(script.innerText)();
2657
+ } catch (error) {
2658
+ console.warn("`CustomCode`: Error running script:", error);
2659
+ }
2660
+ }
2661
+ }
2662
+ });
2663
+ return (() => {
2664
+ const _el$ = _tmpl$8();
2665
+ const _ref$ = elementRef;
2666
+ typeof _ref$ === "function" ? use(_ref$, _el$) : elementRef = _el$;
2667
+ effect((_p$) => {
2668
+ const _v$ = "builder-custom-code" + (props.replaceNodes ? " replace-nodes" : ""), _v$2 = props.code;
2669
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
2670
+ _v$2 !== _p$._v$2 && (_el$.innerHTML = _p$._v$2 = _v$2);
2671
+ return _p$;
2672
+ }, {
2673
+ _v$: void 0,
2674
+ _v$2: void 0
2675
+ });
2676
+ return _el$;
2677
+ })();
2678
+ }
2679
+ var custom_code_default = CustomCode;
2680
+
2681
+ // src/blocks/embed/component-info.ts
2682
+ var componentInfo10 = {
2683
+ name: "Embed",
2684
+ static: true,
2685
+ inputs: [{
2686
+ name: "url",
2687
+ type: "url",
2688
+ required: true,
2689
+ defaultValue: "",
2690
+ helperText: "e.g. enter a youtube url, google map, etc",
2691
+ onChange: (options) => {
2692
+ const url = options.get("url");
2693
+ if (url) {
2694
+ options.set("content", "Loading...");
2695
+ const apiKey = "ae0e60e78201a3f2b0de4b";
2696
+ return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
2697
+ if (options.get("url") === url) {
2698
+ if (data.html) {
2699
+ options.set("content", data.html);
2700
+ } else {
2701
+ options.set("content", "Invalid url, please try another");
2702
+ }
2703
+ }
2704
+ }).catch((_err) => {
2705
+ options.set("content", "There was an error embedding this URL, please try again or another URL");
2706
+ });
2707
+ } else {
2708
+ options.delete("content");
2709
+ }
2710
+ }
2711
+ }, {
2712
+ name: "content",
2713
+ type: "html",
2714
+ defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
2715
+ hideFromUI: true
2716
+ }]
2717
+ };
2718
+
2719
+ // src/blocks/embed/helpers.ts
2720
+ var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
2721
+ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
2722
+
2723
+ // src/blocks/embed/embed.tsx
2724
+ var _tmpl$9 = /* @__PURE__ */ template(`<div class=builder-embed>`);
2725
+ function Embed(props) {
2726
+ const [scriptsInserted, setScriptsInserted] = createSignal([]);
2727
+ const [scriptsRun, setScriptsRun] = createSignal([]);
2728
+ const [ranInitFn, setRanInitFn] = createSignal(false);
2729
+ function findAndRunScripts() {
2730
+ if (!elem || !elem.getElementsByTagName)
2731
+ return;
2732
+ const scripts = elem.getElementsByTagName("script");
2733
+ for (let i = 0; i < scripts.length; i++) {
2734
+ const script = scripts[i];
2735
+ if (script.src && !scriptsInserted().includes(script.src)) {
2736
+ scriptsInserted().push(script.src);
2737
+ const newScript = document.createElement("script");
2738
+ newScript.async = true;
2739
+ newScript.src = script.src;
2740
+ document.head.appendChild(newScript);
2741
+ } else if (isJsScript(script) && !scriptsRun().includes(script.innerText)) {
2742
+ try {
2743
+ scriptsRun().push(script.innerText);
2744
+ new Function(script.innerText)();
2745
+ } catch (error) {
2746
+ console.warn("`Embed`: Error running script:", error);
2747
+ }
2748
+ }
2749
+ }
2750
+ }
2751
+ let elem;
2752
+ function onUpdateFn_0() {
2753
+ if (elem && !ranInitFn()) {
2754
+ setRanInitFn(true);
2755
+ findAndRunScripts();
2756
+ }
2757
+ }
2758
+ createEffect(on(() => [elem, ranInitFn()], onUpdateFn_0));
2759
+ return (() => {
2760
+ const _el$ = _tmpl$9();
2761
+ const _ref$ = elem;
2762
+ typeof _ref$ === "function" ? use(_ref$, _el$) : elem = _el$;
2763
+ effect(() => _el$.innerHTML = props.content);
2764
+ return _el$;
2765
+ })();
2766
+ }
2767
+ var embed_default = Embed;
2768
+
2769
+ // src/blocks/form/form/component-info.ts
2770
+ var componentInfo11 = {
2771
+ name: "Form:Form",
2772
+ // editableTags: ['builder-form-error']
2773
+ defaults: {
2774
+ responsiveStyles: {
2775
+ large: {
2776
+ marginTop: "15px",
2777
+ paddingBottom: "15px"
2778
+ }
2779
+ }
2780
+ },
2781
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fef36d2a846134910b64b88e6d18c5ca5",
2782
+ inputs: [{
2783
+ name: "sendSubmissionsTo",
2784
+ type: "string",
2785
+ // TODO: save to builder data and user can download as csv
2786
+ // TODO: easy for mode too or computed add/remove fields form mode
2787
+ // so you can edit details and high level mode at same time...
2788
+ // Later - more integrations like mailchimp
2789
+ // /api/v1/form-submit?to=mailchimp
2790
+ enum: [{
2791
+ label: "Send to email",
2792
+ value: "email",
2793
+ helperText: "Send form submissions to the email address of your choosing"
2794
+ }, {
2795
+ label: "Custom",
2796
+ value: "custom",
2797
+ helperText: "Handle where the form requests go manually with a little code, e.g. to your own custom backend"
2798
+ }],
2799
+ defaultValue: "email"
2800
+ }, {
2801
+ name: "sendSubmissionsToEmail",
2802
+ type: "string",
2803
+ required: true,
2804
+ // TODO: required: () => options.get("sendSubmissionsTo") === "email"
2805
+ defaultValue: "your@email.com",
2806
+ showIf: 'options.get("sendSubmissionsTo") === "email"'
2807
+ }, {
2808
+ name: "sendWithJs",
2809
+ type: "boolean",
2810
+ helperText: "Set to false to use basic html form action",
2811
+ defaultValue: true,
2812
+ showIf: 'options.get("sendSubmissionsTo") === "custom"'
2813
+ }, {
2814
+ name: "name",
2815
+ type: "string",
2816
+ defaultValue: "My form"
2817
+ // advanced: true
2818
+ }, {
2819
+ name: "action",
2820
+ type: "string",
2821
+ helperText: "URL to send the form data to",
2822
+ showIf: 'options.get("sendSubmissionsTo") === "custom"'
2823
+ }, {
2824
+ name: "contentType",
2825
+ type: "string",
2826
+ defaultValue: "application/json",
2827
+ advanced: true,
2828
+ // TODO: do automatically if file input
2829
+ enum: ["application/json", "multipart/form-data", "application/x-www-form-urlencoded"],
2830
+ showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
2831
+ }, {
2832
+ name: "method",
2833
+ type: "string",
2834
+ showIf: 'options.get("sendSubmissionsTo") === "custom"',
2835
+ defaultValue: "POST",
2836
+ advanced: true
2837
+ }, {
2838
+ name: "previewState",
2839
+ type: "string",
2840
+ // TODO: persist: false flag
2841
+ enum: ["unsubmitted", "sending", "success", "error"],
2842
+ defaultValue: "unsubmitted",
2843
+ helperText: 'Choose a state to edit, e.g. choose "success" to show what users see on success and edit the message',
2844
+ showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
2845
+ }, {
2846
+ name: "successUrl",
2847
+ type: "url",
2848
+ helperText: "Optional URL to redirect the user to on form submission success",
2849
+ showIf: 'options.get("sendSubmissionsTo") !== "zapier" && options.get("sendWithJs") === true'
2850
+ }, {
2851
+ name: "resetFormOnSubmit",
2852
+ type: "boolean",
2853
+ showIf: "options.get('sendSubmissionsTo') === 'custom' && options.get('sendWithJs') === true",
2854
+ advanced: true
2855
+ }, {
2856
+ name: "successMessage",
2857
+ type: "uiBlocks",
2858
+ hideFromUI: true,
2859
+ defaultValue: [{
2860
+ "@type": "@builder.io/sdk:Element",
2861
+ responsiveStyles: {
2862
+ large: {
2863
+ marginTop: "10px"
2864
+ }
2865
+ },
2866
+ component: {
2867
+ name: "Text",
2868
+ options: {
2869
+ text: "<span>Thanks!</span>"
2870
+ }
2871
+ }
2872
+ }]
2873
+ }, {
2874
+ name: "validate",
2875
+ type: "boolean",
2876
+ defaultValue: true,
2877
+ advanced: true
2878
+ }, {
2879
+ name: "errorMessagePath",
2880
+ type: "text",
2881
+ advanced: true,
2882
+ 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" }}'
2883
+ }, {
2884
+ name: "errorMessage",
2885
+ type: "uiBlocks",
2886
+ hideFromUI: true,
2887
+ defaultValue: [{
2888
+ "@type": "@builder.io/sdk:Element",
2889
+ responsiveStyles: {
2890
+ large: {
2891
+ marginTop: "10px"
2892
+ }
2893
+ },
2894
+ bindings: {
2895
+ "component.options.text": "state.formErrorMessage || block.component.options.text"
2896
+ },
2897
+ component: {
2898
+ name: "Text",
2899
+ options: {
2900
+ text: "<span>Form submission error :( Please check your answers and try again</span>"
2901
+ }
2902
+ }
2903
+ }]
2904
+ }, {
2905
+ name: "sendingMessage",
2906
+ type: "uiBlocks",
2907
+ hideFromUI: true,
2908
+ defaultValue: [{
2909
+ "@type": "@builder.io/sdk:Element",
2910
+ responsiveStyles: {
2911
+ large: {
2912
+ marginTop: "10px"
2913
+ }
2914
+ },
2915
+ component: {
2916
+ name: "Text",
2917
+ options: {
2918
+ text: "<span>Sending...</span>"
2919
+ }
2920
+ }
2921
+ }]
2922
+ }, {
2923
+ name: "customHeaders",
2924
+ type: "map",
2925
+ valueType: {
2926
+ type: "string"
2927
+ },
2928
+ advanced: true,
2929
+ showIf: 'options.get("sendSubmissionsTo") === "custom" && options.get("sendWithJs") === true'
2930
+ }],
2931
+ noWrap: true,
2932
+ canHaveChildren: true,
2933
+ defaultChildren: [{
2934
+ "@type": "@builder.io/sdk:Element",
2935
+ responsiveStyles: {
2936
+ large: {
2937
+ marginTop: "10px"
2938
+ }
2939
+ },
2940
+ component: {
2941
+ name: "Text",
2942
+ options: {
2943
+ text: "<span>Enter your name</span>"
2944
+ }
2945
+ }
2946
+ }, {
2947
+ "@type": "@builder.io/sdk:Element",
2948
+ responsiveStyles: {
2949
+ large: {
2950
+ marginTop: "10px"
2951
+ }
2952
+ },
2953
+ component: {
2954
+ name: "Form:Input",
2955
+ options: {
2956
+ name: "name",
2957
+ placeholder: "Jane Doe"
2958
+ }
2959
+ }
2960
+ }, {
2961
+ "@type": "@builder.io/sdk:Element",
2962
+ responsiveStyles: {
2963
+ large: {
2964
+ marginTop: "10px"
2965
+ }
2966
+ },
2967
+ component: {
2968
+ name: "Text",
2969
+ options: {
2970
+ text: "<span>Enter your email</span>"
2971
+ }
2972
+ }
2973
+ }, {
2974
+ "@type": "@builder.io/sdk:Element",
2975
+ responsiveStyles: {
2976
+ large: {
2977
+ marginTop: "10px"
2978
+ }
2979
+ },
2980
+ component: {
2981
+ name: "Form:Input",
2982
+ options: {
2983
+ name: "email",
2984
+ placeholder: "jane@doe.com"
2985
+ }
2986
+ }
2987
+ }, {
2988
+ "@type": "@builder.io/sdk:Element",
2989
+ responsiveStyles: {
2990
+ large: {
2991
+ marginTop: "10px"
2992
+ }
2993
+ },
2994
+ component: {
2995
+ name: "Form:SubmitButton",
2996
+ options: {
2997
+ text: "Submit"
2998
+ }
2999
+ }
3000
+ }]
3001
+ };
3002
+
3003
+ // src/functions/get-env.ts
3004
+ var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
3005
+ var getEnv = () => {
3006
+ const env = "development";
3007
+ return validEnvList.includes(env) ? env : "production";
3008
+ };
3009
+
3010
+ // src/functions/get.ts
3011
+ var get = (obj, path, defaultValue) => {
3012
+ const result = String.prototype.split.call(path, /[,[\].]+?/).filter(Boolean).reduce((res, key) => res !== null && res !== void 0 ? res[key] : res, obj);
3013
+ return result === void 0 || result === obj ? defaultValue : result;
3014
+ };
3015
+
3016
+ // src/blocks/form/form/form.tsx
3017
+ var _tmpl$10 = /* @__PURE__ */ template(`<pre>`);
3018
+ var _tmpl$23 = /* @__PURE__ */ template(`<form>`);
3019
+ function FormComponent(props) {
3020
+ const [formState, setFormState] = createSignal("unsubmitted");
3021
+ const [responseData, setResponseData] = createSignal(null);
3022
+ const [formErrorMessage, setFormErrorMessage] = createSignal("");
3023
+ function mergeNewRootState(newData) {
3024
+ const combinedState = {
3025
+ ...props.builderContext.rootState,
3026
+ ...newData
3027
+ };
3028
+ if (props.builderContext.rootSetState) {
3029
+ props.builderContext.rootSetState?.(combinedState);
3030
+ } else {
3031
+ props.builderContext.rootState = combinedState;
3032
+ }
3033
+ }
3034
+ function submissionState() {
3035
+ return isEditing() && props.previewState || formState();
3036
+ }
3037
+ function onSubmit(event) {
3038
+ const sendWithJsProp = props.sendWithJs || props.sendSubmissionsTo === "email";
3039
+ if (props.sendSubmissionsTo === "zapier") {
3040
+ event.preventDefault();
3041
+ } else if (sendWithJsProp) {
3042
+ if (!(props.action || props.sendSubmissionsTo === "email")) {
3043
+ event.preventDefault();
3044
+ return;
3045
+ }
3046
+ event.preventDefault();
3047
+ const el = event.currentTarget;
3048
+ const headers = props.customHeaders || {};
3049
+ let body;
3050
+ const formData = new FormData(el);
3051
+ const formPairs = Array.from(event.currentTarget.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
3052
+ let value;
3053
+ const key = el2.name;
3054
+ if (el2 instanceof HTMLInputElement) {
3055
+ if (el2.type === "radio") {
3056
+ if (el2.checked) {
3057
+ value = el2.name;
3058
+ return {
3059
+ key,
3060
+ value
3061
+ };
3062
+ }
3063
+ } else if (el2.type === "checkbox") {
3064
+ value = el2.checked;
3065
+ } else if (el2.type === "number" || el2.type === "range") {
3066
+ const num = el2.valueAsNumber;
3067
+ if (!isNaN(num)) {
3068
+ value = num;
3069
+ }
3070
+ } else if (el2.type === "file") {
3071
+ value = el2.files;
3072
+ } else {
3073
+ value = el2.value;
3074
+ }
3075
+ } else {
3076
+ value = el2.value;
3077
+ }
3078
+ return {
3079
+ key,
3080
+ value
3081
+ };
3082
+ });
3083
+ let formContentType = props.contentType;
3084
+ if (props.sendSubmissionsTo === "email") {
3085
+ formContentType = "multipart/form-data";
3086
+ }
3087
+ Array.from(formPairs).forEach(({
3088
+ value
3089
+ }) => {
3090
+ if (value instanceof File || Array.isArray(value) && value[0] instanceof File || value instanceof FileList) {
3091
+ formContentType = "multipart/form-data";
3092
+ }
3093
+ });
3094
+ if (formContentType !== "application/json") {
3095
+ body = formData;
3096
+ } else {
3097
+ const json = {};
3098
+ Array.from(formPairs).forEach(({
3099
+ value,
3100
+ key
3101
+ }) => {
3102
+ set(json, key, value);
3103
+ });
3104
+ body = JSON.stringify(json);
3105
+ }
3106
+ if (formContentType && formContentType !== "multipart/form-data") {
3107
+ if (
3108
+ /* Zapier doesn't allow content-type header to be sent from browsers */
3109
+ !(sendWithJsProp && props.action?.includes("zapier.com"))
3110
+ ) {
3111
+ headers["content-type"] = formContentType;
3112
+ }
3113
+ }
3114
+ const presubmitEvent = new CustomEvent("presubmit", {
3115
+ detail: {
3116
+ body
3117
+ }
3118
+ });
3119
+ if (formRef) {
3120
+ formRef.dispatchEvent(presubmitEvent);
3121
+ if (presubmitEvent.defaultPrevented) {
3122
+ return;
3123
+ }
3124
+ }
3125
+ setFormState("sending");
3126
+ 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 || "")}`;
3127
+ fetch(props.sendSubmissionsTo === "email" ? formUrl : props.action, {
3128
+ body,
3129
+ headers,
3130
+ method: props.method || "post"
3131
+ }).then(async (res) => {
3132
+ let body2;
3133
+ const contentType = res.headers.get("content-type");
3134
+ if (contentType && contentType.indexOf("application/json") !== -1) {
3135
+ body2 = await res.json();
3136
+ } else {
3137
+ body2 = await res.text();
3138
+ }
3139
+ if (!res.ok && props.errorMessagePath) {
3140
+ let message = get(body2, props.errorMessagePath);
3141
+ if (message) {
3142
+ if (typeof message !== "string") {
3143
+ message = JSON.stringify(message);
3144
+ }
3145
+ setFormErrorMessage(message);
3146
+ mergeNewRootState({
3147
+ formErrorMessage: message
3148
+ });
3149
+ }
3150
+ }
3151
+ setResponseData(body2);
3152
+ setFormState(res.ok ? "success" : "error");
3153
+ if (res.ok) {
3154
+ const submitSuccessEvent = new CustomEvent("submit:success", {
3155
+ detail: {
3156
+ res,
3157
+ body: body2
3158
+ }
3159
+ });
3160
+ if (formRef) {
3161
+ formRef.dispatchEvent(submitSuccessEvent);
3162
+ if (submitSuccessEvent.defaultPrevented) {
3163
+ return;
3164
+ }
3165
+ if (props.resetFormOnSubmit !== false) {
3166
+ formRef.reset();
3167
+ }
3168
+ }
3169
+ if (props.successUrl) {
3170
+ if (formRef) {
3171
+ const event2 = new CustomEvent("route", {
3172
+ detail: {
3173
+ url: props.successUrl
3174
+ }
3175
+ });
3176
+ formRef.dispatchEvent(event2);
3177
+ if (!event2.defaultPrevented) {
3178
+ location.href = props.successUrl;
3179
+ }
3180
+ } else {
3181
+ location.href = props.successUrl;
3182
+ }
3183
+ }
3184
+ }
3185
+ }, (err) => {
3186
+ const submitErrorEvent = new CustomEvent("submit:error", {
3187
+ detail: {
3188
+ error: err
3189
+ }
3190
+ });
3191
+ if (formRef) {
3192
+ formRef.dispatchEvent(submitErrorEvent);
3193
+ if (submitErrorEvent.defaultPrevented) {
3194
+ return;
3195
+ }
3196
+ }
3197
+ setResponseData(err);
3198
+ setFormState("error");
3199
+ });
3200
+ }
3201
+ }
3202
+ let formRef;
3203
+ return (() => {
3204
+ const _el$ = _tmpl$23();
3205
+ _el$.addEventListener("submit", (event) => onSubmit(event));
3206
+ const _ref$ = formRef;
3207
+ typeof _ref$ === "function" ? use(_ref$, _el$) : formRef = _el$;
3208
+ spread(_el$, mergeProps({
3209
+ get validate() {
3210
+ return props.validate;
3211
+ },
3212
+ get action() {
3213
+ return !props.sendWithJs && props.action;
3214
+ },
3215
+ get method() {
3216
+ return props.method;
3217
+ },
3218
+ get name() {
3219
+ return props.name;
3220
+ }
3221
+ }, {}, () => props.attributes), false, true);
3222
+ insert(_el$, createComponent(Show, {
3223
+ get when() {
3224
+ return props.builderBlock && props.builderBlock.children;
3225
+ },
3226
+ get children() {
3227
+ return createComponent(For, {
3228
+ get each() {
3229
+ return props.builderBlock?.children;
3230
+ },
3231
+ children: (block, _index) => {
3232
+ const idx = _index();
3233
+ return createComponent(block_default, {
3234
+ key: `form-block-${idx}`,
3235
+ block,
3236
+ get context() {
3237
+ return props.builderContext;
3238
+ },
3239
+ get registeredComponents() {
3240
+ return props.builderComponents;
3241
+ },
3242
+ get linkComponent() {
3243
+ return props.builderLinkComponent;
3244
+ }
3245
+ });
3246
+ }
3247
+ });
3248
+ }
3249
+ }), null);
3250
+ insert(_el$, createComponent(Show, {
3251
+ get when() {
3252
+ return submissionState() === "error";
3253
+ },
3254
+ get children() {
3255
+ return createComponent(blocks_default, {
3256
+ path: "errorMessage",
3257
+ get blocks() {
3258
+ return props.errorMessage;
3259
+ },
3260
+ get context() {
3261
+ return props.builderContext;
3262
+ }
3263
+ });
3264
+ }
3265
+ }), null);
3266
+ insert(_el$, createComponent(Show, {
3267
+ get when() {
3268
+ return submissionState() === "sending";
3269
+ },
3270
+ get children() {
3271
+ return createComponent(blocks_default, {
3272
+ path: "sendingMessage",
3273
+ get blocks() {
3274
+ return props.sendingMessage;
3275
+ },
3276
+ get context() {
3277
+ return props.builderContext;
3278
+ }
3279
+ });
3280
+ }
3281
+ }), null);
3282
+ insert(_el$, createComponent(Show, {
3283
+ get when() {
3284
+ return memo(() => submissionState() === "error")() && responseData();
3285
+ },
3286
+ get children() {
3287
+ const _el$2 = _tmpl$10();
3288
+ insert(_el$2, () => JSON.stringify(responseData(), null, 2));
3289
+ effect(() => className(_el$2, "builder-form-error-text " + css({
3290
+ padding: "10px",
3291
+ color: "red",
3292
+ textAlign: "center"
3293
+ })));
3294
+ return _el$2;
3295
+ }
3296
+ }), null);
3297
+ insert(_el$, createComponent(Show, {
3298
+ get when() {
3299
+ return submissionState() === "success";
3300
+ },
3301
+ get children() {
3302
+ return createComponent(blocks_default, {
3303
+ path: "successMessage",
3304
+ get blocks() {
3305
+ return props.successMessage;
3306
+ },
3307
+ get context() {
3308
+ return props.builderContext;
3309
+ }
3310
+ });
3311
+ }
3312
+ }), null);
3313
+ return _el$;
3314
+ })();
3315
+ }
3316
+ var form_default = FormComponent;
3317
+
3318
+ // src/blocks/form/input/component-info.ts
3319
+ var componentInfo12 = {
3320
+ name: "Form:Input",
3321
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
3322
+ inputs: [
3323
+ {
3324
+ name: "type",
3325
+ type: "text",
3326
+ enum: ["text", "number", "email", "url", "checkbox", "radio", "range", "date", "datetime-local", "search", "tel", "time", "file", "month", "week", "password", "color", "hidden"],
3327
+ defaultValue: "text"
3328
+ },
3329
+ {
3330
+ name: "name",
3331
+ type: "string",
3332
+ required: true,
3333
+ helperText: 'Every input in a form needs a unique name describing what it takes, e.g. "email"'
3334
+ },
3335
+ {
3336
+ name: "placeholder",
3337
+ type: "string",
3338
+ defaultValue: "Hello there",
3339
+ helperText: "Text to display when there is no value"
3340
+ },
3341
+ // TODO: handle value vs default value automatically like ng-model
3342
+ {
3343
+ name: "defaultValue",
3344
+ type: "string"
3345
+ },
3346
+ {
3347
+ name: "value",
3348
+ type: "string",
3349
+ advanced: true
3350
+ },
3351
+ {
3352
+ name: "required",
3353
+ type: "boolean",
3354
+ helperText: "Is this input required to be filled out to submit a form",
3355
+ defaultValue: false
3356
+ }
3357
+ ],
3358
+ noWrap: true,
3359
+ static: true,
3360
+ defaultStyles: {
3361
+ paddingTop: "10px",
3362
+ paddingBottom: "10px",
3363
+ paddingLeft: "10px",
3364
+ paddingRight: "10px",
3365
+ borderRadius: "3px",
3366
+ borderWidth: "1px",
3367
+ borderStyle: "solid",
3368
+ borderColor: "#ccc"
3369
+ }
3370
+ };
3371
+ var _tmpl$11 = /* @__PURE__ */ template(`<input>`);
3372
+ function FormInputComponent(props) {
3373
+ return (() => {
3374
+ const _el$ = _tmpl$11();
3375
+ spread(_el$, mergeProps({}, () => props.attributes, {
3376
+ get key() {
3377
+ return isEditing() && props.defaultValue ? props.defaultValue : "default-key";
3378
+ },
3379
+ get placeholder() {
3380
+ return props.placeholder;
3381
+ },
3382
+ get type() {
3383
+ return props.type;
3384
+ },
3385
+ get name() {
3386
+ return props.name;
3387
+ },
3388
+ get value() {
3389
+ return props.value;
3390
+ },
3391
+ get defaultValue() {
3392
+ return props.defaultValue;
3393
+ },
3394
+ get required() {
3395
+ return props.required;
3396
+ }
3397
+ }), false, false);
3398
+ return _el$;
3399
+ })();
3400
+ }
3401
+ var input_default = FormInputComponent;
3402
+
3403
+ // src/blocks/form/select/component-info.ts
3404
+ var componentInfo13 = {
3405
+ name: "Form:Select",
3406
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
3407
+ defaultStyles: {
3408
+ alignSelf: "flex-start"
3409
+ },
3410
+ inputs: [{
3411
+ name: "options",
3412
+ type: "list",
3413
+ required: true,
3414
+ subFields: [{
3415
+ name: "value",
3416
+ type: "text",
3417
+ required: true
3418
+ }, {
3419
+ name: "name",
3420
+ type: "text"
3421
+ }],
3422
+ defaultValue: [{
3423
+ value: "option 1"
3424
+ }, {
3425
+ value: "option 2"
3426
+ }]
3427
+ }, {
3428
+ name: "name",
3429
+ type: "string",
3430
+ required: true,
3431
+ helperText: 'Every select in a form needs a unique name describing what it gets, e.g. "email"'
2599
3432
  }, {
2600
- name: "lazy",
2601
- type: "boolean",
2602
- defaultValue: true,
2603
- hideFromUI: true
3433
+ name: "defaultValue",
3434
+ type: "string"
2604
3435
  }, {
2605
- name: "fitContent",
2606
- type: "boolean",
2607
- helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
2608
- defaultValue: true
3436
+ name: "value",
3437
+ type: "string",
3438
+ advanced: true
2609
3439
  }, {
2610
- name: "aspectRatio",
2611
- type: "number",
2612
- 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",
2613
- advanced: true,
2614
- defaultValue: 0.7041
2615
- }]
3440
+ name: "required",
3441
+ type: "boolean",
3442
+ defaultValue: false
3443
+ }],
3444
+ static: true,
3445
+ noWrap: true
3446
+ };
3447
+ var _tmpl$12 = /* @__PURE__ */ template(`<select>`);
3448
+ var _tmpl$24 = /* @__PURE__ */ template(`<option>`);
3449
+ function SelectComponent(props) {
3450
+ return (() => {
3451
+ const _el$ = _tmpl$12();
3452
+ spread(_el$, mergeProps({}, () => props.attributes, {
3453
+ get value() {
3454
+ return props.value;
3455
+ },
3456
+ get key() {
3457
+ return isEditing() && props.defaultValue ? props.defaultValue : "default-key";
3458
+ },
3459
+ get defaultValue() {
3460
+ return props.defaultValue;
3461
+ },
3462
+ get name() {
3463
+ return props.name;
3464
+ }
3465
+ }), false, true);
3466
+ insert(_el$, createComponent(For, {
3467
+ get each() {
3468
+ return props.options;
3469
+ },
3470
+ children: (option, _index) => {
3471
+ _index();
3472
+ return (() => {
3473
+ const _el$2 = _tmpl$24();
3474
+ insert(_el$2, () => option.name || option.value);
3475
+ effect(() => _el$2.value = option.value);
3476
+ return _el$2;
3477
+ })();
3478
+ }
3479
+ }));
3480
+ return _el$;
3481
+ })();
3482
+ }
3483
+ var select_default = SelectComponent;
3484
+
3485
+ // src/blocks/form/submit-button/component-info.ts
3486
+ var componentInfo14 = {
3487
+ name: "Form:SubmitButton",
3488
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
3489
+ defaultStyles: {
3490
+ appearance: "none",
3491
+ paddingTop: "15px",
3492
+ paddingBottom: "15px",
3493
+ paddingLeft: "25px",
3494
+ paddingRight: "25px",
3495
+ backgroundColor: "#3898EC",
3496
+ color: "white",
3497
+ borderRadius: "4px",
3498
+ cursor: "pointer"
3499
+ },
3500
+ inputs: [{
3501
+ name: "text",
3502
+ type: "text",
3503
+ defaultValue: "Click me"
3504
+ }],
3505
+ static: true,
3506
+ noWrap: true
3507
+ // TODO: optional children? maybe as optional form input
3508
+ // that only shows if advanced setting is flipped
3509
+ // TODO: defaultChildren
3510
+ // canHaveChildren: true,
2616
3511
  };
3512
+ var _tmpl$13 = /* @__PURE__ */ template(`<button type=submit>`);
3513
+ function SubmitButton(props) {
3514
+ return (() => {
3515
+ const _el$ = _tmpl$13();
3516
+ spread(_el$, mergeProps({}, () => props.attributes), false, true);
3517
+ insert(_el$, () => props.text);
3518
+ return _el$;
3519
+ })();
3520
+ }
3521
+ var submit_button_default = SubmitButton;
2617
3522
 
2618
3523
  // src/blocks/img/component-info.ts
2619
- var componentInfo7 = {
3524
+ var componentInfo15 = {
2620
3525
  // friendlyName?
2621
3526
  name: "Raw:Img",
2622
3527
  hideFromInsertMenu: true,
@@ -2631,10 +3536,10 @@ var componentInfo7 = {
2631
3536
  noWrap: true,
2632
3537
  static: true
2633
3538
  };
2634
- var _tmpl$8 = /* @__PURE__ */ template(`<img>`);
3539
+ var _tmpl$14 = /* @__PURE__ */ template(`<img>`);
2635
3540
  function ImgComponent(props) {
2636
3541
  return (() => {
2637
- const _el$ = _tmpl$8();
3542
+ const _el$ = _tmpl$14();
2638
3543
  spread(_el$, mergeProps({
2639
3544
  get style() {
2640
3545
  return {
@@ -2657,159 +3562,8 @@ function ImgComponent(props) {
2657
3562
  }
2658
3563
  var img_default = ImgComponent;
2659
3564
 
2660
- // src/blocks/section/component-info.ts
2661
- var componentInfo8 = {
2662
- name: "Core:Section",
2663
- static: true,
2664
- image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
2665
- inputs: [{
2666
- name: "maxWidth",
2667
- type: "number",
2668
- defaultValue: 1200
2669
- }, {
2670
- name: "lazyLoad",
2671
- type: "boolean",
2672
- defaultValue: false,
2673
- advanced: true,
2674
- description: "Only render this section when in view"
2675
- }],
2676
- defaultStyles: {
2677
- paddingLeft: "20px",
2678
- paddingRight: "20px",
2679
- paddingTop: "50px",
2680
- paddingBottom: "50px",
2681
- marginTop: "0px",
2682
- width: "100vw",
2683
- marginLeft: "calc(50% - 50vw)"
2684
- },
2685
- canHaveChildren: true,
2686
- defaultChildren: [{
2687
- "@type": "@builder.io/sdk:Element",
2688
- responsiveStyles: {
2689
- large: {
2690
- textAlign: "center"
2691
- }
2692
- },
2693
- component: {
2694
- name: "Text",
2695
- options: {
2696
- 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>"
2697
- }
2698
- }
2699
- }]
2700
- };
2701
-
2702
- // src/blocks/slot/component-info.ts
2703
- var componentInfo9 = {
2704
- name: "Slot",
2705
- isRSC: true,
2706
- description: "Allow child blocks to be inserted into this content when used as a Symbol",
2707
- docsLink: "https://www.builder.io/c/docs/symbols-with-blocks",
2708
- image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",
2709
- // Maybe wrap this for canHaveChildren so bind children to this hm
2710
- inputs: [{
2711
- name: "name",
2712
- type: "string",
2713
- required: true,
2714
- defaultValue: "children"
2715
- }]
2716
- };
2717
- var _tmpl$9 = /* @__PURE__ */ template(`<div>`);
2718
- function Slot(props) {
2719
- return (() => {
2720
- const _el$ = _tmpl$9();
2721
- _el$.style.setProperty("pointer-events", "auto");
2722
- spread(_el$, mergeProps(() => !props.builderContext.context?.symbolId && {
2723
- "builder-slot": props.name
2724
- }), false, true);
2725
- insert(_el$, createComponent(blocks_default, {
2726
- get parent() {
2727
- return props.builderContext.context?.symbolId;
2728
- },
2729
- get path() {
2730
- return `symbol.data.${props.name}`;
2731
- },
2732
- get context() {
2733
- return props.builderContext;
2734
- },
2735
- get blocks() {
2736
- return props.builderContext.rootState?.[props.name];
2737
- }
2738
- }));
2739
- return _el$;
2740
- })();
2741
- }
2742
- var slot_default = Slot;
2743
-
2744
- // src/blocks/symbol/component-info.ts
2745
- var componentInfo10 = {
2746
- name: "Symbol",
2747
- noWrap: true,
2748
- static: true,
2749
- isRSC: true,
2750
- inputs: [{
2751
- name: "symbol",
2752
- type: "uiSymbol"
2753
- }, {
2754
- name: "dataOnly",
2755
- helperText: "Make this a data symbol that doesn't display any UI",
2756
- type: "boolean",
2757
- defaultValue: false,
2758
- advanced: true,
2759
- hideFromUI: true
2760
- }, {
2761
- name: "inheritState",
2762
- helperText: "Inherit the parent component state and data",
2763
- type: "boolean",
2764
- defaultValue: false,
2765
- advanced: true
2766
- }, {
2767
- name: "renderToLiquid",
2768
- helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
2769
- type: "boolean",
2770
- defaultValue: false,
2771
- advanced: true,
2772
- hideFromUI: true
2773
- }, {
2774
- name: "useChildren",
2775
- hideFromUI: true,
2776
- type: "boolean"
2777
- }]
2778
- };
2779
-
2780
- // src/blocks/text/component-info.ts
2781
- var componentInfo11 = {
2782
- name: "Text",
2783
- static: true,
2784
- isRSC: true,
2785
- 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",
2786
- inputs: [{
2787
- name: "text",
2788
- type: "html",
2789
- required: true,
2790
- autoFocus: true,
2791
- bubble: true,
2792
- defaultValue: "Enter some text..."
2793
- }],
2794
- defaultStyles: {
2795
- lineHeight: "normal",
2796
- height: "auto",
2797
- textAlign: "center"
2798
- }
2799
- };
2800
- var _tmpl$10 = /* @__PURE__ */ template(`<div class=builder-text>`);
2801
- function Text(props) {
2802
- return (() => {
2803
- const _el$ = _tmpl$10();
2804
- _el$.style.setProperty("outline", "none");
2805
- effect(() => _el$.innerHTML = props.text?.toString() || "");
2806
- return _el$;
2807
- })();
2808
- }
2809
- var text_default = Text;
2810
-
2811
3565
  // src/blocks/video/component-info.ts
2812
- var componentInfo12 = {
3566
+ var componentInfo16 = {
2813
3567
  name: "Video",
2814
3568
  canHaveChildren: true,
2815
3569
  defaultStyles: {
@@ -2891,8 +3645,8 @@ var componentInfo12 = {
2891
3645
  advanced: true
2892
3646
  }]
2893
3647
  };
2894
- var _tmpl$11 = /* @__PURE__ */ template(`<source type=video/mp4>`);
2895
- var _tmpl$23 = /* @__PURE__ */ template(`<div>`);
3648
+ var _tmpl$15 = /* @__PURE__ */ template(`<source type=video/mp4>`);
3649
+ var _tmpl$25 = /* @__PURE__ */ template(`<div>`);
2896
3650
  var _tmpl$33 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
2897
3651
  function Video(props) {
2898
3652
  function videoProps() {
@@ -2954,7 +3708,7 @@ function Video(props) {
2954
3708
  return !props.lazyLoad;
2955
3709
  },
2956
3710
  get children() {
2957
- const _el$3 = _tmpl$11();
3711
+ const _el$3 = _tmpl$15();
2958
3712
  effect(() => setAttribute(_el$3, "src", props.video));
2959
3713
  return _el$3;
2960
3714
  }
@@ -2964,7 +3718,7 @@ function Video(props) {
2964
3718
  return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
2965
3719
  },
2966
3720
  get children() {
2967
- const _el$4 = _tmpl$23();
3721
+ const _el$4 = _tmpl$25();
2968
3722
  _el$4.style.setProperty("width", "100%");
2969
3723
  _el$4.style.setProperty("pointer-events", "none");
2970
3724
  _el$4.style.setProperty("font-size", "0px");
@@ -2977,7 +3731,7 @@ function Video(props) {
2977
3731
  return props.builderBlock?.children?.length && props.fitContent;
2978
3732
  },
2979
3733
  get children() {
2980
- const _el$5 = _tmpl$23();
3734
+ const _el$5 = _tmpl$25();
2981
3735
  _el$5.style.setProperty("display", "flex");
2982
3736
  _el$5.style.setProperty("flex-direction", "column");
2983
3737
  _el$5.style.setProperty("align-items", "stretch");
@@ -2990,7 +3744,7 @@ function Video(props) {
2990
3744
  return props.builderBlock?.children?.length && !props.fitContent;
2991
3745
  },
2992
3746
  get children() {
2993
- const _el$6 = _tmpl$23();
3747
+ const _el$6 = _tmpl$25();
2994
3748
  _el$6.style.setProperty("pointer-events", "none");
2995
3749
  _el$6.style.setProperty("display", "flex");
2996
3750
  _el$6.style.setProperty("flex-direction", "column");
@@ -3009,6 +3763,33 @@ function Video(props) {
3009
3763
  }
3010
3764
  var video_default = Video;
3011
3765
 
3766
+ // src/constants/extra-components.ts
3767
+ var getExtraComponents = () => [{
3768
+ component: custom_code_default,
3769
+ ...componentInfo9
3770
+ }, {
3771
+ component: embed_default,
3772
+ ...componentInfo10
3773
+ }, ...TARGET === "rsc" ? [] : [{
3774
+ component: form_default,
3775
+ ...componentInfo11
3776
+ }, {
3777
+ component: input_default,
3778
+ ...componentInfo12
3779
+ }, {
3780
+ component: submit_button_default,
3781
+ ...componentInfo14
3782
+ }, {
3783
+ component: select_default,
3784
+ ...componentInfo13
3785
+ }], {
3786
+ component: img_default,
3787
+ ...componentInfo15
3788
+ }, {
3789
+ component: video_default,
3790
+ ...componentInfo16
3791
+ }];
3792
+
3012
3793
  // src/constants/builder-registered-components.ts
3013
3794
  var getDefaultRegisteredComponents = () => [{
3014
3795
  component: button_default,
@@ -3017,36 +3798,24 @@ var getDefaultRegisteredComponents = () => [{
3017
3798
  component: columns_default,
3018
3799
  ...componentInfo2
3019
3800
  }, {
3020
- component: custom_code_default,
3801
+ component: fragment_default,
3021
3802
  ...componentInfo3
3022
3803
  }, {
3023
- component: embed_default,
3804
+ component: image_default,
3024
3805
  ...componentInfo4
3025
3806
  }, {
3026
- component: fragment_default,
3807
+ component: section_default,
3027
3808
  ...componentInfo5
3028
3809
  }, {
3029
- component: image_default,
3810
+ component: slot_default,
3030
3811
  ...componentInfo6
3031
- }, {
3032
- component: img_default,
3033
- ...componentInfo7
3034
- }, {
3035
- component: section_default,
3036
- ...componentInfo8
3037
3812
  }, {
3038
3813
  component: symbol_default,
3039
- ...componentInfo10
3814
+ ...componentInfo7
3040
3815
  }, {
3041
3816
  component: text_default,
3042
- ...componentInfo11
3043
- }, {
3044
- component: video_default,
3045
- ...componentInfo12
3046
- }, {
3047
- component: slot_default,
3048
- ...componentInfo9
3049
- }];
3817
+ ...componentInfo8
3818
+ }, ...getExtraComponents()];
3050
3819
 
3051
3820
  // src/functions/register-component.ts
3052
3821
  var components = [];
@@ -3116,10 +3885,10 @@ var getUpdateVariantVisibilityScript = ({
3116
3885
  }) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
3117
3886
  "${variationId}", "${contentId}", ${isHydrationTarget}
3118
3887
  )`;
3119
- var _tmpl$12 = /* @__PURE__ */ template(`<script>`);
3888
+ var _tmpl$16 = /* @__PURE__ */ template(`<script>`);
3120
3889
  function InlinedScript(props) {
3121
3890
  return (() => {
3122
- const _el$ = _tmpl$12();
3891
+ const _el$ = _tmpl$16();
3123
3892
  effect((_p$) => {
3124
3893
  const _v$ = props.scriptStr, _v$2 = props.id || "";
3125
3894
  _v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
@@ -3626,7 +4395,7 @@ function isFromTrustedHost(trustedHosts, e) {
3626
4395
  }
3627
4396
 
3628
4397
  // src/constants/sdk-version.ts
3629
- var SDK_VERSION = "0.13.0";
4398
+ var SDK_VERSION = "0.13.2";
3630
4399
 
3631
4400
  // src/functions/register.ts
3632
4401
  var registry = {};
@@ -4629,7 +5398,7 @@ var fetchSymbolContent = async ({
4629
5398
  };
4630
5399
 
4631
5400
  // src/blocks/symbol/symbol.tsx
4632
- var _tmpl$13 = /* @__PURE__ */ template(`<div>`);
5401
+ var _tmpl$17 = /* @__PURE__ */ template(`<div>`);
4633
5402
  function Symbol(props) {
4634
5403
  const [contentToUse, setContentToUse] = createSignal(props.symbol?.content);
4635
5404
  function className() {
@@ -4655,7 +5424,7 @@ function Symbol(props) {
4655
5424
  }
4656
5425
  createEffect(on(() => [props.symbol], onUpdateFn_0));
4657
5426
  return (() => {
4658
- const _el$ = _tmpl$13();
5427
+ const _el$ = _tmpl$17();
4659
5428
  spread(_el$, mergeProps({
4660
5429
  get ["class"]() {
4661
5430
  return className();