@builder.io/sdk-solid 1.0.28 → 1.0.30

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.
@@ -5021,1009 +5021,1009 @@ var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : tru
5021
5021
  // src/components/content/content.tsx
5022
5022
  import { Show as Show13, createSignal as createSignal17 } from "solid-js";
5023
5023
 
5024
- // src/blocks/button/component-info.ts
5025
- var componentInfo = {
5026
- name: "Core:Button",
5027
- image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
5028
- defaultStyles: {
5029
- // TODO: make min width more intuitive and set one
5030
- appearance: "none",
5031
- paddingTop: "15px",
5032
- paddingBottom: "15px",
5033
- paddingLeft: "25px",
5034
- paddingRight: "25px",
5035
- backgroundColor: "#000000",
5036
- color: "white",
5037
- borderRadius: "4px",
5038
- textAlign: "center",
5039
- cursor: "pointer"
5024
+ // src/blocks/accordion/component-info.ts
5025
+ var defaultTitle = {
5026
+ "@type": "@builder.io/sdk:Element",
5027
+ layerName: "Accordion item title",
5028
+ responsiveStyles: {
5029
+ large: {
5030
+ marginTop: "10px",
5031
+ position: "relative",
5032
+ display: "flex",
5033
+ alignItems: "stretch",
5034
+ flexDirection: "column",
5035
+ paddingBottom: "10px"
5036
+ }
5040
5037
  },
5041
- inputs: [{
5042
- name: "text",
5043
- type: "text",
5044
- defaultValue: "Click me!",
5045
- bubble: true
5046
- }, {
5047
- name: "link",
5048
- type: "url",
5049
- bubble: true
5050
- }, {
5051
- name: "openLinkInNewTab",
5052
- type: "boolean",
5053
- defaultValue: false,
5054
- friendlyName: "Open link in new tab"
5055
- }],
5056
- static: true,
5057
- noWrap: true
5058
- };
5059
-
5060
- // src/blocks/columns/component-info.ts
5061
- var componentInfo2 = {
5062
- // TODO: ways to statically preprocess JSON for references, functions, etc
5063
- name: "Columns",
5064
- isRSC: true,
5065
- inputs: [{
5066
- name: "columns",
5067
- type: "array",
5068
- broadcast: true,
5069
- subFields: [{
5070
- name: "blocks",
5071
- type: "array",
5072
- hideFromUI: true,
5073
- defaultValue: [{
5074
- "@type": "@builder.io/sdk:Element",
5075
- responsiveStyles: {
5076
- large: {
5077
- display: "flex",
5078
- flexDirection: "column",
5079
- alignItems: "stretch",
5080
- flexShrink: "0",
5081
- position: "relative",
5082
- marginTop: "30px",
5083
- textAlign: "center",
5084
- lineHeight: "normal",
5085
- height: "auto",
5086
- minHeight: "20px",
5087
- minWidth: "20px",
5088
- overflow: "hidden"
5089
- }
5090
- },
5091
- component: {
5092
- name: "Image",
5093
- options: {
5094
- image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
5095
- backgroundPosition: "center",
5096
- backgroundSize: "cover",
5097
- aspectRatio: 0.7004048582995948
5098
- }
5099
- }
5100
- }, {
5101
- "@type": "@builder.io/sdk:Element",
5102
- responsiveStyles: {
5103
- large: {
5104
- display: "flex",
5105
- flexDirection: "column",
5106
- alignItems: "stretch",
5107
- flexShrink: "0",
5108
- position: "relative",
5109
- marginTop: "30px",
5110
- textAlign: "center",
5111
- lineHeight: "normal",
5112
- height: "auto"
5113
- }
5114
- },
5115
- component: {
5116
- name: "Text",
5117
- options: {
5118
- text: "<p>Enter some text...</p>"
5119
- }
5120
- }
5121
- }]
5122
- }, {
5123
- name: "width",
5124
- type: "number",
5125
- hideFromUI: true,
5126
- helperText: "Width %, e.g. set to 50 to fill half of the space"
5127
- }, {
5128
- name: "link",
5129
- type: "url",
5130
- helperText: "Optionally set a url that clicking this column will link to"
5131
- }],
5132
- defaultValue: [{
5133
- blocks: [{
5134
- "@type": "@builder.io/sdk:Element",
5135
- responsiveStyles: {
5136
- large: {
5137
- display: "flex",
5138
- flexDirection: "column",
5139
- alignItems: "stretch",
5140
- flexShrink: "0",
5141
- position: "relative",
5142
- marginTop: "30px",
5143
- textAlign: "center",
5144
- lineHeight: "normal",
5145
- height: "auto",
5146
- minHeight: "20px",
5147
- minWidth: "20px",
5148
- overflow: "hidden"
5149
- }
5150
- },
5151
- component: {
5152
- name: "Image",
5153
- options: {
5154
- image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
5155
- backgroundPosition: "center",
5156
- backgroundSize: "cover",
5157
- aspectRatio: 0.7004048582995948
5158
- }
5159
- }
5160
- }, {
5161
- "@type": "@builder.io/sdk:Element",
5162
- responsiveStyles: {
5163
- large: {
5164
- display: "flex",
5165
- flexDirection: "column",
5166
- alignItems: "stretch",
5167
- flexShrink: "0",
5168
- position: "relative",
5169
- marginTop: "30px",
5170
- textAlign: "center",
5171
- lineHeight: "normal",
5172
- height: "auto"
5173
- }
5174
- },
5175
- component: {
5176
- name: "Text",
5177
- options: {
5178
- text: "<p>Enter some text...</p>"
5179
- }
5180
- }
5181
- }]
5182
- }, {
5183
- blocks: [{
5184
- "@type": "@builder.io/sdk:Element",
5185
- responsiveStyles: {
5186
- large: {
5187
- display: "flex",
5188
- flexDirection: "column",
5189
- alignItems: "stretch",
5190
- flexShrink: "0",
5191
- position: "relative",
5192
- marginTop: "30px",
5193
- textAlign: "center",
5194
- lineHeight: "normal",
5195
- height: "auto",
5196
- minHeight: "20px",
5197
- minWidth: "20px",
5198
- overflow: "hidden"
5199
- }
5200
- },
5201
- component: {
5202
- name: "Image",
5203
- options: {
5204
- image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
5205
- backgroundPosition: "center",
5206
- backgroundSize: "cover",
5207
- aspectRatio: 0.7004048582995948
5208
- }
5209
- }
5210
- }, {
5211
- "@type": "@builder.io/sdk:Element",
5212
- responsiveStyles: {
5213
- large: {
5214
- display: "flex",
5215
- flexDirection: "column",
5216
- alignItems: "stretch",
5217
- flexShrink: "0",
5218
- position: "relative",
5219
- marginTop: "30px",
5220
- textAlign: "center",
5221
- lineHeight: "normal",
5222
- height: "auto"
5223
- }
5224
- },
5225
- component: {
5226
- name: "Text",
5227
- options: {
5228
- text: "<p>Enter some text...</p>"
5229
- }
5230
- }
5231
- }]
5232
- }],
5233
- onChange: (options) => {
5234
- function clearWidths() {
5235
- columns.forEach((col) => {
5236
- col.delete("width");
5237
- });
5038
+ children: [{
5039
+ "@type": "@builder.io/sdk:Element",
5040
+ responsiveStyles: {
5041
+ large: {
5042
+ textAlign: "left",
5043
+ display: "flex",
5044
+ flexDirection: "column"
5238
5045
  }
5239
- const columns = options.get("columns");
5240
- if (Array.isArray(columns)) {
5241
- const containsColumnWithWidth = !!columns.find((col) => col.get("width"));
5242
- if (containsColumnWithWidth) {
5243
- const containsColumnWithoutWidth = !!columns.find((col) => !col.get("width"));
5244
- if (containsColumnWithoutWidth) {
5245
- clearWidths();
5246
- } else {
5247
- const sumWidths = columns.reduce((memo, col) => {
5248
- return memo + col.get("width");
5249
- }, 0);
5250
- const widthsDontAddUp = sumWidths !== 100;
5251
- if (widthsDontAddUp) {
5252
- clearWidths();
5253
- }
5254
- }
5255
- }
5046
+ },
5047
+ component: {
5048
+ name: "Text",
5049
+ options: {
5050
+ text: "I am an accordion title. Click me!"
5256
5051
  }
5257
5052
  }
5258
- }, {
5259
- name: "space",
5260
- type: "number",
5261
- defaultValue: 20,
5262
- helperText: "Size of gap between columns",
5263
- advanced: true
5264
- }, {
5265
- name: "stackColumnsAt",
5266
- type: "string",
5267
- defaultValue: "tablet",
5268
- helperText: "Convert horizontal columns to vertical at what device size",
5269
- enum: ["tablet", "mobile", "never"],
5270
- advanced: true
5271
- }, {
5272
- name: "reverseColumnsWhenStacked",
5273
- type: "boolean",
5274
- defaultValue: false,
5275
- helperText: "When stacking columns for mobile devices, reverse the ordering",
5276
- advanced: true
5277
5053
  }]
5278
5054
  };
5279
-
5280
- // src/blocks/fragment/component-info.ts
5281
- var componentInfo3 = {
5282
- name: "Fragment",
5283
- static: true,
5284
- hidden: true,
5285
- canHaveChildren: true,
5286
- noWrap: true
5287
- };
5288
-
5289
- // src/blocks/image/component-info.ts
5290
- var componentInfo4 = {
5291
- name: "Image",
5292
- static: true,
5293
- 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",
5294
- defaultStyles: {
5295
- position: "relative",
5296
- minHeight: "20px",
5297
- minWidth: "20px",
5298
- overflow: "hidden"
5055
+ var defaultDetail = {
5056
+ "@type": "@builder.io/sdk:Element",
5057
+ layerName: "Accordion item detail",
5058
+ responsiveStyles: {
5059
+ large: {
5060
+ position: "relative",
5061
+ display: "flex",
5062
+ alignItems: "stretch",
5063
+ flexDirection: "column",
5064
+ marginTop: "10px",
5065
+ paddingBottom: "10px"
5066
+ }
5299
5067
  },
5300
- canHaveChildren: true,
5301
- inputs: [{
5302
- name: "image",
5303
- type: "file",
5304
- bubble: true,
5305
- allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
5306
- required: true,
5307
- defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
5308
- onChange: (options) => {
5309
- const DEFAULT_ASPECT_RATIO = 0.7041;
5310
- options.delete("srcset");
5311
- options.delete("noWebp");
5312
- function loadImage(url, timeout = 6e4) {
5313
- return new Promise((resolve, reject) => {
5314
- const img = document.createElement("img");
5315
- let loaded = false;
5316
- img.onload = () => {
5317
- loaded = true;
5318
- resolve(img);
5319
- };
5320
- img.addEventListener("error", (event) => {
5321
- reject(event.error);
5322
- });
5323
- img.src = url;
5324
- setTimeout(() => {
5325
- if (!loaded) {
5326
- reject(new Error("Image load timed out"));
5327
- }
5328
- }, timeout);
5329
- });
5330
- }
5331
- function round2(num) {
5332
- return Math.round(num * 1e3) / 1e3;
5068
+ children: [{
5069
+ "@type": "@builder.io/sdk:Element",
5070
+ responsiveStyles: {
5071
+ large: {
5072
+ paddingTop: "50px",
5073
+ textAlign: "left",
5074
+ display: "flex",
5075
+ flexDirection: "column",
5076
+ paddingBottom: "50px"
5333
5077
  }
5334
- const value = options.get("image");
5335
- const aspectRatio = options.get("aspectRatio");
5336
- fetch(value).then((res) => res.blob()).then((blob) => {
5337
- if (blob.type.includes("svg")) {
5338
- options.set("noWebp", true);
5339
- }
5340
- });
5341
- if (value && (!aspectRatio || aspectRatio === DEFAULT_ASPECT_RATIO)) {
5342
- return loadImage(value).then((img) => {
5343
- const possiblyUpdatedAspectRatio = options.get("aspectRatio");
5344
- if (options.get("image") === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === DEFAULT_ASPECT_RATIO)) {
5345
- if (img.width && img.height) {
5346
- options.set("aspectRatio", round2(img.height / img.width));
5347
- options.set("height", img.height);
5348
- options.set("width", img.width);
5349
- }
5350
- }
5351
- });
5078
+ },
5079
+ component: {
5080
+ name: "Text",
5081
+ options: {
5082
+ text: "I am an accordion detail, hello!"
5352
5083
  }
5353
5084
  }
5354
- }, {
5355
- name: "backgroundSize",
5356
- type: "text",
5357
- defaultValue: "cover",
5358
- enum: [{
5359
- label: "contain",
5360
- value: "contain",
5361
- helperText: "The image should never get cropped"
5362
- }, {
5363
- label: "cover",
5364
- value: "cover",
5365
- helperText: "The image should fill it's box, cropping when needed"
5366
- }]
5367
- }, {
5368
- name: "backgroundPosition",
5369
- type: "text",
5370
- defaultValue: "center",
5371
- enum: ["center", "top", "left", "right", "bottom", "top left", "top right", "bottom left", "bottom right"]
5372
- }, {
5373
- name: "altText",
5374
- type: "string",
5375
- helperText: "Text to display when the user has images off"
5376
- }, {
5377
- name: "height",
5378
- type: "number",
5379
- hideFromUI: true
5380
- }, {
5381
- name: "width",
5382
- type: "number",
5383
- hideFromUI: true
5384
- }, {
5385
- name: "sizes",
5386
- type: "string",
5387
- hideFromUI: true
5388
- }, {
5389
- name: "srcset",
5390
- type: "string",
5391
- hideFromUI: true
5392
- }, {
5393
- name: "lazy",
5394
- type: "boolean",
5395
- defaultValue: true,
5396
- hideFromUI: true
5397
- }, {
5398
- name: "fitContent",
5399
- type: "boolean",
5400
- helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
5401
- defaultValue: true
5402
- }, {
5403
- name: "aspectRatio",
5404
- type: "number",
5405
- 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",
5406
- advanced: true,
5407
- defaultValue: 0.7041
5408
5085
  }]
5409
5086
  };
5410
-
5411
- // src/blocks/section/component-info.ts
5412
- var componentInfo5 = {
5413
- name: "Core:Section",
5414
- static: true,
5415
- image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
5087
+ var componentInfo = {
5088
+ name: "Builder:Accordion",
5089
+ canHaveChildren: true,
5090
+ image: "https://cdn.builder.io/api/v1/image/assets%2FagZ9n5CUKRfbL9t6CaJOyVSK4Es2%2Ffab6c1fd3fe542408cbdec078bca7f35",
5091
+ defaultStyles: {
5092
+ display: "flex",
5093
+ flexDirection: "column",
5094
+ alignItems: "stretch"
5095
+ },
5416
5096
  inputs: [{
5417
- name: "maxWidth",
5418
- type: "number",
5419
- defaultValue: 1200
5097
+ name: "items",
5098
+ type: "list",
5099
+ broadcast: true,
5100
+ subFields: [{
5101
+ name: "title",
5102
+ type: "uiBlocks",
5103
+ hideFromUI: true,
5104
+ defaultValue: [defaultTitle]
5105
+ }, {
5106
+ name: "detail",
5107
+ type: "uiBlocks",
5108
+ hideFromUI: true,
5109
+ defaultValue: [defaultDetail]
5110
+ }],
5111
+ defaultValue: [{
5112
+ title: [defaultTitle],
5113
+ detail: [defaultDetail]
5114
+ }, {
5115
+ title: [defaultTitle],
5116
+ detail: [defaultDetail]
5117
+ }],
5118
+ showIf: (options) => !options.get("useChildrenForItems")
5420
5119
  }, {
5421
- name: "lazyLoad",
5120
+ name: "oneAtATime",
5121
+ helperText: "Only allow opening one at a time (collapse all others when new item openned)",
5422
5122
  type: "boolean",
5423
- defaultValue: false,
5123
+ defaultValue: false
5124
+ }, {
5125
+ name: "grid",
5126
+ helperText: "Display as a grid",
5127
+ type: "boolean",
5128
+ defaultValue: false
5129
+ }, {
5130
+ name: "gridRowWidth",
5131
+ helperText: "Display as a grid",
5132
+ type: "string",
5133
+ showIf: (options) => options.get("grid"),
5134
+ defaultValue: "25%"
5135
+ }, {
5136
+ name: "useChildrenForItems",
5137
+ type: "boolean",
5138
+ helperText: "Use child elements for each slide, instead of the array. Useful for dynamically repeating items",
5424
5139
  advanced: true,
5425
- description: "Only render this section when in view"
5426
- }],
5427
- defaultStyles: {
5428
- paddingLeft: "20px",
5429
- paddingRight: "20px",
5430
- paddingTop: "50px",
5431
- paddingBottom: "50px",
5432
- marginTop: "0px",
5433
- width: "100vw",
5434
- marginLeft: "calc(50% - 50vw)"
5435
- },
5436
- canHaveChildren: true,
5437
- defaultChildren: [{
5438
- "@type": "@builder.io/sdk:Element",
5439
- responsiveStyles: {
5440
- large: {
5441
- textAlign: "center"
5442
- }
5443
- },
5444
- component: {
5445
- name: "Text",
5446
- options: {
5447
- 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>"
5140
+ defaultValue: false,
5141
+ onChange: (options) => {
5142
+ if (options.get("useChildrenForItems") === true) {
5143
+ options.set("items", []);
5448
5144
  }
5449
5145
  }
5450
5146
  }]
5451
5147
  };
5452
5148
 
5453
- // src/blocks/slot/component-info.ts
5454
- var componentInfo6 = {
5455
- name: "Slot",
5456
- isRSC: true,
5457
- description: "Allow child blocks to be inserted into this content when used as a Symbol",
5458
- docsLink: "https://www.builder.io/c/docs/symbols-with-blocks",
5459
- image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",
5460
- // Maybe wrap this for canHaveChildren so bind children to this hm
5461
- inputs: [{
5462
- name: "name",
5463
- type: "string",
5464
- required: true,
5465
- defaultValue: "children"
5466
- }]
5149
+ // src/blocks/accordion/accordion.tsx
5150
+ import { Show as Show8, For as For5, createSignal as createSignal9, createMemo as createMemo9 } from "solid-js";
5151
+
5152
+ // src/blocks/accordion/helpers.ts
5153
+ var convertOrderNumberToString = (order) => {
5154
+ return order.toString();
5467
5155
  };
5468
5156
 
5469
- // src/blocks/slot/slot.tsx
5470
- function Slot(props) {
5471
- return <div
5472
- style={{
5473
- "pointer-events": "auto"
5474
- }}
5475
- {...!props.builderContext.context?.symbolId && {
5476
- "builder-slot": props.name
5477
- }}
5478
- ><Blocks_default
5479
- parent={props.builderContext.context?.symbolId}
5480
- path={`symbol.data.${props.name}`}
5481
- context={props.builderContext}
5482
- blocks={props.builderContext.rootState?.[props.name]}
5483
- /></div>;
5157
+ // src/blocks/accordion/accordion.tsx
5158
+ function Accordion(props) {
5159
+ const [open, setOpen] = createSignal9([]);
5160
+ const onlyOneAtATime = createMemo9(() => {
5161
+ return Boolean(props.grid || props.oneAtATime);
5162
+ });
5163
+ const accordionStyles = createMemo9(() => {
5164
+ const styles = {
5165
+ display: "flex",
5166
+ alignItems: "stretch",
5167
+ flexDirection: "column",
5168
+ ...props.grid && {
5169
+ flexDirection: "row",
5170
+ alignItems: "flex-start",
5171
+ flexWrap: "wrap"
5172
+ }
5173
+ };
5174
+ return Object.fromEntries(
5175
+ Object.entries(styles).map(([key, value]) => [
5176
+ camelToKebabCase(key),
5177
+ value
5178
+ ])
5179
+ );
5180
+ });
5181
+ const accordionTitleStyles = createMemo9(() => {
5182
+ const shared = {
5183
+ display: "flex",
5184
+ flexDirection: "column"
5185
+ };
5186
+ const styles = Object.fromEntries(
5187
+ Object.entries({
5188
+ ...shared,
5189
+ alignItems: "stretch",
5190
+ cursor: "pointer"
5191
+ }).map(([key, value]) => [camelToKebabCase(key), value])
5192
+ );
5193
+ return Object.fromEntries(
5194
+ Object.entries(styles).filter(([_, value]) => value !== void 0)
5195
+ );
5196
+ });
5197
+ function getAccordionTitleClassName(index) {
5198
+ return `builder-accordion-title builder-accordion-title-${open().includes(index) ? "open" : "closed"}`;
5199
+ }
5200
+ function getAccordionDetailClassName(index) {
5201
+ return `builder-accordion-detail builder-accordion-detail-${open().includes(index) ? "open" : "closed"}`;
5202
+ }
5203
+ const openGridItemOrder = createMemo9(() => {
5204
+ let itemOrder = null;
5205
+ const getOpenGridItemPosition = props.grid && open().length;
5206
+ if (getOpenGridItemPosition && document) {
5207
+ const openItemIndex = open()[0];
5208
+ const openItem = document.querySelector(
5209
+ `.builder-accordion-title[data-index="${openItemIndex}"]`
5210
+ );
5211
+ let subjectItem = openItem;
5212
+ itemOrder = openItemIndex;
5213
+ if (subjectItem) {
5214
+ let prevItemRect = subjectItem.getBoundingClientRect();
5215
+ while (subjectItem = subjectItem && subjectItem.nextElementSibling) {
5216
+ if (subjectItem) {
5217
+ if (subjectItem.classList.contains("builder-accordion-detail")) {
5218
+ continue;
5219
+ }
5220
+ const subjectItemRect = subjectItem.getBoundingClientRect();
5221
+ if (subjectItemRect.left > prevItemRect.left) {
5222
+ const index = parseInt(
5223
+ subjectItem.getAttribute("data-index") || "",
5224
+ 10
5225
+ );
5226
+ if (!isNaN(index)) {
5227
+ prevItemRect = subjectItemRect;
5228
+ itemOrder = index;
5229
+ }
5230
+ } else {
5231
+ break;
5232
+ }
5233
+ }
5234
+ }
5235
+ }
5236
+ }
5237
+ if (typeof itemOrder === "number") {
5238
+ itemOrder = itemOrder + 1;
5239
+ }
5240
+ return itemOrder;
5241
+ });
5242
+ const accordionDetailStyles = createMemo9(() => {
5243
+ const styles = {
5244
+ ...{
5245
+ order: typeof openGridItemOrder() === "number" ? openGridItemOrder() : void 0
5246
+ },
5247
+ ...props.grid && {
5248
+ width: "100%"
5249
+ }
5250
+ };
5251
+ return Object.fromEntries(
5252
+ Object.entries(styles).filter(([_, value]) => value !== void 0)
5253
+ );
5254
+ });
5255
+ function onClick(index) {
5256
+ if (open().includes(index)) {
5257
+ setOpen(onlyOneAtATime() ? [] : open().filter((item) => item !== index));
5258
+ } else {
5259
+ setOpen(onlyOneAtATime() ? [index] : open().concat(index));
5260
+ }
5261
+ }
5262
+ return <div class="builder-accordion" style={accordionStyles()}><For5 each={props.items}>{(item, _index) => {
5263
+ const index = _index();
5264
+ return <>
5265
+ <div
5266
+ class={getAccordionTitleClassName(index)}
5267
+ style={{
5268
+ ...accordionTitleStyles(),
5269
+ width: props.grid ? props.gridRowWidth : void 0,
5270
+ ...{
5271
+ order: openGridItemOrder() !== null ? convertOrderNumberToString(index) : convertOrderNumberToString(index + 1)
5272
+ }
5273
+ }}
5274
+ data-index={index}
5275
+ onClick={(event) => onClick(index)}
5276
+ ><Blocks_default
5277
+ blocks={item.title}
5278
+ path={`items.${index}.title`}
5279
+ parent={props.builderBlock.id}
5280
+ context={props.builderContext}
5281
+ registeredComponents={props.builderComponents}
5282
+ linkComponent={props.builderLinkComponent}
5283
+ /></div>
5284
+ <Show8 when={open().includes(index)}><div
5285
+ class={getAccordionDetailClassName(index)}
5286
+ style={accordionDetailStyles()}
5287
+ ><Blocks_default
5288
+ blocks={item.detail}
5289
+ path={`items.${index}.detail`}
5290
+ parent={props.builderBlock.id}
5291
+ context={props.builderContext}
5292
+ registeredComponents={props.builderComponents}
5293
+ linkComponent={props.builderLinkComponent}
5294
+ /></div></Show8>
5295
+ </>;
5296
+ }}</For5></div>;
5484
5297
  }
5485
- var slot_default = Slot;
5298
+ var accordion_default = Accordion;
5486
5299
 
5487
- // src/blocks/symbol/component-info.ts
5488
- var componentInfo7 = {
5489
- name: "Symbol",
5490
- noWrap: true,
5491
- static: true,
5492
- isRSC: true,
5300
+ // src/blocks/button/component-info.ts
5301
+ var componentInfo2 = {
5302
+ name: "Core:Button",
5303
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
5304
+ defaultStyles: {
5305
+ // TODO: make min width more intuitive and set one
5306
+ appearance: "none",
5307
+ paddingTop: "15px",
5308
+ paddingBottom: "15px",
5309
+ paddingLeft: "25px",
5310
+ paddingRight: "25px",
5311
+ backgroundColor: "#000000",
5312
+ color: "white",
5313
+ borderRadius: "4px",
5314
+ textAlign: "center",
5315
+ cursor: "pointer"
5316
+ },
5493
5317
  inputs: [{
5494
- name: "symbol",
5495
- type: "uiSymbol"
5496
- }, {
5497
- name: "dataOnly",
5498
- helperText: "Make this a data symbol that doesn't display any UI",
5499
- type: "boolean",
5500
- defaultValue: false,
5501
- advanced: true,
5502
- hideFromUI: true
5503
- }, {
5504
- name: "inheritState",
5505
- helperText: "Inherit the parent component state and data",
5506
- type: "boolean",
5507
- defaultValue: false,
5508
- advanced: true
5318
+ name: "text",
5319
+ type: "text",
5320
+ defaultValue: "Click me!",
5321
+ bubble: true
5509
5322
  }, {
5510
- name: "renderToLiquid",
5511
- helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
5323
+ name: "link",
5324
+ type: "url",
5325
+ bubble: true
5326
+ }, {
5327
+ name: "openLinkInNewTab",
5512
5328
  type: "boolean",
5513
5329
  defaultValue: false,
5514
- advanced: true,
5515
- hideFromUI: true
5516
- }, {
5517
- name: "useChildren",
5518
- hideFromUI: true,
5519
- type: "boolean"
5520
- }]
5330
+ friendlyName: "Open link in new tab"
5331
+ }],
5332
+ static: true,
5333
+ noWrap: true
5521
5334
  };
5522
5335
 
5523
- // src/blocks/tabs/component-info.ts
5524
- var defaultTab = {
5525
- "@type": "@builder.io/sdk:Element",
5526
- responsiveStyles: {
5527
- large: {
5528
- paddingLeft: "20px",
5529
- paddingRight: "20px",
5530
- paddingTop: "10px",
5531
- paddingBottom: "10px",
5532
- minWidth: "100px",
5533
- textAlign: "center",
5534
- display: "flex",
5535
- flexDirection: "column",
5536
- cursor: "pointer",
5537
- userSelect: "none"
5538
- }
5539
- },
5540
- component: {
5541
- name: "Text",
5542
- options: {
5543
- text: "New tab"
5544
- }
5545
- }
5546
- };
5547
- var defaultElement = {
5548
- "@type": "@builder.io/sdk:Element",
5549
- responsiveStyles: {
5550
- large: {
5551
- height: "200px",
5552
- display: "flex",
5553
- marginTop: "20px",
5554
- flexDirection: "column"
5555
- }
5556
- },
5557
- component: {
5558
- name: "Text",
5559
- options: {
5560
- text: "New tab content "
5561
- }
5562
- }
5563
- };
5564
- var componentInfo8 = {
5565
- name: "Builder: Tabs",
5336
+ // src/blocks/columns/component-info.ts
5337
+ var componentInfo3 = {
5338
+ // TODO: ways to statically preprocess JSON for references, functions, etc
5339
+ name: "Columns",
5340
+ isRSC: true,
5566
5341
  inputs: [{
5567
- name: "tabs",
5568
- type: "list",
5342
+ name: "columns",
5343
+ type: "array",
5569
5344
  broadcast: true,
5570
5345
  subFields: [{
5571
- name: "label",
5572
- type: "uiBlocks",
5346
+ name: "blocks",
5347
+ type: "array",
5573
5348
  hideFromUI: true,
5574
- defaultValue: [defaultTab]
5349
+ defaultValue: [{
5350
+ "@type": "@builder.io/sdk:Element",
5351
+ responsiveStyles: {
5352
+ large: {
5353
+ display: "flex",
5354
+ flexDirection: "column",
5355
+ alignItems: "stretch",
5356
+ flexShrink: "0",
5357
+ position: "relative",
5358
+ marginTop: "30px",
5359
+ textAlign: "center",
5360
+ lineHeight: "normal",
5361
+ height: "auto",
5362
+ minHeight: "20px",
5363
+ minWidth: "20px",
5364
+ overflow: "hidden"
5365
+ }
5366
+ },
5367
+ component: {
5368
+ name: "Image",
5369
+ options: {
5370
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
5371
+ backgroundPosition: "center",
5372
+ backgroundSize: "cover",
5373
+ aspectRatio: 0.7004048582995948
5374
+ }
5375
+ }
5376
+ }, {
5377
+ "@type": "@builder.io/sdk:Element",
5378
+ responsiveStyles: {
5379
+ large: {
5380
+ display: "flex",
5381
+ flexDirection: "column",
5382
+ alignItems: "stretch",
5383
+ flexShrink: "0",
5384
+ position: "relative",
5385
+ marginTop: "30px",
5386
+ textAlign: "center",
5387
+ lineHeight: "normal",
5388
+ height: "auto"
5389
+ }
5390
+ },
5391
+ component: {
5392
+ name: "Text",
5393
+ options: {
5394
+ text: "<p>Enter some text...</p>"
5395
+ }
5396
+ }
5397
+ }]
5575
5398
  }, {
5576
- name: "content",
5577
- type: "uiBlocks",
5399
+ name: "width",
5400
+ type: "number",
5578
5401
  hideFromUI: true,
5579
- defaultValue: [defaultElement]
5402
+ helperText: "Width %, e.g. set to 50 to fill half of the space"
5403
+ }, {
5404
+ name: "link",
5405
+ type: "url",
5406
+ helperText: "Optionally set a url that clicking this column will link to"
5580
5407
  }],
5581
5408
  defaultValue: [{
5582
- label: [{
5583
- ...defaultTab,
5409
+ blocks: [{
5410
+ "@type": "@builder.io/sdk:Element",
5411
+ responsiveStyles: {
5412
+ large: {
5413
+ display: "flex",
5414
+ flexDirection: "column",
5415
+ alignItems: "stretch",
5416
+ flexShrink: "0",
5417
+ position: "relative",
5418
+ marginTop: "30px",
5419
+ textAlign: "center",
5420
+ lineHeight: "normal",
5421
+ height: "auto",
5422
+ minHeight: "20px",
5423
+ minWidth: "20px",
5424
+ overflow: "hidden"
5425
+ }
5426
+ },
5584
5427
  component: {
5585
- name: "Text",
5428
+ name: "Image",
5586
5429
  options: {
5587
- text: "Tab 1"
5430
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
5431
+ backgroundPosition: "center",
5432
+ backgroundSize: "cover",
5433
+ aspectRatio: 0.7004048582995948
5588
5434
  }
5589
5435
  }
5590
- }],
5591
- content: [{
5592
- ...defaultElement,
5436
+ }, {
5437
+ "@type": "@builder.io/sdk:Element",
5438
+ responsiveStyles: {
5439
+ large: {
5440
+ display: "flex",
5441
+ flexDirection: "column",
5442
+ alignItems: "stretch",
5443
+ flexShrink: "0",
5444
+ position: "relative",
5445
+ marginTop: "30px",
5446
+ textAlign: "center",
5447
+ lineHeight: "normal",
5448
+ height: "auto"
5449
+ }
5450
+ },
5593
5451
  component: {
5594
5452
  name: "Text",
5595
5453
  options: {
5596
- text: "Tab 1 content"
5454
+ text: "<p>Enter some text...</p>"
5597
5455
  }
5598
5456
  }
5599
5457
  }]
5600
5458
  }, {
5601
- label: [{
5602
- ...defaultTab,
5459
+ blocks: [{
5460
+ "@type": "@builder.io/sdk:Element",
5461
+ responsiveStyles: {
5462
+ large: {
5463
+ display: "flex",
5464
+ flexDirection: "column",
5465
+ alignItems: "stretch",
5466
+ flexShrink: "0",
5467
+ position: "relative",
5468
+ marginTop: "30px",
5469
+ textAlign: "center",
5470
+ lineHeight: "normal",
5471
+ height: "auto",
5472
+ minHeight: "20px",
5473
+ minWidth: "20px",
5474
+ overflow: "hidden"
5475
+ }
5476
+ },
5603
5477
  component: {
5604
- name: "Text",
5478
+ name: "Image",
5605
5479
  options: {
5606
- text: "Tab 2"
5480
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
5481
+ backgroundPosition: "center",
5482
+ backgroundSize: "cover",
5483
+ aspectRatio: 0.7004048582995948
5607
5484
  }
5608
5485
  }
5609
- }],
5610
- content: [{
5611
- ...defaultElement,
5486
+ }, {
5487
+ "@type": "@builder.io/sdk:Element",
5488
+ responsiveStyles: {
5489
+ large: {
5490
+ display: "flex",
5491
+ flexDirection: "column",
5492
+ alignItems: "stretch",
5493
+ flexShrink: "0",
5494
+ position: "relative",
5495
+ marginTop: "30px",
5496
+ textAlign: "center",
5497
+ lineHeight: "normal",
5498
+ height: "auto"
5499
+ }
5500
+ },
5612
5501
  component: {
5613
5502
  name: "Text",
5614
5503
  options: {
5615
- text: "Tab 2 content"
5504
+ text: "<p>Enter some text...</p>"
5616
5505
  }
5617
5506
  }
5618
5507
  }]
5619
- }]
5620
- }, {
5621
- name: "activeTabStyle",
5622
- type: "uiStyle",
5623
- helperText: "CSS styles for the active tab",
5624
- defaultValue: {
5625
- backgroundColor: "rgba(0, 0, 0, 0.1)"
5508
+ }],
5509
+ onChange: (options) => {
5510
+ function clearWidths() {
5511
+ columns.forEach((col) => {
5512
+ col.delete("width");
5513
+ });
5514
+ }
5515
+ const columns = options.get("columns");
5516
+ if (Array.isArray(columns)) {
5517
+ const containsColumnWithWidth = !!columns.find((col) => col.get("width"));
5518
+ if (containsColumnWithWidth) {
5519
+ const containsColumnWithoutWidth = !!columns.find((col) => !col.get("width"));
5520
+ if (containsColumnWithoutWidth) {
5521
+ clearWidths();
5522
+ } else {
5523
+ const sumWidths = columns.reduce((memo, col) => {
5524
+ return memo + col.get("width");
5525
+ }, 0);
5526
+ const widthsDontAddUp = sumWidths !== 100;
5527
+ if (widthsDontAddUp) {
5528
+ clearWidths();
5529
+ }
5530
+ }
5531
+ }
5532
+ }
5626
5533
  }
5627
5534
  }, {
5628
- name: "defaultActiveTab",
5535
+ name: "space",
5629
5536
  type: "number",
5630
- helperText: 'Default tab to open to. Set to "1" for the first tab, "2" for the second, or choose "0" for none',
5631
- defaultValue: 1,
5537
+ defaultValue: 20,
5538
+ helperText: "Size of gap between columns",
5632
5539
  advanced: true
5633
5540
  }, {
5634
- name: "collapsible",
5541
+ name: "stackColumnsAt",
5542
+ type: "string",
5543
+ defaultValue: "tablet",
5544
+ helperText: "Convert horizontal columns to vertical at what device size",
5545
+ enum: ["tablet", "mobile", "never"],
5546
+ advanced: true
5547
+ }, {
5548
+ name: "reverseColumnsWhenStacked",
5635
5549
  type: "boolean",
5636
- helperText: "If on, clicking an open tab closes it so no tabs are active",
5637
5550
  defaultValue: false,
5551
+ helperText: "When stacking columns for mobile devices, reverse the ordering",
5638
5552
  advanced: true
5553
+ }]
5554
+ };
5555
+
5556
+ // src/blocks/fragment/component-info.ts
5557
+ var componentInfo4 = {
5558
+ name: "Fragment",
5559
+ static: true,
5560
+ hidden: true,
5561
+ canHaveChildren: true,
5562
+ noWrap: true
5563
+ };
5564
+
5565
+ // src/blocks/image/component-info.ts
5566
+ var componentInfo5 = {
5567
+ name: "Image",
5568
+ static: true,
5569
+ 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",
5570
+ defaultStyles: {
5571
+ position: "relative",
5572
+ minHeight: "20px",
5573
+ minWidth: "20px",
5574
+ overflow: "hidden"
5575
+ },
5576
+ canHaveChildren: true,
5577
+ inputs: [{
5578
+ name: "image",
5579
+ type: "file",
5580
+ bubble: true,
5581
+ allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
5582
+ required: true,
5583
+ defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
5584
+ onChange: (options) => {
5585
+ const DEFAULT_ASPECT_RATIO = 0.7041;
5586
+ options.delete("srcset");
5587
+ options.delete("noWebp");
5588
+ function loadImage(url, timeout = 6e4) {
5589
+ return new Promise((resolve, reject) => {
5590
+ const img = document.createElement("img");
5591
+ let loaded = false;
5592
+ img.onload = () => {
5593
+ loaded = true;
5594
+ resolve(img);
5595
+ };
5596
+ img.addEventListener("error", (event) => {
5597
+ reject(event.error);
5598
+ });
5599
+ img.src = url;
5600
+ setTimeout(() => {
5601
+ if (!loaded) {
5602
+ reject(new Error("Image load timed out"));
5603
+ }
5604
+ }, timeout);
5605
+ });
5606
+ }
5607
+ function round2(num) {
5608
+ return Math.round(num * 1e3) / 1e3;
5609
+ }
5610
+ const value = options.get("image");
5611
+ const aspectRatio = options.get("aspectRatio");
5612
+ fetch(value).then((res) => res.blob()).then((blob) => {
5613
+ if (blob.type.includes("svg")) {
5614
+ options.set("noWebp", true);
5615
+ }
5616
+ });
5617
+ if (value && (!aspectRatio || aspectRatio === DEFAULT_ASPECT_RATIO)) {
5618
+ return loadImage(value).then((img) => {
5619
+ const possiblyUpdatedAspectRatio = options.get("aspectRatio");
5620
+ if (options.get("image") === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === DEFAULT_ASPECT_RATIO)) {
5621
+ if (img.width && img.height) {
5622
+ options.set("aspectRatio", round2(img.height / img.width));
5623
+ options.set("height", img.height);
5624
+ options.set("width", img.width);
5625
+ }
5626
+ }
5627
+ });
5628
+ }
5629
+ }
5639
5630
  }, {
5640
- name: "tabHeaderLayout",
5641
- type: "enum",
5642
- helperText: "Change the layout of the tab headers (uses justify-content)",
5643
- defaultValue: "flex-start",
5631
+ name: "backgroundSize",
5632
+ type: "text",
5633
+ defaultValue: "cover",
5644
5634
  enum: [{
5645
- label: "Center",
5646
- value: "center"
5647
- }, {
5648
- label: "Space between",
5649
- value: "space-between"
5650
- }, {
5651
- label: "Space around",
5652
- value: "space-around"
5653
- }, {
5654
- label: "Left",
5655
- value: "flex-start"
5635
+ label: "contain",
5636
+ value: "contain",
5637
+ helperText: "The image should never get cropped"
5656
5638
  }, {
5657
- label: "Right",
5658
- value: "flex-end"
5639
+ label: "cover",
5640
+ value: "cover",
5641
+ helperText: "The image should fill it's box, cropping when needed"
5659
5642
  }]
5643
+ }, {
5644
+ name: "backgroundPosition",
5645
+ type: "text",
5646
+ defaultValue: "center",
5647
+ enum: ["center", "top", "left", "right", "bottom", "top left", "top right", "bottom left", "bottom right"]
5648
+ }, {
5649
+ name: "altText",
5650
+ type: "string",
5651
+ helperText: "Text to display when the user has images off"
5652
+ }, {
5653
+ name: "height",
5654
+ type: "number",
5655
+ hideFromUI: true
5656
+ }, {
5657
+ name: "width",
5658
+ type: "number",
5659
+ hideFromUI: true
5660
+ }, {
5661
+ name: "sizes",
5662
+ type: "string",
5663
+ hideFromUI: true
5664
+ }, {
5665
+ name: "srcset",
5666
+ type: "string",
5667
+ hideFromUI: true
5668
+ }, {
5669
+ name: "lazy",
5670
+ type: "boolean",
5671
+ defaultValue: true,
5672
+ hideFromUI: true
5673
+ }, {
5674
+ name: "fitContent",
5675
+ type: "boolean",
5676
+ helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
5677
+ defaultValue: true
5678
+ }, {
5679
+ name: "aspectRatio",
5680
+ type: "number",
5681
+ 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",
5682
+ advanced: true,
5683
+ defaultValue: 0.7041
5660
5684
  }]
5661
5685
  };
5662
5686
 
5663
- // src/blocks/tabs/tabs.tsx
5664
- import { Show as Show8, For as For5, createSignal as createSignal9 } from "solid-js";
5665
- function Tabs(props) {
5666
- const [activeTab, setActiveTab] = createSignal9(
5667
- props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
5668
- );
5669
- function activeTabContent(active) {
5670
- return props.tabs && props.tabs[active].content;
5671
- }
5672
- function onClick(index) {
5673
- if (index === activeTab() && props.collapsible) {
5674
- setActiveTab(-1);
5675
- } else {
5676
- setActiveTab(index);
5677
- }
5678
- }
5679
- return <div>
5680
- <div
5681
- class="builder-tabs-wrap"
5682
- style={{
5683
- display: "flex",
5684
- "flex-direction": "row",
5685
- "justify-content": props.tabHeaderLayout || "flex-start",
5686
- overflow: "auto"
5687
- }}
5688
- ><For5 each={props.tabs}>{(tab, _index) => {
5689
- const index = _index();
5690
- return <span
5691
- class={`builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`}
5692
- key={index}
5693
- style={{
5694
- ...activeTab() === index ? props.activeTabStyle : {}
5695
- }}
5696
- onClick={(event) => onClick(index)}
5697
- ><Blocks_default
5698
- parent={props.builderBlock.id}
5699
- path={`component.options.tabs.${index}.label`}
5700
- blocks={tab.label}
5701
- context={props.builderContext}
5702
- registeredComponents={props.builderComponents}
5703
- linkComponent={props.builderLinkComponent}
5704
- /></span>;
5705
- }}</For5></div>
5706
- <Show8 when={activeTabContent(activeTab())}><div><Blocks_default
5707
- parent={props.builderBlock.id}
5708
- path={`component.options.tabs.${activeTab()}.content`}
5709
- blocks={activeTabContent(activeTab())}
5710
- context={props.builderContext}
5711
- registeredComponents={props.builderComponents}
5712
- linkComponent={props.builderLinkComponent}
5713
- /></div></Show8>
5714
- </div>;
5715
- }
5716
- var tabs_default = Tabs;
5717
-
5718
- // src/blocks/text/component-info.ts
5719
- var componentInfo9 = {
5720
- name: "Text",
5687
+ // src/blocks/section/component-info.ts
5688
+ var componentInfo6 = {
5689
+ name: "Core:Section",
5721
5690
  static: true,
5691
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
5692
+ inputs: [{
5693
+ name: "maxWidth",
5694
+ type: "number",
5695
+ defaultValue: 1200
5696
+ }, {
5697
+ name: "lazyLoad",
5698
+ type: "boolean",
5699
+ defaultValue: false,
5700
+ advanced: true,
5701
+ description: "Only render this section when in view"
5702
+ }],
5703
+ defaultStyles: {
5704
+ paddingLeft: "20px",
5705
+ paddingRight: "20px",
5706
+ paddingTop: "50px",
5707
+ paddingBottom: "50px",
5708
+ marginTop: "0px",
5709
+ width: "100vw",
5710
+ marginLeft: "calc(50% - 50vw)"
5711
+ },
5712
+ canHaveChildren: true,
5713
+ defaultChildren: [{
5714
+ "@type": "@builder.io/sdk:Element",
5715
+ responsiveStyles: {
5716
+ large: {
5717
+ textAlign: "center"
5718
+ }
5719
+ },
5720
+ component: {
5721
+ name: "Text",
5722
+ options: {
5723
+ 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>"
5724
+ }
5725
+ }
5726
+ }]
5727
+ };
5728
+
5729
+ // src/blocks/slot/component-info.ts
5730
+ var componentInfo7 = {
5731
+ name: "Slot",
5722
5732
  isRSC: true,
5723
- image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",
5733
+ description: "Allow child blocks to be inserted into this content when used as a Symbol",
5734
+ docsLink: "https://www.builder.io/c/docs/symbols-with-blocks",
5735
+ image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",
5736
+ // Maybe wrap this for canHaveChildren so bind children to this hm
5724
5737
  inputs: [{
5725
- name: "text",
5726
- type: "html",
5738
+ name: "name",
5739
+ type: "string",
5727
5740
  required: true,
5728
- autoFocus: true,
5729
- bubble: true,
5730
- defaultValue: "Enter some text..."
5731
- }],
5732
- defaultStyles: {
5733
- lineHeight: "normal",
5734
- height: "auto",
5735
- textAlign: "center"
5736
- }
5741
+ defaultValue: "children"
5742
+ }]
5737
5743
  };
5738
5744
 
5739
- // src/blocks/text/text.tsx
5740
- function Text(props) {
5745
+ // src/blocks/slot/slot.tsx
5746
+ function Slot(props) {
5741
5747
  return <div
5742
- class="builder-text"
5743
- innerHTML={props.text?.toString() || ""}
5744
5748
  style={{
5745
- outline: "none"
5749
+ "pointer-events": "auto"
5746
5750
  }}
5747
- />;
5751
+ {...!props.builderContext.context?.symbolId && {
5752
+ "builder-slot": props.name
5753
+ }}
5754
+ ><Blocks_default
5755
+ parent={props.builderContext.context?.symbolId}
5756
+ path={`symbol.data.${props.name}`}
5757
+ context={props.builderContext}
5758
+ blocks={props.builderContext.rootState?.[props.name]}
5759
+ /></div>;
5748
5760
  }
5749
- var text_default = Text;
5750
-
5751
- // src/blocks/accordion/accordion.tsx
5752
- import { Show as Show9, For as For6, createSignal as createSignal10, createMemo as createMemo10 } from "solid-js";
5761
+ var slot_default = Slot;
5753
5762
 
5754
- // src/blocks/accordion/helpers.ts
5755
- var convertOrderNumberToString = (order) => {
5756
- return order.toString();
5763
+ // src/blocks/symbol/component-info.ts
5764
+ var componentInfo8 = {
5765
+ name: "Symbol",
5766
+ noWrap: true,
5767
+ static: true,
5768
+ isRSC: true,
5769
+ inputs: [{
5770
+ name: "symbol",
5771
+ type: "uiSymbol"
5772
+ }, {
5773
+ name: "dataOnly",
5774
+ helperText: "Make this a data symbol that doesn't display any UI",
5775
+ type: "boolean",
5776
+ defaultValue: false,
5777
+ advanced: true,
5778
+ hideFromUI: true
5779
+ }, {
5780
+ name: "inheritState",
5781
+ helperText: "Inherit the parent component state and data",
5782
+ type: "boolean",
5783
+ defaultValue: false,
5784
+ advanced: true
5785
+ }, {
5786
+ name: "renderToLiquid",
5787
+ helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
5788
+ type: "boolean",
5789
+ defaultValue: false,
5790
+ advanced: true,
5791
+ hideFromUI: true
5792
+ }, {
5793
+ name: "useChildren",
5794
+ hideFromUI: true,
5795
+ type: "boolean"
5796
+ }]
5757
5797
  };
5758
5798
 
5759
- // src/blocks/accordion/accordion.tsx
5760
- function Accordion(props) {
5761
- const [open, setOpen] = createSignal10([]);
5762
- const onlyOneAtATime = createMemo10(() => {
5763
- return Boolean(props.grid || props.oneAtATime);
5764
- });
5765
- const accordionStyles = createMemo10(() => {
5766
- const styles = {
5767
- display: "flex",
5768
- alignItems: "stretch",
5769
- flexDirection: "column",
5770
- ...props.grid && {
5771
- flexDirection: "row",
5772
- alignItems: "flex-start",
5773
- flexWrap: "wrap"
5774
- }
5775
- };
5776
- return Object.fromEntries(
5777
- Object.entries(styles).map(([key, value]) => [
5778
- camelToKebabCase(key),
5779
- value
5780
- ])
5781
- );
5782
- });
5783
- const accordionTitleStyles = createMemo10(() => {
5784
- const shared = {
5785
- display: "flex",
5786
- flexDirection: "column"
5787
- };
5788
- const styles = Object.fromEntries(
5789
- Object.entries({
5790
- ...shared,
5791
- alignItems: "stretch",
5792
- cursor: "pointer"
5793
- }).map(([key, value]) => [camelToKebabCase(key), value])
5794
- );
5795
- return Object.fromEntries(
5796
- Object.entries(styles).filter(([_, value]) => value !== void 0)
5797
- );
5798
- });
5799
- function getAccordionTitleClassName(index) {
5800
- return `builder-accordion-title builder-accordion-title-${open().includes(index) ? "open" : "closed"}`;
5801
- }
5802
- function getAccordionDetailClassName(index) {
5803
- return `builder-accordion-detail builder-accordion-detail-${open().includes(index) ? "open" : "closed"}`;
5804
- }
5805
- const openGridItemOrder = createMemo10(() => {
5806
- let itemOrder = null;
5807
- const getOpenGridItemPosition = props.grid && open().length;
5808
- if (getOpenGridItemPosition && document) {
5809
- const openItemIndex = open()[0];
5810
- const openItem = document.querySelector(
5811
- `.builder-accordion-title[data-index="${openItemIndex}"]`
5812
- );
5813
- let subjectItem = openItem;
5814
- itemOrder = openItemIndex;
5815
- if (subjectItem) {
5816
- let prevItemRect = subjectItem.getBoundingClientRect();
5817
- while (subjectItem = subjectItem && subjectItem.nextElementSibling) {
5818
- if (subjectItem) {
5819
- if (subjectItem.classList.contains("builder-accordion-detail")) {
5820
- continue;
5821
- }
5822
- const subjectItemRect = subjectItem.getBoundingClientRect();
5823
- if (subjectItemRect.left > prevItemRect.left) {
5824
- const index = parseInt(
5825
- subjectItem.getAttribute("data-index") || "",
5826
- 10
5827
- );
5828
- if (!isNaN(index)) {
5829
- prevItemRect = subjectItemRect;
5830
- itemOrder = index;
5831
- }
5832
- } else {
5833
- break;
5834
- }
5835
- }
5836
- }
5837
- }
5838
- }
5839
- if (typeof itemOrder === "number") {
5840
- itemOrder = itemOrder + 1;
5841
- }
5842
- return itemOrder;
5843
- });
5844
- const accordionDetailStyles = createMemo10(() => {
5845
- const styles = {
5846
- ...{
5847
- order: typeof openGridItemOrder() === "number" ? openGridItemOrder() : void 0
5848
- },
5849
- ...props.grid && {
5850
- width: "100%"
5851
- }
5852
- };
5853
- return Object.fromEntries(
5854
- Object.entries(styles).filter(([_, value]) => value !== void 0)
5855
- );
5856
- });
5857
- function onClick(index) {
5858
- if (open().includes(index)) {
5859
- setOpen(onlyOneAtATime() ? [] : open().filter((item) => item !== index));
5860
- } else {
5861
- setOpen(onlyOneAtATime() ? [index] : open().concat(index));
5862
- }
5863
- }
5864
- return <div class="builder-accordion" style={accordionStyles()}><For6 each={props.items}>{(item, _index) => {
5865
- const index = _index();
5866
- return <>
5867
- <div
5868
- class={getAccordionTitleClassName(index)}
5869
- style={{
5870
- ...accordionTitleStyles(),
5871
- width: props.grid ? props.gridRowWidth : void 0,
5872
- ...{
5873
- order: openGridItemOrder() !== null ? convertOrderNumberToString(index) : convertOrderNumberToString(index + 1)
5874
- }
5875
- }}
5876
- data-index={index}
5877
- onClick={(event) => onClick(index)}
5878
- ><Blocks_default
5879
- blocks={item.title}
5880
- path={`items.${index}.title`}
5881
- parent={props.builderBlock.id}
5882
- context={props.builderContext}
5883
- registeredComponents={props.builderComponents}
5884
- linkComponent={props.builderLinkComponent}
5885
- /></div>
5886
- <Show9 when={open().includes(index)}><div
5887
- class={getAccordionDetailClassName(index)}
5888
- style={accordionDetailStyles()}
5889
- ><Blocks_default
5890
- blocks={item.detail}
5891
- path={`items.${index}.detail`}
5892
- parent={props.builderBlock.id}
5893
- context={props.builderContext}
5894
- registeredComponents={props.builderComponents}
5895
- linkComponent={props.builderLinkComponent}
5896
- /></div></Show9>
5897
- </>;
5898
- }}</For6></div>;
5899
- }
5900
- var accordion_default = Accordion;
5901
-
5902
- // src/blocks/accordion/component-info.ts
5903
- var defaultTitle = {
5799
+ // src/blocks/tabs/component-info.ts
5800
+ var defaultTab = {
5904
5801
  "@type": "@builder.io/sdk:Element",
5905
- layerName: "Accordion item title",
5906
5802
  responsiveStyles: {
5907
5803
  large: {
5908
- marginTop: "10px",
5909
- position: "relative",
5804
+ paddingLeft: "20px",
5805
+ paddingRight: "20px",
5806
+ paddingTop: "10px",
5807
+ paddingBottom: "10px",
5808
+ minWidth: "100px",
5809
+ textAlign: "center",
5910
5810
  display: "flex",
5911
- alignItems: "stretch",
5912
5811
  flexDirection: "column",
5913
- paddingBottom: "10px"
5812
+ cursor: "pointer",
5813
+ userSelect: "none"
5914
5814
  }
5915
5815
  },
5916
- children: [{
5917
- "@type": "@builder.io/sdk:Element",
5918
- responsiveStyles: {
5919
- large: {
5920
- textAlign: "left",
5921
- display: "flex",
5922
- flexDirection: "column"
5923
- }
5924
- },
5925
- component: {
5926
- name: "Text",
5927
- options: {
5928
- text: "I am an accordion title. Click me!"
5929
- }
5816
+ component: {
5817
+ name: "Text",
5818
+ options: {
5819
+ text: "New tab"
5930
5820
  }
5931
- }]
5821
+ }
5932
5822
  };
5933
- var defaultDetail = {
5823
+ var defaultElement = {
5934
5824
  "@type": "@builder.io/sdk:Element",
5935
- layerName: "Accordion item detail",
5936
5825
  responsiveStyles: {
5937
5826
  large: {
5938
- position: "relative",
5827
+ height: "200px",
5939
5828
  display: "flex",
5940
- alignItems: "stretch",
5941
- flexDirection: "column",
5942
- marginTop: "10px",
5943
- paddingBottom: "10px"
5829
+ marginTop: "20px",
5830
+ flexDirection: "column"
5944
5831
  }
5945
5832
  },
5946
- children: [{
5947
- "@type": "@builder.io/sdk:Element",
5948
- responsiveStyles: {
5949
- large: {
5950
- paddingTop: "50px",
5951
- textAlign: "left",
5952
- display: "flex",
5953
- flexDirection: "column",
5954
- paddingBottom: "50px"
5955
- }
5956
- },
5957
- component: {
5958
- name: "Text",
5959
- options: {
5960
- text: "I am an accordion detail, hello!"
5961
- }
5833
+ component: {
5834
+ name: "Text",
5835
+ options: {
5836
+ text: "New tab content "
5962
5837
  }
5963
- }]
5838
+ }
5964
5839
  };
5965
- var componentInfo10 = {
5966
- name: "Builder:Accordion",
5967
- canHaveChildren: true,
5968
- image: "https://cdn.builder.io/api/v1/image/assets%2FagZ9n5CUKRfbL9t6CaJOyVSK4Es2%2Ffab6c1fd3fe542408cbdec078bca7f35",
5969
- defaultStyles: {
5970
- display: "flex",
5971
- flexDirection: "column",
5972
- alignItems: "stretch"
5973
- },
5840
+ var componentInfo9 = {
5841
+ name: "Builder: Tabs",
5974
5842
  inputs: [{
5975
- name: "items",
5843
+ name: "tabs",
5976
5844
  type: "list",
5977
5845
  broadcast: true,
5978
5846
  subFields: [{
5979
- name: "title",
5847
+ name: "label",
5980
5848
  type: "uiBlocks",
5981
5849
  hideFromUI: true,
5982
- defaultValue: [defaultTitle]
5850
+ defaultValue: [defaultTab]
5983
5851
  }, {
5984
- name: "detail",
5852
+ name: "content",
5985
5853
  type: "uiBlocks",
5986
5854
  hideFromUI: true,
5987
- defaultValue: [defaultDetail]
5855
+ defaultValue: [defaultElement]
5988
5856
  }],
5989
5857
  defaultValue: [{
5990
- title: [defaultTitle],
5991
- detail: [defaultDetail]
5858
+ label: [{
5859
+ ...defaultTab,
5860
+ component: {
5861
+ name: "Text",
5862
+ options: {
5863
+ text: "Tab 1"
5864
+ }
5865
+ }
5866
+ }],
5867
+ content: [{
5868
+ ...defaultElement,
5869
+ component: {
5870
+ name: "Text",
5871
+ options: {
5872
+ text: "Tab 1 content"
5873
+ }
5874
+ }
5875
+ }]
5992
5876
  }, {
5993
- title: [defaultTitle],
5994
- detail: [defaultDetail]
5995
- }],
5996
- showIf: (options) => !options.get("useChildrenForItems")
5997
- }, {
5998
- name: "oneAtATime",
5999
- helperText: "Only allow opening one at a time (collapse all others when new item openned)",
6000
- type: "boolean",
6001
- defaultValue: false
5877
+ label: [{
5878
+ ...defaultTab,
5879
+ component: {
5880
+ name: "Text",
5881
+ options: {
5882
+ text: "Tab 2"
5883
+ }
5884
+ }
5885
+ }],
5886
+ content: [{
5887
+ ...defaultElement,
5888
+ component: {
5889
+ name: "Text",
5890
+ options: {
5891
+ text: "Tab 2 content"
5892
+ }
5893
+ }
5894
+ }]
5895
+ }]
6002
5896
  }, {
6003
- name: "grid",
6004
- helperText: "Display as a grid",
6005
- type: "boolean",
6006
- defaultValue: false
5897
+ name: "activeTabStyle",
5898
+ type: "uiStyle",
5899
+ helperText: "CSS styles for the active tab",
5900
+ defaultValue: {
5901
+ backgroundColor: "rgba(0, 0, 0, 0.1)"
5902
+ }
6007
5903
  }, {
6008
- name: "gridRowWidth",
6009
- helperText: "Display as a grid",
6010
- type: "string",
6011
- showIf: (options) => options.get("grid"),
6012
- defaultValue: "25%"
5904
+ name: "defaultActiveTab",
5905
+ type: "number",
5906
+ helperText: 'Default tab to open to. Set to "1" for the first tab, "2" for the second, or choose "0" for none',
5907
+ defaultValue: 1,
5908
+ advanced: true
6013
5909
  }, {
6014
- name: "useChildrenForItems",
5910
+ name: "collapsible",
6015
5911
  type: "boolean",
6016
- helperText: "Use child elements for each slide, instead of the array. Useful for dynamically repeating items",
6017
- advanced: true,
5912
+ helperText: "If on, clicking an open tab closes it so no tabs are active",
6018
5913
  defaultValue: false,
6019
- onChange: (options) => {
6020
- if (options.get("useChildrenForItems") === true) {
6021
- options.set("items", []);
6022
- }
6023
- }
5914
+ advanced: true
5915
+ }, {
5916
+ name: "tabHeaderLayout",
5917
+ type: "enum",
5918
+ helperText: "Change the layout of the tab headers (uses justify-content)",
5919
+ defaultValue: "flex-start",
5920
+ enum: [{
5921
+ label: "Center",
5922
+ value: "center"
5923
+ }, {
5924
+ label: "Space between",
5925
+ value: "space-between"
5926
+ }, {
5927
+ label: "Space around",
5928
+ value: "space-around"
5929
+ }, {
5930
+ label: "Left",
5931
+ value: "flex-start"
5932
+ }, {
5933
+ label: "Right",
5934
+ value: "flex-end"
5935
+ }]
6024
5936
  }]
6025
5937
  };
6026
5938
 
5939
+ // src/blocks/tabs/tabs.tsx
5940
+ import { Show as Show9, For as For6, createSignal as createSignal10 } from "solid-js";
5941
+ function Tabs(props) {
5942
+ const [activeTab, setActiveTab] = createSignal10(
5943
+ props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
5944
+ );
5945
+ function activeTabContent(active) {
5946
+ return props.tabs && props.tabs[active].content;
5947
+ }
5948
+ function onClick(index) {
5949
+ if (index === activeTab() && props.collapsible) {
5950
+ setActiveTab(-1);
5951
+ } else {
5952
+ setActiveTab(index);
5953
+ }
5954
+ }
5955
+ return <div>
5956
+ <div
5957
+ class="builder-tabs-wrap"
5958
+ style={{
5959
+ display: "flex",
5960
+ "flex-direction": "row",
5961
+ "justify-content": props.tabHeaderLayout || "flex-start",
5962
+ overflow: "auto"
5963
+ }}
5964
+ ><For6 each={props.tabs}>{(tab, _index) => {
5965
+ const index = _index();
5966
+ return <span
5967
+ class={`builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`}
5968
+ key={index}
5969
+ style={{
5970
+ ...activeTab() === index ? props.activeTabStyle : {}
5971
+ }}
5972
+ onClick={(event) => onClick(index)}
5973
+ ><Blocks_default
5974
+ parent={props.builderBlock.id}
5975
+ path={`component.options.tabs.${index}.label`}
5976
+ blocks={tab.label}
5977
+ context={props.builderContext}
5978
+ registeredComponents={props.builderComponents}
5979
+ linkComponent={props.builderLinkComponent}
5980
+ /></span>;
5981
+ }}</For6></div>
5982
+ <Show9 when={activeTabContent(activeTab())}><div><Blocks_default
5983
+ parent={props.builderBlock.id}
5984
+ path={`component.options.tabs.${activeTab()}.content`}
5985
+ blocks={activeTabContent(activeTab())}
5986
+ context={props.builderContext}
5987
+ registeredComponents={props.builderComponents}
5988
+ linkComponent={props.builderLinkComponent}
5989
+ /></div></Show9>
5990
+ </div>;
5991
+ }
5992
+ var tabs_default = Tabs;
5993
+
5994
+ // src/blocks/text/component-info.ts
5995
+ var componentInfo10 = {
5996
+ name: "Text",
5997
+ static: true,
5998
+ isRSC: true,
5999
+ 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",
6000
+ inputs: [{
6001
+ name: "text",
6002
+ type: "html",
6003
+ required: true,
6004
+ autoFocus: true,
6005
+ bubble: true,
6006
+ defaultValue: "Enter some text..."
6007
+ }],
6008
+ defaultStyles: {
6009
+ lineHeight: "normal",
6010
+ height: "auto",
6011
+ textAlign: "center"
6012
+ }
6013
+ };
6014
+
6015
+ // src/blocks/text/text.tsx
6016
+ function Text(props) {
6017
+ return <div
6018
+ class="builder-text"
6019
+ innerHTML={props.text?.toString() || ""}
6020
+ style={{
6021
+ outline: "none"
6022
+ }}
6023
+ />;
6024
+ }
6025
+ var text_default = Text;
6026
+
6027
6027
  // src/blocks/custom-code/component-info.ts
6028
6028
  var componentInfo11 = {
6029
6029
  name: "Custom Code",
@@ -6462,13 +6462,11 @@ function FormComponent(props) {
6462
6462
  return;
6463
6463
  }
6464
6464
  event.preventDefault();
6465
- const el = event.currentTarget;
6465
+ const el = event.currentTarget || event.target;
6466
6466
  const headers = props.customHeaders || {};
6467
6467
  let body;
6468
6468
  const formData = new FormData(el);
6469
- const formPairs = Array.from(
6470
- event.currentTarget.querySelectorAll("input,select,textarea")
6471
- ).filter((el2) => !!el2.name).map((el2) => {
6469
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
6472
6470
  let value;
6473
6471
  const key = el2.name;
6474
6472
  if (el2 instanceof HTMLInputElement) {
@@ -6631,6 +6629,7 @@ function FormComponent(props) {
6631
6629
  name={props.name}
6632
6630
  onSubmit={(event) => onSubmit(event)}
6633
6631
  {...{}}
6632
+ {...{}}
6634
6633
  {...props.attributes}
6635
6634
  >
6636
6635
  <Show10 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
@@ -7069,34 +7068,34 @@ var getExtraComponents = () => [{
7069
7068
  // src/constants/builder-registered-components.ts
7070
7069
  var getDefaultRegisteredComponents = () => [{
7071
7070
  component: button_default,
7072
- ...componentInfo
7071
+ ...componentInfo2
7073
7072
  }, {
7074
7073
  component: columns_default,
7075
- ...componentInfo2
7074
+ ...componentInfo3
7076
7075
  }, {
7077
7076
  component: fragment_default,
7078
- ...componentInfo3
7077
+ ...componentInfo4
7079
7078
  }, {
7080
7079
  component: image_default,
7081
- ...componentInfo4
7080
+ ...componentInfo5
7082
7081
  }, {
7083
7082
  component: section_default,
7084
- ...componentInfo5
7083
+ ...componentInfo6
7085
7084
  }, {
7086
7085
  component: slot_default,
7087
- ...componentInfo6
7086
+ ...componentInfo7
7088
7087
  }, {
7089
7088
  component: symbol_default,
7090
- ...componentInfo7
7089
+ ...componentInfo8
7091
7090
  }, {
7092
7091
  component: text_default,
7093
- ...componentInfo9
7092
+ ...componentInfo10
7094
7093
  }, ...TARGET === "rsc" ? [] : [{
7095
7094
  component: tabs_default,
7096
- ...componentInfo8
7095
+ ...componentInfo9
7097
7096
  }, {
7098
7097
  component: accordion_default,
7099
- ...componentInfo10
7098
+ ...componentInfo
7100
7099
  }], ...getExtraComponents()];
7101
7100
 
7102
7101
  // src/functions/register-component.ts
@@ -7675,7 +7674,7 @@ function isFromTrustedHost(trustedHosts, e) {
7675
7674
  }
7676
7675
 
7677
7676
  // src/constants/sdk-version.ts
7678
- var SDK_VERSION = "1.0.28";
7677
+ var SDK_VERSION = "1.0.30";
7679
7678
 
7680
7679
  // src/functions/register.ts
7681
7680
  var registry = {};
@@ -8154,7 +8153,7 @@ function EnableEditor(props) {
8154
8153
  const searchParams = new URL(location.href).searchParams;
8155
8154
  const searchParamPreviewModel = searchParams.get("builder.preview");
8156
8155
  const searchParamPreviewId = searchParams.get(
8157
- `builder.preview.${searchParamPreviewModel}`
8156
+ `builder.overrides.${searchParamPreviewModel}`
8158
8157
  );
8159
8158
  const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
8160
8159
  if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {