@builder.io/sdk-solid 1.0.36 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -436,6 +436,47 @@ interface ComponentInfo {
436
436
  */
437
437
  requiredPermissions?: Array<Permission>;
438
438
  hidden?: boolean;
439
+ /**
440
+ * When overriding built-in components, if you don't want any special behavior that
441
+ * the original has, set this to `true` to skip the default behavior
442
+ *
443
+ * Default behaviors include special "virtual options", such as a custom
444
+ * aspect ratio editor for Images, or a special column editor for Columns
445
+ *
446
+ * Learn more about overriding built-in components here: https://www.builder.io/c/docs/custom-components-overriding
447
+ */
448
+ override?: boolean;
449
+ /**
450
+ * Whether or not the component should receive SDK-related props.
451
+ */
452
+ shouldReceiveBuilderProps?: {
453
+ /**
454
+ * Whether or not the component should receive the `builderBlock` prop, containing the current Builder block being rendered.
455
+ *
456
+ * Defaults to `true`.
457
+ */
458
+ builderBlock?: boolean;
459
+ /**
460
+ * Whether or not the component should receive the `builderContext` prop, containing the current context.
461
+ * The Builder Context contains a lot of data relevant to the current `Content` render.
462
+ * You can see more information [here](https://github.com/BuilderIO/builder/blob/main/packages/sdks/src/context/types.ts).
463
+ *
464
+ * Defaults to `true`.
465
+ */
466
+ builderContext?: boolean;
467
+ /**
468
+ * Whether or not the component should receive the `builderComponents` array, containing the all registered components (custom and built-in).
469
+ *
470
+ * Defaults to `false`.
471
+ */
472
+ builderComponents?: boolean;
473
+ /**
474
+ * Whether or not the component should receive the `builderLinkComponent` prop, containing the custom link component provided to `Content`.
475
+ *
476
+ * Defaults to `false`.
477
+ */
478
+ builderLinkComponent?: boolean;
479
+ };
439
480
  }
440
481
  type Permission = 'read' | 'publish' | 'editCode' | 'editDesigns' | 'admin' | 'create';
441
482
 
@@ -784,25 +784,56 @@ var getRepeatItemData = ({
784
784
  }));
785
785
  return repeatArray;
786
786
  };
787
+ var applyDefaults = (shouldReceiveBuilderProps) => {
788
+ return {
789
+ // once we bump to a major version, toggle this to `false`.
790
+ builderBlock: true,
791
+ // once we bump to a major version, toggle this to `false`.
792
+ builderContext: true,
793
+ builderComponents: false,
794
+ builderLinkComponent: false,
795
+ ...shouldReceiveBuilderProps
796
+ };
797
+ };
787
798
  var provideLinkComponent = (block, linkComponent) => {
788
- return block && (block.isRSC && TARGET === "rsc" || ["Core:Button", "Symbol", "Columns", "Form:Form", "Builder: Tabs", "Builder:Accordion"].includes(block.name)) ? {
799
+ if (!block)
800
+ return {};
801
+ const shouldReceiveProp = applyDefaults(block.shouldReceiveBuilderProps).builderLinkComponent;
802
+ if (!shouldReceiveProp)
803
+ return {};
804
+ return {
789
805
  builderLinkComponent: linkComponent
790
- } : {};
806
+ };
791
807
  };
792
808
  var provideRegisteredComponents = (block, registeredComponents) => {
793
- return block && (block.isRSC && TARGET === "rsc" || ["Symbol", "Columns", "Form:Form", "Builder: Tabs", "Builder:Accordion"].includes(block.name)) ? {
809
+ if (!block)
810
+ return {};
811
+ const shouldReceiveProp = applyDefaults(block.shouldReceiveBuilderProps).builderComponents;
812
+ if (!shouldReceiveProp)
813
+ return {};
814
+ return {
794
815
  builderComponents: registeredComponents
795
- } : {};
816
+ };
796
817
  };
797
818
  var provideBuilderBlock = (block, builderBlock) => {
798
- return block && (block.isRSC && TARGET === "rsc" || TARGET === "reactNative" && block.name === "Text" || ["Builder:Accordion", "Columns", "Form:Form", "Builder: Tabs", "Symbol", "Image", "Video"].includes(block.name)) ? {
819
+ if (!block)
820
+ return {};
821
+ const shouldReceiveProp = applyDefaults(block.shouldReceiveBuilderProps).builderBlock;
822
+ if (!shouldReceiveProp)
823
+ return {};
824
+ return {
799
825
  builderBlock
800
- } : {};
826
+ };
801
827
  };
802
828
  var provideBuilderContext = (block, context) => {
803
- return block && (block.isRSC && TARGET === "rsc" || ["Builder:Accordion", "Columns", "Form:Form", "Builder: Tabs", "Symbol", "Slot"].includes(block.name)) ? {
829
+ if (!block)
830
+ return {};
831
+ const shouldReceiveProp = applyDefaults(block.shouldReceiveBuilderProps).builderContext;
832
+ if (!shouldReceiveProp)
833
+ return {};
834
+ return {
804
835
  builderContext: context
805
- } : {};
836
+ };
806
837
  };
807
838
 
808
839
  // src/constants/device-sizes.ts
@@ -2253,7 +2284,13 @@ var componentInfo = {
2253
2284
  options.set("items", []);
2254
2285
  }
2255
2286
  }
2256
- }]
2287
+ }],
2288
+ shouldReceiveBuilderProps: {
2289
+ builderBlock: true,
2290
+ builderContext: true,
2291
+ builderComponents: true,
2292
+ builderLinkComponent: true
2293
+ }
2257
2294
  };
2258
2295
 
2259
2296
  // src/blocks/accordion/helpers.ts
@@ -2476,7 +2513,13 @@ var componentInfo2 = {
2476
2513
  friendlyName: "Open link in new tab"
2477
2514
  }],
2478
2515
  static: true,
2479
- noWrap: true
2516
+ noWrap: true,
2517
+ shouldReceiveBuilderProps: {
2518
+ builderBlock: false,
2519
+ builderContext: false,
2520
+ builderComponents: false,
2521
+ builderLinkComponent: true
2522
+ }
2480
2523
  };
2481
2524
 
2482
2525
  // src/blocks/columns/component-info.ts
@@ -2696,11 +2739,23 @@ var componentInfo3 = {
2696
2739
  defaultValue: false,
2697
2740
  helperText: "When stacking columns for mobile devices, reverse the ordering",
2698
2741
  advanced: true
2699
- }]
2742
+ }],
2743
+ shouldReceiveBuilderProps: {
2744
+ builderBlock: true,
2745
+ builderContext: true,
2746
+ builderComponents: true,
2747
+ builderLinkComponent: true
2748
+ }
2700
2749
  };
2701
2750
 
2702
2751
  // src/blocks/fragment/component-info.ts
2703
2752
  var componentInfo4 = {
2753
+ shouldReceiveBuilderProps: {
2754
+ builderBlock: false,
2755
+ builderContext: false,
2756
+ builderComponents: false,
2757
+ builderLinkComponent: false
2758
+ },
2704
2759
  name: "Fragment",
2705
2760
  static: true,
2706
2761
  hidden: true,
@@ -2833,11 +2888,23 @@ var componentInfo5 = {
2833
2888
  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",
2834
2889
  advanced: true,
2835
2890
  defaultValue: 0.7041
2836
- }]
2891
+ }],
2892
+ shouldReceiveBuilderProps: {
2893
+ builderBlock: true,
2894
+ builderContext: false,
2895
+ builderComponents: false,
2896
+ builderLinkComponent: false
2897
+ }
2837
2898
  };
2838
2899
 
2839
2900
  // src/blocks/section/component-info.ts
2840
2901
  var componentInfo6 = {
2902
+ shouldReceiveBuilderProps: {
2903
+ builderBlock: false,
2904
+ builderContext: false,
2905
+ builderComponents: false,
2906
+ builderLinkComponent: false
2907
+ },
2841
2908
  name: "Core:Section",
2842
2909
  static: true,
2843
2910
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
@@ -2891,7 +2958,13 @@ var componentInfo7 = {
2891
2958
  type: "string",
2892
2959
  required: true,
2893
2960
  defaultValue: "children"
2894
- }]
2961
+ }],
2962
+ shouldReceiveBuilderProps: {
2963
+ builderBlock: false,
2964
+ builderContext: true,
2965
+ builderComponents: false,
2966
+ builderLinkComponent: false
2967
+ }
2895
2968
  };
2896
2969
  var _tmpl$8 = /* @__PURE__ */ template(`<div>`);
2897
2970
  function Slot(props) {
@@ -2953,7 +3026,13 @@ var componentInfo8 = {
2953
3026
  name: "useChildren",
2954
3027
  hideFromUI: true,
2955
3028
  type: "boolean"
2956
- }]
3029
+ }],
3030
+ shouldReceiveBuilderProps: {
3031
+ builderBlock: true,
3032
+ builderContext: true,
3033
+ builderComponents: true,
3034
+ builderLinkComponent: true
3035
+ }
2957
3036
  };
2958
3037
 
2959
3038
  // src/blocks/tabs/component-info.ts
@@ -3093,7 +3172,13 @@ var componentInfo9 = {
3093
3172
  label: "Right",
3094
3173
  value: "flex-end"
3095
3174
  }]
3096
- }]
3175
+ }],
3176
+ shouldReceiveBuilderProps: {
3177
+ builderBlock: true,
3178
+ builderContext: true,
3179
+ builderComponents: true,
3180
+ builderLinkComponent: true
3181
+ }
3097
3182
  };
3098
3183
  var _tmpl$9 = /* @__PURE__ */ template(`<div>`);
3099
3184
  var _tmpl$25 = /* @__PURE__ */ template(`<div><div class=builder-tabs-wrap>`);
@@ -3196,6 +3281,12 @@ delegateEvents(["click"]);
3196
3281
 
3197
3282
  // src/blocks/text/component-info.ts
3198
3283
  var componentInfo10 = {
3284
+ shouldReceiveBuilderProps: {
3285
+ builderBlock: TARGET === "reactNative" ? true : false,
3286
+ builderContext: false,
3287
+ builderComponents: false,
3288
+ builderLinkComponent: false
3289
+ },
3199
3290
  name: "Text",
3200
3291
  static: true,
3201
3292
  isRSC: true,
@@ -3227,6 +3318,12 @@ var text_default = Text;
3227
3318
 
3228
3319
  // src/blocks/custom-code/component-info.ts
3229
3320
  var componentInfo11 = {
3321
+ shouldReceiveBuilderProps: {
3322
+ builderBlock: false,
3323
+ builderContext: false,
3324
+ builderComponents: false,
3325
+ builderLinkComponent: false
3326
+ },
3230
3327
  name: "Custom Code",
3231
3328
  static: true,
3232
3329
  requiredPermissions: ["editCode"],
@@ -3303,6 +3400,12 @@ var custom_code_default = CustomCode;
3303
3400
 
3304
3401
  // src/blocks/embed/component-info.ts
3305
3402
  var componentInfo12 = {
3403
+ shouldReceiveBuilderProps: {
3404
+ builderBlock: false,
3405
+ builderContext: false,
3406
+ builderComponents: false,
3407
+ builderLinkComponent: false
3408
+ },
3306
3409
  name: "Embed",
3307
3410
  static: true,
3308
3411
  inputs: [{
@@ -3622,7 +3725,13 @@ var componentInfo13 = {
3622
3725
  text: "Submit"
3623
3726
  }
3624
3727
  }
3625
- }]
3728
+ }],
3729
+ shouldReceiveBuilderProps: {
3730
+ builderBlock: true,
3731
+ builderContext: true,
3732
+ builderComponents: true,
3733
+ builderLinkComponent: true
3734
+ }
3626
3735
  };
3627
3736
 
3628
3737
  // src/functions/get-env.ts
@@ -3942,6 +4051,12 @@ var form_default = FormComponent;
3942
4051
 
3943
4052
  // src/blocks/form/input/component-info.ts
3944
4053
  var componentInfo14 = {
4054
+ shouldReceiveBuilderProps: {
4055
+ builderBlock: false,
4056
+ builderContext: false,
4057
+ builderComponents: false,
4058
+ builderLinkComponent: false
4059
+ },
3945
4060
  name: "Form:Input",
3946
4061
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
3947
4062
  inputs: [
@@ -4027,6 +4142,12 @@ var input_default = FormInputComponent;
4027
4142
 
4028
4143
  // src/blocks/form/select/component-info.ts
4029
4144
  var componentInfo15 = {
4145
+ shouldReceiveBuilderProps: {
4146
+ builderBlock: false,
4147
+ builderContext: false,
4148
+ builderComponents: false,
4149
+ builderLinkComponent: false
4150
+ },
4030
4151
  name: "Form:Select",
4031
4152
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
4032
4153
  defaultStyles: {
@@ -4113,6 +4234,12 @@ var select_default = SelectComponent;
4113
4234
 
4114
4235
  // src/blocks/form/submit-button/component-info.ts
4115
4236
  var componentInfo16 = {
4237
+ shouldReceiveBuilderProps: {
4238
+ builderBlock: false,
4239
+ builderContext: false,
4240
+ builderComponents: false,
4241
+ builderLinkComponent: false
4242
+ },
4116
4243
  name: "Form:SubmitButton",
4117
4244
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
4118
4245
  defaultStyles: {
@@ -4151,6 +4278,12 @@ var submit_button_default = SubmitButton;
4151
4278
 
4152
4279
  // src/blocks/form/textarea/component-info.ts
4153
4280
  var componentInfo17 = {
4281
+ shouldReceiveBuilderProps: {
4282
+ builderBlock: false,
4283
+ builderContext: false,
4284
+ builderComponents: false,
4285
+ builderLinkComponent: false
4286
+ },
4154
4287
  name: "Form:TextArea",
4155
4288
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
4156
4289
  inputs: [{
@@ -4215,6 +4348,12 @@ var textarea_default = Textarea;
4215
4348
 
4216
4349
  // src/blocks/img/component-info.ts
4217
4350
  var componentInfo18 = {
4351
+ shouldReceiveBuilderProps: {
4352
+ builderBlock: false,
4353
+ builderContext: false,
4354
+ builderComponents: false,
4355
+ builderLinkComponent: false
4356
+ },
4218
4357
  // friendlyName?
4219
4358
  name: "Raw:Img",
4220
4359
  hideFromInsertMenu: true,
@@ -4336,7 +4475,13 @@ var componentInfo19 = {
4336
4475
  helperText: 'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',
4337
4476
  defaultValue: true,
4338
4477
  advanced: true
4339
- }]
4478
+ }],
4479
+ shouldReceiveBuilderProps: {
4480
+ builderBlock: true,
4481
+ builderContext: false,
4482
+ builderComponents: false,
4483
+ builderLinkComponent: false
4484
+ }
4340
4485
  };
4341
4486
  var _tmpl$19 = /* @__PURE__ */ template(`<source type=video/mp4>`);
4342
4487
  var _tmpl$28 = /* @__PURE__ */ template(`<div>`);
@@ -5103,7 +5248,7 @@ function isFromTrustedHost(trustedHosts, e) {
5103
5248
  }
5104
5249
 
5105
5250
  // src/constants/sdk-version.ts
5106
- var SDK_VERSION = "1.0.36";
5251
+ var SDK_VERSION = "1.1.1";
5107
5252
 
5108
5253
  // src/functions/register.ts
5109
5254
  var registry = {};