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