@builder.io/sdk-solid 1.0.28 → 1.0.29

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.
@@ -2023,1009 +2023,1009 @@ var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : tru
2023
2023
  // src/components/content/content.tsx
2024
2024
  import { Show as Show13, createSignal as createSignal17 } from "solid-js";
2025
2025
 
2026
- // src/blocks/button/component-info.ts
2027
- var componentInfo = {
2028
- name: "Core:Button",
2029
- image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
2030
- defaultStyles: {
2031
- // TODO: make min width more intuitive and set one
2032
- appearance: "none",
2033
- paddingTop: "15px",
2034
- paddingBottom: "15px",
2035
- paddingLeft: "25px",
2036
- paddingRight: "25px",
2037
- backgroundColor: "#000000",
2038
- color: "white",
2039
- borderRadius: "4px",
2040
- textAlign: "center",
2041
- cursor: "pointer"
2026
+ // src/blocks/accordion/component-info.ts
2027
+ var defaultTitle = {
2028
+ "@type": "@builder.io/sdk:Element",
2029
+ layerName: "Accordion item title",
2030
+ responsiveStyles: {
2031
+ large: {
2032
+ marginTop: "10px",
2033
+ position: "relative",
2034
+ display: "flex",
2035
+ alignItems: "stretch",
2036
+ flexDirection: "column",
2037
+ paddingBottom: "10px"
2038
+ }
2042
2039
  },
2043
- inputs: [{
2044
- name: "text",
2045
- type: "text",
2046
- defaultValue: "Click me!",
2047
- bubble: true
2048
- }, {
2049
- name: "link",
2050
- type: "url",
2051
- bubble: true
2052
- }, {
2053
- name: "openLinkInNewTab",
2054
- type: "boolean",
2055
- defaultValue: false,
2056
- friendlyName: "Open link in new tab"
2057
- }],
2058
- static: true,
2059
- noWrap: true
2060
- };
2061
-
2062
- // src/blocks/columns/component-info.ts
2063
- var componentInfo2 = {
2064
- // TODO: ways to statically preprocess JSON for references, functions, etc
2065
- name: "Columns",
2066
- isRSC: true,
2067
- inputs: [{
2068
- name: "columns",
2069
- type: "array",
2070
- broadcast: true,
2071
- subFields: [{
2072
- name: "blocks",
2073
- type: "array",
2074
- hideFromUI: true,
2075
- defaultValue: [{
2076
- "@type": "@builder.io/sdk:Element",
2077
- responsiveStyles: {
2078
- large: {
2079
- display: "flex",
2080
- flexDirection: "column",
2081
- alignItems: "stretch",
2082
- flexShrink: "0",
2083
- position: "relative",
2084
- marginTop: "30px",
2085
- textAlign: "center",
2086
- lineHeight: "normal",
2087
- height: "auto",
2088
- minHeight: "20px",
2089
- minWidth: "20px",
2090
- overflow: "hidden"
2091
- }
2092
- },
2093
- component: {
2094
- name: "Image",
2095
- options: {
2096
- image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
2097
- backgroundPosition: "center",
2098
- backgroundSize: "cover",
2099
- aspectRatio: 0.7004048582995948
2100
- }
2101
- }
2102
- }, {
2103
- "@type": "@builder.io/sdk:Element",
2104
- responsiveStyles: {
2105
- large: {
2106
- display: "flex",
2107
- flexDirection: "column",
2108
- alignItems: "stretch",
2109
- flexShrink: "0",
2110
- position: "relative",
2111
- marginTop: "30px",
2112
- textAlign: "center",
2113
- lineHeight: "normal",
2114
- height: "auto"
2115
- }
2116
- },
2117
- component: {
2118
- name: "Text",
2119
- options: {
2120
- text: "<p>Enter some text...</p>"
2121
- }
2122
- }
2123
- }]
2124
- }, {
2125
- name: "width",
2126
- type: "number",
2127
- hideFromUI: true,
2128
- helperText: "Width %, e.g. set to 50 to fill half of the space"
2129
- }, {
2130
- name: "link",
2131
- type: "url",
2132
- helperText: "Optionally set a url that clicking this column will link to"
2133
- }],
2134
- defaultValue: [{
2135
- blocks: [{
2136
- "@type": "@builder.io/sdk:Element",
2137
- responsiveStyles: {
2138
- large: {
2139
- display: "flex",
2140
- flexDirection: "column",
2141
- alignItems: "stretch",
2142
- flexShrink: "0",
2143
- position: "relative",
2144
- marginTop: "30px",
2145
- textAlign: "center",
2146
- lineHeight: "normal",
2147
- height: "auto",
2148
- minHeight: "20px",
2149
- minWidth: "20px",
2150
- overflow: "hidden"
2151
- }
2152
- },
2153
- component: {
2154
- name: "Image",
2155
- options: {
2156
- image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
2157
- backgroundPosition: "center",
2158
- backgroundSize: "cover",
2159
- aspectRatio: 0.7004048582995948
2160
- }
2161
- }
2162
- }, {
2163
- "@type": "@builder.io/sdk:Element",
2164
- responsiveStyles: {
2165
- large: {
2166
- display: "flex",
2167
- flexDirection: "column",
2168
- alignItems: "stretch",
2169
- flexShrink: "0",
2170
- position: "relative",
2171
- marginTop: "30px",
2172
- textAlign: "center",
2173
- lineHeight: "normal",
2174
- height: "auto"
2175
- }
2176
- },
2177
- component: {
2178
- name: "Text",
2179
- options: {
2180
- text: "<p>Enter some text...</p>"
2181
- }
2182
- }
2183
- }]
2184
- }, {
2185
- blocks: [{
2186
- "@type": "@builder.io/sdk:Element",
2187
- responsiveStyles: {
2188
- large: {
2189
- display: "flex",
2190
- flexDirection: "column",
2191
- alignItems: "stretch",
2192
- flexShrink: "0",
2193
- position: "relative",
2194
- marginTop: "30px",
2195
- textAlign: "center",
2196
- lineHeight: "normal",
2197
- height: "auto",
2198
- minHeight: "20px",
2199
- minWidth: "20px",
2200
- overflow: "hidden"
2201
- }
2202
- },
2203
- component: {
2204
- name: "Image",
2205
- options: {
2206
- image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
2207
- backgroundPosition: "center",
2208
- backgroundSize: "cover",
2209
- aspectRatio: 0.7004048582995948
2210
- }
2211
- }
2212
- }, {
2213
- "@type": "@builder.io/sdk:Element",
2214
- responsiveStyles: {
2215
- large: {
2216
- display: "flex",
2217
- flexDirection: "column",
2218
- alignItems: "stretch",
2219
- flexShrink: "0",
2220
- position: "relative",
2221
- marginTop: "30px",
2222
- textAlign: "center",
2223
- lineHeight: "normal",
2224
- height: "auto"
2225
- }
2226
- },
2227
- component: {
2228
- name: "Text",
2229
- options: {
2230
- text: "<p>Enter some text...</p>"
2231
- }
2232
- }
2233
- }]
2234
- }],
2235
- onChange: (options) => {
2236
- function clearWidths() {
2237
- columns.forEach((col) => {
2238
- col.delete("width");
2239
- });
2040
+ children: [{
2041
+ "@type": "@builder.io/sdk:Element",
2042
+ responsiveStyles: {
2043
+ large: {
2044
+ textAlign: "left",
2045
+ display: "flex",
2046
+ flexDirection: "column"
2240
2047
  }
2241
- const columns = options.get("columns");
2242
- if (Array.isArray(columns)) {
2243
- const containsColumnWithWidth = !!columns.find((col) => col.get("width"));
2244
- if (containsColumnWithWidth) {
2245
- const containsColumnWithoutWidth = !!columns.find((col) => !col.get("width"));
2246
- if (containsColumnWithoutWidth) {
2247
- clearWidths();
2248
- } else {
2249
- const sumWidths = columns.reduce((memo, col) => {
2250
- return memo + col.get("width");
2251
- }, 0);
2252
- const widthsDontAddUp = sumWidths !== 100;
2253
- if (widthsDontAddUp) {
2254
- clearWidths();
2255
- }
2256
- }
2257
- }
2048
+ },
2049
+ component: {
2050
+ name: "Text",
2051
+ options: {
2052
+ text: "I am an accordion title. Click me!"
2258
2053
  }
2259
2054
  }
2260
- }, {
2261
- name: "space",
2262
- type: "number",
2263
- defaultValue: 20,
2264
- helperText: "Size of gap between columns",
2265
- advanced: true
2266
- }, {
2267
- name: "stackColumnsAt",
2268
- type: "string",
2269
- defaultValue: "tablet",
2270
- helperText: "Convert horizontal columns to vertical at what device size",
2271
- enum: ["tablet", "mobile", "never"],
2272
- advanced: true
2273
- }, {
2274
- name: "reverseColumnsWhenStacked",
2275
- type: "boolean",
2276
- defaultValue: false,
2277
- helperText: "When stacking columns for mobile devices, reverse the ordering",
2278
- advanced: true
2279
2055
  }]
2280
2056
  };
2281
-
2282
- // src/blocks/fragment/component-info.ts
2283
- var componentInfo3 = {
2284
- name: "Fragment",
2285
- static: true,
2286
- hidden: true,
2287
- canHaveChildren: true,
2288
- noWrap: true
2289
- };
2290
-
2291
- // src/blocks/image/component-info.ts
2292
- var componentInfo4 = {
2293
- name: "Image",
2294
- static: true,
2295
- 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",
2296
- defaultStyles: {
2297
- position: "relative",
2298
- minHeight: "20px",
2299
- minWidth: "20px",
2300
- overflow: "hidden"
2057
+ var defaultDetail = {
2058
+ "@type": "@builder.io/sdk:Element",
2059
+ layerName: "Accordion item detail",
2060
+ responsiveStyles: {
2061
+ large: {
2062
+ position: "relative",
2063
+ display: "flex",
2064
+ alignItems: "stretch",
2065
+ flexDirection: "column",
2066
+ marginTop: "10px",
2067
+ paddingBottom: "10px"
2068
+ }
2301
2069
  },
2302
- canHaveChildren: true,
2303
- inputs: [{
2304
- name: "image",
2305
- type: "file",
2306
- bubble: true,
2307
- allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
2308
- required: true,
2309
- defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
2310
- onChange: (options) => {
2311
- const DEFAULT_ASPECT_RATIO = 0.7041;
2312
- options.delete("srcset");
2313
- options.delete("noWebp");
2314
- function loadImage(url, timeout = 6e4) {
2315
- return new Promise((resolve, reject) => {
2316
- const img = document.createElement("img");
2317
- let loaded = false;
2318
- img.onload = () => {
2319
- loaded = true;
2320
- resolve(img);
2321
- };
2322
- img.addEventListener("error", (event) => {
2323
- reject(event.error);
2324
- });
2325
- img.src = url;
2326
- setTimeout(() => {
2327
- if (!loaded) {
2328
- reject(new Error("Image load timed out"));
2329
- }
2330
- }, timeout);
2331
- });
2332
- }
2333
- function round2(num) {
2334
- return Math.round(num * 1e3) / 1e3;
2070
+ children: [{
2071
+ "@type": "@builder.io/sdk:Element",
2072
+ responsiveStyles: {
2073
+ large: {
2074
+ paddingTop: "50px",
2075
+ textAlign: "left",
2076
+ display: "flex",
2077
+ flexDirection: "column",
2078
+ paddingBottom: "50px"
2335
2079
  }
2336
- const value = options.get("image");
2337
- const aspectRatio = options.get("aspectRatio");
2338
- fetch(value).then((res) => res.blob()).then((blob) => {
2339
- if (blob.type.includes("svg")) {
2340
- options.set("noWebp", true);
2341
- }
2342
- });
2343
- if (value && (!aspectRatio || aspectRatio === DEFAULT_ASPECT_RATIO)) {
2344
- return loadImage(value).then((img) => {
2345
- const possiblyUpdatedAspectRatio = options.get("aspectRatio");
2346
- if (options.get("image") === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === DEFAULT_ASPECT_RATIO)) {
2347
- if (img.width && img.height) {
2348
- options.set("aspectRatio", round2(img.height / img.width));
2349
- options.set("height", img.height);
2350
- options.set("width", img.width);
2351
- }
2352
- }
2353
- });
2080
+ },
2081
+ component: {
2082
+ name: "Text",
2083
+ options: {
2084
+ text: "I am an accordion detail, hello!"
2354
2085
  }
2355
2086
  }
2356
- }, {
2357
- name: "backgroundSize",
2358
- type: "text",
2359
- defaultValue: "cover",
2360
- enum: [{
2361
- label: "contain",
2362
- value: "contain",
2363
- helperText: "The image should never get cropped"
2364
- }, {
2365
- label: "cover",
2366
- value: "cover",
2367
- helperText: "The image should fill it's box, cropping when needed"
2368
- }]
2369
- }, {
2370
- name: "backgroundPosition",
2371
- type: "text",
2372
- defaultValue: "center",
2373
- enum: ["center", "top", "left", "right", "bottom", "top left", "top right", "bottom left", "bottom right"]
2374
- }, {
2375
- name: "altText",
2376
- type: "string",
2377
- helperText: "Text to display when the user has images off"
2378
- }, {
2379
- name: "height",
2380
- type: "number",
2381
- hideFromUI: true
2382
- }, {
2383
- name: "width",
2384
- type: "number",
2385
- hideFromUI: true
2386
- }, {
2387
- name: "sizes",
2388
- type: "string",
2389
- hideFromUI: true
2390
- }, {
2391
- name: "srcset",
2392
- type: "string",
2393
- hideFromUI: true
2394
- }, {
2395
- name: "lazy",
2396
- type: "boolean",
2397
- defaultValue: true,
2398
- hideFromUI: true
2399
- }, {
2400
- name: "fitContent",
2401
- type: "boolean",
2402
- helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
2403
- defaultValue: true
2404
- }, {
2405
- name: "aspectRatio",
2406
- type: "number",
2407
- 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",
2408
- advanced: true,
2409
- defaultValue: 0.7041
2410
2087
  }]
2411
2088
  };
2412
-
2413
- // src/blocks/section/component-info.ts
2414
- var componentInfo5 = {
2415
- name: "Core:Section",
2416
- static: true,
2417
- image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
2089
+ var componentInfo = {
2090
+ name: "Builder:Accordion",
2091
+ canHaveChildren: true,
2092
+ image: "https://cdn.builder.io/api/v1/image/assets%2FagZ9n5CUKRfbL9t6CaJOyVSK4Es2%2Ffab6c1fd3fe542408cbdec078bca7f35",
2093
+ defaultStyles: {
2094
+ display: "flex",
2095
+ flexDirection: "column",
2096
+ alignItems: "stretch"
2097
+ },
2418
2098
  inputs: [{
2419
- name: "maxWidth",
2420
- type: "number",
2421
- defaultValue: 1200
2099
+ name: "items",
2100
+ type: "list",
2101
+ broadcast: true,
2102
+ subFields: [{
2103
+ name: "title",
2104
+ type: "uiBlocks",
2105
+ hideFromUI: true,
2106
+ defaultValue: [defaultTitle]
2107
+ }, {
2108
+ name: "detail",
2109
+ type: "uiBlocks",
2110
+ hideFromUI: true,
2111
+ defaultValue: [defaultDetail]
2112
+ }],
2113
+ defaultValue: [{
2114
+ title: [defaultTitle],
2115
+ detail: [defaultDetail]
2116
+ }, {
2117
+ title: [defaultTitle],
2118
+ detail: [defaultDetail]
2119
+ }],
2120
+ showIf: (options) => !options.get("useChildrenForItems")
2422
2121
  }, {
2423
- name: "lazyLoad",
2122
+ name: "oneAtATime",
2123
+ helperText: "Only allow opening one at a time (collapse all others when new item openned)",
2424
2124
  type: "boolean",
2425
- defaultValue: false,
2125
+ defaultValue: false
2126
+ }, {
2127
+ name: "grid",
2128
+ helperText: "Display as a grid",
2129
+ type: "boolean",
2130
+ defaultValue: false
2131
+ }, {
2132
+ name: "gridRowWidth",
2133
+ helperText: "Display as a grid",
2134
+ type: "string",
2135
+ showIf: (options) => options.get("grid"),
2136
+ defaultValue: "25%"
2137
+ }, {
2138
+ name: "useChildrenForItems",
2139
+ type: "boolean",
2140
+ helperText: "Use child elements for each slide, instead of the array. Useful for dynamically repeating items",
2426
2141
  advanced: true,
2427
- description: "Only render this section when in view"
2428
- }],
2429
- defaultStyles: {
2430
- paddingLeft: "20px",
2431
- paddingRight: "20px",
2432
- paddingTop: "50px",
2433
- paddingBottom: "50px",
2434
- marginTop: "0px",
2435
- width: "100vw",
2436
- marginLeft: "calc(50% - 50vw)"
2437
- },
2438
- canHaveChildren: true,
2439
- defaultChildren: [{
2440
- "@type": "@builder.io/sdk:Element",
2441
- responsiveStyles: {
2442
- large: {
2443
- textAlign: "center"
2444
- }
2445
- },
2446
- component: {
2447
- name: "Text",
2448
- options: {
2449
- 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>"
2142
+ defaultValue: false,
2143
+ onChange: (options) => {
2144
+ if (options.get("useChildrenForItems") === true) {
2145
+ options.set("items", []);
2450
2146
  }
2451
2147
  }
2452
2148
  }]
2453
2149
  };
2454
2150
 
2455
- // src/blocks/slot/component-info.ts
2456
- var componentInfo6 = {
2457
- name: "Slot",
2458
- isRSC: true,
2459
- description: "Allow child blocks to be inserted into this content when used as a Symbol",
2460
- docsLink: "https://www.builder.io/c/docs/symbols-with-blocks",
2461
- image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",
2462
- // Maybe wrap this for canHaveChildren so bind children to this hm
2463
- inputs: [{
2464
- name: "name",
2465
- type: "string",
2466
- required: true,
2467
- defaultValue: "children"
2468
- }]
2151
+ // src/blocks/accordion/accordion.tsx
2152
+ import { Show as Show8, For as For5, createSignal as createSignal9, createMemo as createMemo9 } from "solid-js";
2153
+
2154
+ // src/blocks/accordion/helpers.ts
2155
+ var convertOrderNumberToString = (order) => {
2156
+ return order.toString();
2469
2157
  };
2470
2158
 
2471
- // src/blocks/slot/slot.tsx
2472
- function Slot(props) {
2473
- return <div
2474
- style={{
2475
- "pointer-events": "auto"
2476
- }}
2477
- {...!props.builderContext.context?.symbolId && {
2478
- "builder-slot": props.name
2479
- }}
2480
- ><Blocks_default
2481
- parent={props.builderContext.context?.symbolId}
2482
- path={`symbol.data.${props.name}`}
2483
- context={props.builderContext}
2484
- blocks={props.builderContext.rootState?.[props.name]}
2485
- /></div>;
2159
+ // src/blocks/accordion/accordion.tsx
2160
+ function Accordion(props) {
2161
+ const [open, setOpen] = createSignal9([]);
2162
+ const onlyOneAtATime = createMemo9(() => {
2163
+ return Boolean(props.grid || props.oneAtATime);
2164
+ });
2165
+ const accordionStyles = createMemo9(() => {
2166
+ const styles = {
2167
+ display: "flex",
2168
+ alignItems: "stretch",
2169
+ flexDirection: "column",
2170
+ ...props.grid && {
2171
+ flexDirection: "row",
2172
+ alignItems: "flex-start",
2173
+ flexWrap: "wrap"
2174
+ }
2175
+ };
2176
+ return Object.fromEntries(
2177
+ Object.entries(styles).map(([key, value]) => [
2178
+ camelToKebabCase(key),
2179
+ value
2180
+ ])
2181
+ );
2182
+ });
2183
+ const accordionTitleStyles = createMemo9(() => {
2184
+ const shared = {
2185
+ display: "flex",
2186
+ flexDirection: "column"
2187
+ };
2188
+ const styles = Object.fromEntries(
2189
+ Object.entries({
2190
+ ...shared,
2191
+ alignItems: "stretch",
2192
+ cursor: "pointer"
2193
+ }).map(([key, value]) => [camelToKebabCase(key), value])
2194
+ );
2195
+ return Object.fromEntries(
2196
+ Object.entries(styles).filter(([_, value]) => value !== void 0)
2197
+ );
2198
+ });
2199
+ function getAccordionTitleClassName(index) {
2200
+ return `builder-accordion-title builder-accordion-title-${open().includes(index) ? "open" : "closed"}`;
2201
+ }
2202
+ function getAccordionDetailClassName(index) {
2203
+ return `builder-accordion-detail builder-accordion-detail-${open().includes(index) ? "open" : "closed"}`;
2204
+ }
2205
+ const openGridItemOrder = createMemo9(() => {
2206
+ let itemOrder = null;
2207
+ const getOpenGridItemPosition = props.grid && open().length;
2208
+ if (getOpenGridItemPosition && document) {
2209
+ const openItemIndex = open()[0];
2210
+ const openItem = document.querySelector(
2211
+ `.builder-accordion-title[data-index="${openItemIndex}"]`
2212
+ );
2213
+ let subjectItem = openItem;
2214
+ itemOrder = openItemIndex;
2215
+ if (subjectItem) {
2216
+ let prevItemRect = subjectItem.getBoundingClientRect();
2217
+ while (subjectItem = subjectItem && subjectItem.nextElementSibling) {
2218
+ if (subjectItem) {
2219
+ if (subjectItem.classList.contains("builder-accordion-detail")) {
2220
+ continue;
2221
+ }
2222
+ const subjectItemRect = subjectItem.getBoundingClientRect();
2223
+ if (subjectItemRect.left > prevItemRect.left) {
2224
+ const index = parseInt(
2225
+ subjectItem.getAttribute("data-index") || "",
2226
+ 10
2227
+ );
2228
+ if (!isNaN(index)) {
2229
+ prevItemRect = subjectItemRect;
2230
+ itemOrder = index;
2231
+ }
2232
+ } else {
2233
+ break;
2234
+ }
2235
+ }
2236
+ }
2237
+ }
2238
+ }
2239
+ if (typeof itemOrder === "number") {
2240
+ itemOrder = itemOrder + 1;
2241
+ }
2242
+ return itemOrder;
2243
+ });
2244
+ const accordionDetailStyles = createMemo9(() => {
2245
+ const styles = {
2246
+ ...{
2247
+ order: typeof openGridItemOrder() === "number" ? openGridItemOrder() : void 0
2248
+ },
2249
+ ...props.grid && {
2250
+ width: "100%"
2251
+ }
2252
+ };
2253
+ return Object.fromEntries(
2254
+ Object.entries(styles).filter(([_, value]) => value !== void 0)
2255
+ );
2256
+ });
2257
+ function onClick(index) {
2258
+ if (open().includes(index)) {
2259
+ setOpen(onlyOneAtATime() ? [] : open().filter((item) => item !== index));
2260
+ } else {
2261
+ setOpen(onlyOneAtATime() ? [index] : open().concat(index));
2262
+ }
2263
+ }
2264
+ return <div class="builder-accordion" style={accordionStyles()}><For5 each={props.items}>{(item, _index) => {
2265
+ const index = _index();
2266
+ return <>
2267
+ <div
2268
+ class={getAccordionTitleClassName(index)}
2269
+ style={{
2270
+ ...accordionTitleStyles(),
2271
+ width: props.grid ? props.gridRowWidth : void 0,
2272
+ ...{
2273
+ order: openGridItemOrder() !== null ? convertOrderNumberToString(index) : convertOrderNumberToString(index + 1)
2274
+ }
2275
+ }}
2276
+ data-index={index}
2277
+ onClick={(event) => onClick(index)}
2278
+ ><Blocks_default
2279
+ blocks={item.title}
2280
+ path={`items.${index}.title`}
2281
+ parent={props.builderBlock.id}
2282
+ context={props.builderContext}
2283
+ registeredComponents={props.builderComponents}
2284
+ linkComponent={props.builderLinkComponent}
2285
+ /></div>
2286
+ <Show8 when={open().includes(index)}><div
2287
+ class={getAccordionDetailClassName(index)}
2288
+ style={accordionDetailStyles()}
2289
+ ><Blocks_default
2290
+ blocks={item.detail}
2291
+ path={`items.${index}.detail`}
2292
+ parent={props.builderBlock.id}
2293
+ context={props.builderContext}
2294
+ registeredComponents={props.builderComponents}
2295
+ linkComponent={props.builderLinkComponent}
2296
+ /></div></Show8>
2297
+ </>;
2298
+ }}</For5></div>;
2486
2299
  }
2487
- var slot_default = Slot;
2300
+ var accordion_default = Accordion;
2488
2301
 
2489
- // src/blocks/symbol/component-info.ts
2490
- var componentInfo7 = {
2491
- name: "Symbol",
2492
- noWrap: true,
2493
- static: true,
2494
- isRSC: true,
2302
+ // src/blocks/button/component-info.ts
2303
+ var componentInfo2 = {
2304
+ name: "Core:Button",
2305
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
2306
+ defaultStyles: {
2307
+ // TODO: make min width more intuitive and set one
2308
+ appearance: "none",
2309
+ paddingTop: "15px",
2310
+ paddingBottom: "15px",
2311
+ paddingLeft: "25px",
2312
+ paddingRight: "25px",
2313
+ backgroundColor: "#000000",
2314
+ color: "white",
2315
+ borderRadius: "4px",
2316
+ textAlign: "center",
2317
+ cursor: "pointer"
2318
+ },
2495
2319
  inputs: [{
2496
- name: "symbol",
2497
- type: "uiSymbol"
2498
- }, {
2499
- name: "dataOnly",
2500
- helperText: "Make this a data symbol that doesn't display any UI",
2501
- type: "boolean",
2502
- defaultValue: false,
2503
- advanced: true,
2504
- hideFromUI: true
2505
- }, {
2506
- name: "inheritState",
2507
- helperText: "Inherit the parent component state and data",
2508
- type: "boolean",
2509
- defaultValue: false,
2510
- advanced: true
2320
+ name: "text",
2321
+ type: "text",
2322
+ defaultValue: "Click me!",
2323
+ bubble: true
2511
2324
  }, {
2512
- name: "renderToLiquid",
2513
- helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
2325
+ name: "link",
2326
+ type: "url",
2327
+ bubble: true
2328
+ }, {
2329
+ name: "openLinkInNewTab",
2514
2330
  type: "boolean",
2515
2331
  defaultValue: false,
2516
- advanced: true,
2517
- hideFromUI: true
2518
- }, {
2519
- name: "useChildren",
2520
- hideFromUI: true,
2521
- type: "boolean"
2522
- }]
2332
+ friendlyName: "Open link in new tab"
2333
+ }],
2334
+ static: true,
2335
+ noWrap: true
2523
2336
  };
2524
2337
 
2525
- // src/blocks/tabs/component-info.ts
2526
- var defaultTab = {
2527
- "@type": "@builder.io/sdk:Element",
2528
- responsiveStyles: {
2529
- large: {
2530
- paddingLeft: "20px",
2531
- paddingRight: "20px",
2532
- paddingTop: "10px",
2533
- paddingBottom: "10px",
2534
- minWidth: "100px",
2535
- textAlign: "center",
2536
- display: "flex",
2537
- flexDirection: "column",
2538
- cursor: "pointer",
2539
- userSelect: "none"
2540
- }
2541
- },
2542
- component: {
2543
- name: "Text",
2544
- options: {
2545
- text: "New tab"
2546
- }
2547
- }
2548
- };
2549
- var defaultElement = {
2550
- "@type": "@builder.io/sdk:Element",
2551
- responsiveStyles: {
2552
- large: {
2553
- height: "200px",
2554
- display: "flex",
2555
- marginTop: "20px",
2556
- flexDirection: "column"
2557
- }
2558
- },
2559
- component: {
2560
- name: "Text",
2561
- options: {
2562
- text: "New tab content "
2563
- }
2564
- }
2565
- };
2566
- var componentInfo8 = {
2567
- name: "Builder: Tabs",
2338
+ // src/blocks/columns/component-info.ts
2339
+ var componentInfo3 = {
2340
+ // TODO: ways to statically preprocess JSON for references, functions, etc
2341
+ name: "Columns",
2342
+ isRSC: true,
2568
2343
  inputs: [{
2569
- name: "tabs",
2570
- type: "list",
2344
+ name: "columns",
2345
+ type: "array",
2571
2346
  broadcast: true,
2572
2347
  subFields: [{
2573
- name: "label",
2574
- type: "uiBlocks",
2348
+ name: "blocks",
2349
+ type: "array",
2575
2350
  hideFromUI: true,
2576
- defaultValue: [defaultTab]
2351
+ defaultValue: [{
2352
+ "@type": "@builder.io/sdk:Element",
2353
+ responsiveStyles: {
2354
+ large: {
2355
+ display: "flex",
2356
+ flexDirection: "column",
2357
+ alignItems: "stretch",
2358
+ flexShrink: "0",
2359
+ position: "relative",
2360
+ marginTop: "30px",
2361
+ textAlign: "center",
2362
+ lineHeight: "normal",
2363
+ height: "auto",
2364
+ minHeight: "20px",
2365
+ minWidth: "20px",
2366
+ overflow: "hidden"
2367
+ }
2368
+ },
2369
+ component: {
2370
+ name: "Image",
2371
+ options: {
2372
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
2373
+ backgroundPosition: "center",
2374
+ backgroundSize: "cover",
2375
+ aspectRatio: 0.7004048582995948
2376
+ }
2377
+ }
2378
+ }, {
2379
+ "@type": "@builder.io/sdk:Element",
2380
+ responsiveStyles: {
2381
+ large: {
2382
+ display: "flex",
2383
+ flexDirection: "column",
2384
+ alignItems: "stretch",
2385
+ flexShrink: "0",
2386
+ position: "relative",
2387
+ marginTop: "30px",
2388
+ textAlign: "center",
2389
+ lineHeight: "normal",
2390
+ height: "auto"
2391
+ }
2392
+ },
2393
+ component: {
2394
+ name: "Text",
2395
+ options: {
2396
+ text: "<p>Enter some text...</p>"
2397
+ }
2398
+ }
2399
+ }]
2577
2400
  }, {
2578
- name: "content",
2579
- type: "uiBlocks",
2401
+ name: "width",
2402
+ type: "number",
2580
2403
  hideFromUI: true,
2581
- defaultValue: [defaultElement]
2404
+ helperText: "Width %, e.g. set to 50 to fill half of the space"
2405
+ }, {
2406
+ name: "link",
2407
+ type: "url",
2408
+ helperText: "Optionally set a url that clicking this column will link to"
2582
2409
  }],
2583
2410
  defaultValue: [{
2584
- label: [{
2585
- ...defaultTab,
2411
+ blocks: [{
2412
+ "@type": "@builder.io/sdk:Element",
2413
+ responsiveStyles: {
2414
+ large: {
2415
+ display: "flex",
2416
+ flexDirection: "column",
2417
+ alignItems: "stretch",
2418
+ flexShrink: "0",
2419
+ position: "relative",
2420
+ marginTop: "30px",
2421
+ textAlign: "center",
2422
+ lineHeight: "normal",
2423
+ height: "auto",
2424
+ minHeight: "20px",
2425
+ minWidth: "20px",
2426
+ overflow: "hidden"
2427
+ }
2428
+ },
2586
2429
  component: {
2587
- name: "Text",
2430
+ name: "Image",
2588
2431
  options: {
2589
- text: "Tab 1"
2432
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
2433
+ backgroundPosition: "center",
2434
+ backgroundSize: "cover",
2435
+ aspectRatio: 0.7004048582995948
2590
2436
  }
2591
2437
  }
2592
- }],
2593
- content: [{
2594
- ...defaultElement,
2438
+ }, {
2439
+ "@type": "@builder.io/sdk:Element",
2440
+ responsiveStyles: {
2441
+ large: {
2442
+ display: "flex",
2443
+ flexDirection: "column",
2444
+ alignItems: "stretch",
2445
+ flexShrink: "0",
2446
+ position: "relative",
2447
+ marginTop: "30px",
2448
+ textAlign: "center",
2449
+ lineHeight: "normal",
2450
+ height: "auto"
2451
+ }
2452
+ },
2595
2453
  component: {
2596
2454
  name: "Text",
2597
2455
  options: {
2598
- text: "Tab 1 content"
2456
+ text: "<p>Enter some text...</p>"
2599
2457
  }
2600
2458
  }
2601
2459
  }]
2602
2460
  }, {
2603
- label: [{
2604
- ...defaultTab,
2461
+ blocks: [{
2462
+ "@type": "@builder.io/sdk:Element",
2463
+ responsiveStyles: {
2464
+ large: {
2465
+ display: "flex",
2466
+ flexDirection: "column",
2467
+ alignItems: "stretch",
2468
+ flexShrink: "0",
2469
+ position: "relative",
2470
+ marginTop: "30px",
2471
+ textAlign: "center",
2472
+ lineHeight: "normal",
2473
+ height: "auto",
2474
+ minHeight: "20px",
2475
+ minWidth: "20px",
2476
+ overflow: "hidden"
2477
+ }
2478
+ },
2605
2479
  component: {
2606
- name: "Text",
2480
+ name: "Image",
2607
2481
  options: {
2608
- text: "Tab 2"
2482
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
2483
+ backgroundPosition: "center",
2484
+ backgroundSize: "cover",
2485
+ aspectRatio: 0.7004048582995948
2609
2486
  }
2610
2487
  }
2611
- }],
2612
- content: [{
2613
- ...defaultElement,
2488
+ }, {
2489
+ "@type": "@builder.io/sdk:Element",
2490
+ responsiveStyles: {
2491
+ large: {
2492
+ display: "flex",
2493
+ flexDirection: "column",
2494
+ alignItems: "stretch",
2495
+ flexShrink: "0",
2496
+ position: "relative",
2497
+ marginTop: "30px",
2498
+ textAlign: "center",
2499
+ lineHeight: "normal",
2500
+ height: "auto"
2501
+ }
2502
+ },
2614
2503
  component: {
2615
2504
  name: "Text",
2616
2505
  options: {
2617
- text: "Tab 2 content"
2506
+ text: "<p>Enter some text...</p>"
2618
2507
  }
2619
2508
  }
2620
2509
  }]
2621
- }]
2622
- }, {
2623
- name: "activeTabStyle",
2624
- type: "uiStyle",
2625
- helperText: "CSS styles for the active tab",
2626
- defaultValue: {
2627
- backgroundColor: "rgba(0, 0, 0, 0.1)"
2510
+ }],
2511
+ onChange: (options) => {
2512
+ function clearWidths() {
2513
+ columns.forEach((col) => {
2514
+ col.delete("width");
2515
+ });
2516
+ }
2517
+ const columns = options.get("columns");
2518
+ if (Array.isArray(columns)) {
2519
+ const containsColumnWithWidth = !!columns.find((col) => col.get("width"));
2520
+ if (containsColumnWithWidth) {
2521
+ const containsColumnWithoutWidth = !!columns.find((col) => !col.get("width"));
2522
+ if (containsColumnWithoutWidth) {
2523
+ clearWidths();
2524
+ } else {
2525
+ const sumWidths = columns.reduce((memo, col) => {
2526
+ return memo + col.get("width");
2527
+ }, 0);
2528
+ const widthsDontAddUp = sumWidths !== 100;
2529
+ if (widthsDontAddUp) {
2530
+ clearWidths();
2531
+ }
2532
+ }
2533
+ }
2534
+ }
2628
2535
  }
2629
2536
  }, {
2630
- name: "defaultActiveTab",
2537
+ name: "space",
2631
2538
  type: "number",
2632
- helperText: 'Default tab to open to. Set to "1" for the first tab, "2" for the second, or choose "0" for none',
2633
- defaultValue: 1,
2539
+ defaultValue: 20,
2540
+ helperText: "Size of gap between columns",
2634
2541
  advanced: true
2635
2542
  }, {
2636
- name: "collapsible",
2543
+ name: "stackColumnsAt",
2544
+ type: "string",
2545
+ defaultValue: "tablet",
2546
+ helperText: "Convert horizontal columns to vertical at what device size",
2547
+ enum: ["tablet", "mobile", "never"],
2548
+ advanced: true
2549
+ }, {
2550
+ name: "reverseColumnsWhenStacked",
2637
2551
  type: "boolean",
2638
- helperText: "If on, clicking an open tab closes it so no tabs are active",
2639
2552
  defaultValue: false,
2553
+ helperText: "When stacking columns for mobile devices, reverse the ordering",
2640
2554
  advanced: true
2555
+ }]
2556
+ };
2557
+
2558
+ // src/blocks/fragment/component-info.ts
2559
+ var componentInfo4 = {
2560
+ name: "Fragment",
2561
+ static: true,
2562
+ hidden: true,
2563
+ canHaveChildren: true,
2564
+ noWrap: true
2565
+ };
2566
+
2567
+ // src/blocks/image/component-info.ts
2568
+ var componentInfo5 = {
2569
+ name: "Image",
2570
+ static: true,
2571
+ 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",
2572
+ defaultStyles: {
2573
+ position: "relative",
2574
+ minHeight: "20px",
2575
+ minWidth: "20px",
2576
+ overflow: "hidden"
2577
+ },
2578
+ canHaveChildren: true,
2579
+ inputs: [{
2580
+ name: "image",
2581
+ type: "file",
2582
+ bubble: true,
2583
+ allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
2584
+ required: true,
2585
+ defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
2586
+ onChange: (options) => {
2587
+ const DEFAULT_ASPECT_RATIO = 0.7041;
2588
+ options.delete("srcset");
2589
+ options.delete("noWebp");
2590
+ function loadImage(url, timeout = 6e4) {
2591
+ return new Promise((resolve, reject) => {
2592
+ const img = document.createElement("img");
2593
+ let loaded = false;
2594
+ img.onload = () => {
2595
+ loaded = true;
2596
+ resolve(img);
2597
+ };
2598
+ img.addEventListener("error", (event) => {
2599
+ reject(event.error);
2600
+ });
2601
+ img.src = url;
2602
+ setTimeout(() => {
2603
+ if (!loaded) {
2604
+ reject(new Error("Image load timed out"));
2605
+ }
2606
+ }, timeout);
2607
+ });
2608
+ }
2609
+ function round2(num) {
2610
+ return Math.round(num * 1e3) / 1e3;
2611
+ }
2612
+ const value = options.get("image");
2613
+ const aspectRatio = options.get("aspectRatio");
2614
+ fetch(value).then((res) => res.blob()).then((blob) => {
2615
+ if (blob.type.includes("svg")) {
2616
+ options.set("noWebp", true);
2617
+ }
2618
+ });
2619
+ if (value && (!aspectRatio || aspectRatio === DEFAULT_ASPECT_RATIO)) {
2620
+ return loadImage(value).then((img) => {
2621
+ const possiblyUpdatedAspectRatio = options.get("aspectRatio");
2622
+ if (options.get("image") === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === DEFAULT_ASPECT_RATIO)) {
2623
+ if (img.width && img.height) {
2624
+ options.set("aspectRatio", round2(img.height / img.width));
2625
+ options.set("height", img.height);
2626
+ options.set("width", img.width);
2627
+ }
2628
+ }
2629
+ });
2630
+ }
2631
+ }
2641
2632
  }, {
2642
- name: "tabHeaderLayout",
2643
- type: "enum",
2644
- helperText: "Change the layout of the tab headers (uses justify-content)",
2645
- defaultValue: "flex-start",
2633
+ name: "backgroundSize",
2634
+ type: "text",
2635
+ defaultValue: "cover",
2646
2636
  enum: [{
2647
- label: "Center",
2648
- value: "center"
2649
- }, {
2650
- label: "Space between",
2651
- value: "space-between"
2652
- }, {
2653
- label: "Space around",
2654
- value: "space-around"
2655
- }, {
2656
- label: "Left",
2657
- value: "flex-start"
2637
+ label: "contain",
2638
+ value: "contain",
2639
+ helperText: "The image should never get cropped"
2658
2640
  }, {
2659
- label: "Right",
2660
- value: "flex-end"
2641
+ label: "cover",
2642
+ value: "cover",
2643
+ helperText: "The image should fill it's box, cropping when needed"
2661
2644
  }]
2645
+ }, {
2646
+ name: "backgroundPosition",
2647
+ type: "text",
2648
+ defaultValue: "center",
2649
+ enum: ["center", "top", "left", "right", "bottom", "top left", "top right", "bottom left", "bottom right"]
2650
+ }, {
2651
+ name: "altText",
2652
+ type: "string",
2653
+ helperText: "Text to display when the user has images off"
2654
+ }, {
2655
+ name: "height",
2656
+ type: "number",
2657
+ hideFromUI: true
2658
+ }, {
2659
+ name: "width",
2660
+ type: "number",
2661
+ hideFromUI: true
2662
+ }, {
2663
+ name: "sizes",
2664
+ type: "string",
2665
+ hideFromUI: true
2666
+ }, {
2667
+ name: "srcset",
2668
+ type: "string",
2669
+ hideFromUI: true
2670
+ }, {
2671
+ name: "lazy",
2672
+ type: "boolean",
2673
+ defaultValue: true,
2674
+ hideFromUI: true
2675
+ }, {
2676
+ name: "fitContent",
2677
+ type: "boolean",
2678
+ helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
2679
+ defaultValue: true
2680
+ }, {
2681
+ name: "aspectRatio",
2682
+ type: "number",
2683
+ 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",
2684
+ advanced: true,
2685
+ defaultValue: 0.7041
2662
2686
  }]
2663
2687
  };
2664
2688
 
2665
- // src/blocks/tabs/tabs.tsx
2666
- import { Show as Show8, For as For5, createSignal as createSignal9 } from "solid-js";
2667
- function Tabs(props) {
2668
- const [activeTab, setActiveTab] = createSignal9(
2669
- props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
2670
- );
2671
- function activeTabContent(active) {
2672
- return props.tabs && props.tabs[active].content;
2673
- }
2674
- function onClick(index) {
2675
- if (index === activeTab() && props.collapsible) {
2676
- setActiveTab(-1);
2677
- } else {
2678
- setActiveTab(index);
2679
- }
2680
- }
2681
- return <div>
2682
- <div
2683
- class="builder-tabs-wrap"
2684
- style={{
2685
- display: "flex",
2686
- "flex-direction": "row",
2687
- "justify-content": props.tabHeaderLayout || "flex-start",
2688
- overflow: "auto"
2689
- }}
2690
- ><For5 each={props.tabs}>{(tab, _index) => {
2691
- const index = _index();
2692
- return <span
2693
- class={`builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`}
2694
- key={index}
2695
- style={{
2696
- ...activeTab() === index ? props.activeTabStyle : {}
2697
- }}
2698
- onClick={(event) => onClick(index)}
2699
- ><Blocks_default
2700
- parent={props.builderBlock.id}
2701
- path={`component.options.tabs.${index}.label`}
2702
- blocks={tab.label}
2703
- context={props.builderContext}
2704
- registeredComponents={props.builderComponents}
2705
- linkComponent={props.builderLinkComponent}
2706
- /></span>;
2707
- }}</For5></div>
2708
- <Show8 when={activeTabContent(activeTab())}><div><Blocks_default
2709
- parent={props.builderBlock.id}
2710
- path={`component.options.tabs.${activeTab()}.content`}
2711
- blocks={activeTabContent(activeTab())}
2712
- context={props.builderContext}
2713
- registeredComponents={props.builderComponents}
2714
- linkComponent={props.builderLinkComponent}
2715
- /></div></Show8>
2716
- </div>;
2717
- }
2718
- var tabs_default = Tabs;
2719
-
2720
- // src/blocks/text/component-info.ts
2721
- var componentInfo9 = {
2722
- name: "Text",
2689
+ // src/blocks/section/component-info.ts
2690
+ var componentInfo6 = {
2691
+ name: "Core:Section",
2723
2692
  static: true,
2693
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
2694
+ inputs: [{
2695
+ name: "maxWidth",
2696
+ type: "number",
2697
+ defaultValue: 1200
2698
+ }, {
2699
+ name: "lazyLoad",
2700
+ type: "boolean",
2701
+ defaultValue: false,
2702
+ advanced: true,
2703
+ description: "Only render this section when in view"
2704
+ }],
2705
+ defaultStyles: {
2706
+ paddingLeft: "20px",
2707
+ paddingRight: "20px",
2708
+ paddingTop: "50px",
2709
+ paddingBottom: "50px",
2710
+ marginTop: "0px",
2711
+ width: "100vw",
2712
+ marginLeft: "calc(50% - 50vw)"
2713
+ },
2714
+ canHaveChildren: true,
2715
+ defaultChildren: [{
2716
+ "@type": "@builder.io/sdk:Element",
2717
+ responsiveStyles: {
2718
+ large: {
2719
+ textAlign: "center"
2720
+ }
2721
+ },
2722
+ component: {
2723
+ name: "Text",
2724
+ options: {
2725
+ 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>"
2726
+ }
2727
+ }
2728
+ }]
2729
+ };
2730
+
2731
+ // src/blocks/slot/component-info.ts
2732
+ var componentInfo7 = {
2733
+ name: "Slot",
2724
2734
  isRSC: true,
2725
- 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",
2735
+ description: "Allow child blocks to be inserted into this content when used as a Symbol",
2736
+ docsLink: "https://www.builder.io/c/docs/symbols-with-blocks",
2737
+ image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",
2738
+ // Maybe wrap this for canHaveChildren so bind children to this hm
2726
2739
  inputs: [{
2727
- name: "text",
2728
- type: "html",
2740
+ name: "name",
2741
+ type: "string",
2729
2742
  required: true,
2730
- autoFocus: true,
2731
- bubble: true,
2732
- defaultValue: "Enter some text..."
2733
- }],
2734
- defaultStyles: {
2735
- lineHeight: "normal",
2736
- height: "auto",
2737
- textAlign: "center"
2738
- }
2743
+ defaultValue: "children"
2744
+ }]
2739
2745
  };
2740
2746
 
2741
- // src/blocks/text/text.tsx
2742
- function Text(props) {
2747
+ // src/blocks/slot/slot.tsx
2748
+ function Slot(props) {
2743
2749
  return <div
2744
- class="builder-text"
2745
- innerHTML={props.text?.toString() || ""}
2746
2750
  style={{
2747
- outline: "none"
2751
+ "pointer-events": "auto"
2748
2752
  }}
2749
- />;
2753
+ {...!props.builderContext.context?.symbolId && {
2754
+ "builder-slot": props.name
2755
+ }}
2756
+ ><Blocks_default
2757
+ parent={props.builderContext.context?.symbolId}
2758
+ path={`symbol.data.${props.name}`}
2759
+ context={props.builderContext}
2760
+ blocks={props.builderContext.rootState?.[props.name]}
2761
+ /></div>;
2750
2762
  }
2751
- var text_default = Text;
2752
-
2753
- // src/blocks/accordion/accordion.tsx
2754
- import { Show as Show9, For as For6, createSignal as createSignal10, createMemo as createMemo10 } from "solid-js";
2763
+ var slot_default = Slot;
2755
2764
 
2756
- // src/blocks/accordion/helpers.ts
2757
- var convertOrderNumberToString = (order) => {
2758
- return order.toString();
2765
+ // src/blocks/symbol/component-info.ts
2766
+ var componentInfo8 = {
2767
+ name: "Symbol",
2768
+ noWrap: true,
2769
+ static: true,
2770
+ isRSC: true,
2771
+ inputs: [{
2772
+ name: "symbol",
2773
+ type: "uiSymbol"
2774
+ }, {
2775
+ name: "dataOnly",
2776
+ helperText: "Make this a data symbol that doesn't display any UI",
2777
+ type: "boolean",
2778
+ defaultValue: false,
2779
+ advanced: true,
2780
+ hideFromUI: true
2781
+ }, {
2782
+ name: "inheritState",
2783
+ helperText: "Inherit the parent component state and data",
2784
+ type: "boolean",
2785
+ defaultValue: false,
2786
+ advanced: true
2787
+ }, {
2788
+ name: "renderToLiquid",
2789
+ helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
2790
+ type: "boolean",
2791
+ defaultValue: false,
2792
+ advanced: true,
2793
+ hideFromUI: true
2794
+ }, {
2795
+ name: "useChildren",
2796
+ hideFromUI: true,
2797
+ type: "boolean"
2798
+ }]
2759
2799
  };
2760
2800
 
2761
- // src/blocks/accordion/accordion.tsx
2762
- function Accordion(props) {
2763
- const [open, setOpen] = createSignal10([]);
2764
- const onlyOneAtATime = createMemo10(() => {
2765
- return Boolean(props.grid || props.oneAtATime);
2766
- });
2767
- const accordionStyles = createMemo10(() => {
2768
- const styles = {
2769
- display: "flex",
2770
- alignItems: "stretch",
2771
- flexDirection: "column",
2772
- ...props.grid && {
2773
- flexDirection: "row",
2774
- alignItems: "flex-start",
2775
- flexWrap: "wrap"
2776
- }
2777
- };
2778
- return Object.fromEntries(
2779
- Object.entries(styles).map(([key, value]) => [
2780
- camelToKebabCase(key),
2781
- value
2782
- ])
2783
- );
2784
- });
2785
- const accordionTitleStyles = createMemo10(() => {
2786
- const shared = {
2787
- display: "flex",
2788
- flexDirection: "column"
2789
- };
2790
- const styles = Object.fromEntries(
2791
- Object.entries({
2792
- ...shared,
2793
- alignItems: "stretch",
2794
- cursor: "pointer"
2795
- }).map(([key, value]) => [camelToKebabCase(key), value])
2796
- );
2797
- return Object.fromEntries(
2798
- Object.entries(styles).filter(([_, value]) => value !== void 0)
2799
- );
2800
- });
2801
- function getAccordionTitleClassName(index) {
2802
- return `builder-accordion-title builder-accordion-title-${open().includes(index) ? "open" : "closed"}`;
2803
- }
2804
- function getAccordionDetailClassName(index) {
2805
- return `builder-accordion-detail builder-accordion-detail-${open().includes(index) ? "open" : "closed"}`;
2806
- }
2807
- const openGridItemOrder = createMemo10(() => {
2808
- let itemOrder = null;
2809
- const getOpenGridItemPosition = props.grid && open().length;
2810
- if (getOpenGridItemPosition && document) {
2811
- const openItemIndex = open()[0];
2812
- const openItem = document.querySelector(
2813
- `.builder-accordion-title[data-index="${openItemIndex}"]`
2814
- );
2815
- let subjectItem = openItem;
2816
- itemOrder = openItemIndex;
2817
- if (subjectItem) {
2818
- let prevItemRect = subjectItem.getBoundingClientRect();
2819
- while (subjectItem = subjectItem && subjectItem.nextElementSibling) {
2820
- if (subjectItem) {
2821
- if (subjectItem.classList.contains("builder-accordion-detail")) {
2822
- continue;
2823
- }
2824
- const subjectItemRect = subjectItem.getBoundingClientRect();
2825
- if (subjectItemRect.left > prevItemRect.left) {
2826
- const index = parseInt(
2827
- subjectItem.getAttribute("data-index") || "",
2828
- 10
2829
- );
2830
- if (!isNaN(index)) {
2831
- prevItemRect = subjectItemRect;
2832
- itemOrder = index;
2833
- }
2834
- } else {
2835
- break;
2836
- }
2837
- }
2838
- }
2839
- }
2840
- }
2841
- if (typeof itemOrder === "number") {
2842
- itemOrder = itemOrder + 1;
2843
- }
2844
- return itemOrder;
2845
- });
2846
- const accordionDetailStyles = createMemo10(() => {
2847
- const styles = {
2848
- ...{
2849
- order: typeof openGridItemOrder() === "number" ? openGridItemOrder() : void 0
2850
- },
2851
- ...props.grid && {
2852
- width: "100%"
2853
- }
2854
- };
2855
- return Object.fromEntries(
2856
- Object.entries(styles).filter(([_, value]) => value !== void 0)
2857
- );
2858
- });
2859
- function onClick(index) {
2860
- if (open().includes(index)) {
2861
- setOpen(onlyOneAtATime() ? [] : open().filter((item) => item !== index));
2862
- } else {
2863
- setOpen(onlyOneAtATime() ? [index] : open().concat(index));
2864
- }
2865
- }
2866
- return <div class="builder-accordion" style={accordionStyles()}><For6 each={props.items}>{(item, _index) => {
2867
- const index = _index();
2868
- return <>
2869
- <div
2870
- class={getAccordionTitleClassName(index)}
2871
- style={{
2872
- ...accordionTitleStyles(),
2873
- width: props.grid ? props.gridRowWidth : void 0,
2874
- ...{
2875
- order: openGridItemOrder() !== null ? convertOrderNumberToString(index) : convertOrderNumberToString(index + 1)
2876
- }
2877
- }}
2878
- data-index={index}
2879
- onClick={(event) => onClick(index)}
2880
- ><Blocks_default
2881
- blocks={item.title}
2882
- path={`items.${index}.title`}
2883
- parent={props.builderBlock.id}
2884
- context={props.builderContext}
2885
- registeredComponents={props.builderComponents}
2886
- linkComponent={props.builderLinkComponent}
2887
- /></div>
2888
- <Show9 when={open().includes(index)}><div
2889
- class={getAccordionDetailClassName(index)}
2890
- style={accordionDetailStyles()}
2891
- ><Blocks_default
2892
- blocks={item.detail}
2893
- path={`items.${index}.detail`}
2894
- parent={props.builderBlock.id}
2895
- context={props.builderContext}
2896
- registeredComponents={props.builderComponents}
2897
- linkComponent={props.builderLinkComponent}
2898
- /></div></Show9>
2899
- </>;
2900
- }}</For6></div>;
2901
- }
2902
- var accordion_default = Accordion;
2903
-
2904
- // src/blocks/accordion/component-info.ts
2905
- var defaultTitle = {
2801
+ // src/blocks/tabs/component-info.ts
2802
+ var defaultTab = {
2906
2803
  "@type": "@builder.io/sdk:Element",
2907
- layerName: "Accordion item title",
2908
2804
  responsiveStyles: {
2909
2805
  large: {
2910
- marginTop: "10px",
2911
- position: "relative",
2806
+ paddingLeft: "20px",
2807
+ paddingRight: "20px",
2808
+ paddingTop: "10px",
2809
+ paddingBottom: "10px",
2810
+ minWidth: "100px",
2811
+ textAlign: "center",
2912
2812
  display: "flex",
2913
- alignItems: "stretch",
2914
2813
  flexDirection: "column",
2915
- paddingBottom: "10px"
2814
+ cursor: "pointer",
2815
+ userSelect: "none"
2916
2816
  }
2917
2817
  },
2918
- children: [{
2919
- "@type": "@builder.io/sdk:Element",
2920
- responsiveStyles: {
2921
- large: {
2922
- textAlign: "left",
2923
- display: "flex",
2924
- flexDirection: "column"
2925
- }
2926
- },
2927
- component: {
2928
- name: "Text",
2929
- options: {
2930
- text: "I am an accordion title. Click me!"
2931
- }
2818
+ component: {
2819
+ name: "Text",
2820
+ options: {
2821
+ text: "New tab"
2932
2822
  }
2933
- }]
2823
+ }
2934
2824
  };
2935
- var defaultDetail = {
2825
+ var defaultElement = {
2936
2826
  "@type": "@builder.io/sdk:Element",
2937
- layerName: "Accordion item detail",
2938
2827
  responsiveStyles: {
2939
2828
  large: {
2940
- position: "relative",
2829
+ height: "200px",
2941
2830
  display: "flex",
2942
- alignItems: "stretch",
2943
- flexDirection: "column",
2944
- marginTop: "10px",
2945
- paddingBottom: "10px"
2831
+ marginTop: "20px",
2832
+ flexDirection: "column"
2946
2833
  }
2947
2834
  },
2948
- children: [{
2949
- "@type": "@builder.io/sdk:Element",
2950
- responsiveStyles: {
2951
- large: {
2952
- paddingTop: "50px",
2953
- textAlign: "left",
2954
- display: "flex",
2955
- flexDirection: "column",
2956
- paddingBottom: "50px"
2957
- }
2958
- },
2959
- component: {
2960
- name: "Text",
2961
- options: {
2962
- text: "I am an accordion detail, hello!"
2963
- }
2835
+ component: {
2836
+ name: "Text",
2837
+ options: {
2838
+ text: "New tab content "
2964
2839
  }
2965
- }]
2840
+ }
2966
2841
  };
2967
- var componentInfo10 = {
2968
- name: "Builder:Accordion",
2969
- canHaveChildren: true,
2970
- image: "https://cdn.builder.io/api/v1/image/assets%2FagZ9n5CUKRfbL9t6CaJOyVSK4Es2%2Ffab6c1fd3fe542408cbdec078bca7f35",
2971
- defaultStyles: {
2972
- display: "flex",
2973
- flexDirection: "column",
2974
- alignItems: "stretch"
2975
- },
2842
+ var componentInfo9 = {
2843
+ name: "Builder: Tabs",
2976
2844
  inputs: [{
2977
- name: "items",
2845
+ name: "tabs",
2978
2846
  type: "list",
2979
2847
  broadcast: true,
2980
2848
  subFields: [{
2981
- name: "title",
2849
+ name: "label",
2982
2850
  type: "uiBlocks",
2983
2851
  hideFromUI: true,
2984
- defaultValue: [defaultTitle]
2852
+ defaultValue: [defaultTab]
2985
2853
  }, {
2986
- name: "detail",
2854
+ name: "content",
2987
2855
  type: "uiBlocks",
2988
2856
  hideFromUI: true,
2989
- defaultValue: [defaultDetail]
2857
+ defaultValue: [defaultElement]
2990
2858
  }],
2991
2859
  defaultValue: [{
2992
- title: [defaultTitle],
2993
- detail: [defaultDetail]
2860
+ label: [{
2861
+ ...defaultTab,
2862
+ component: {
2863
+ name: "Text",
2864
+ options: {
2865
+ text: "Tab 1"
2866
+ }
2867
+ }
2868
+ }],
2869
+ content: [{
2870
+ ...defaultElement,
2871
+ component: {
2872
+ name: "Text",
2873
+ options: {
2874
+ text: "Tab 1 content"
2875
+ }
2876
+ }
2877
+ }]
2994
2878
  }, {
2995
- title: [defaultTitle],
2996
- detail: [defaultDetail]
2997
- }],
2998
- showIf: (options) => !options.get("useChildrenForItems")
2999
- }, {
3000
- name: "oneAtATime",
3001
- helperText: "Only allow opening one at a time (collapse all others when new item openned)",
3002
- type: "boolean",
3003
- defaultValue: false
2879
+ label: [{
2880
+ ...defaultTab,
2881
+ component: {
2882
+ name: "Text",
2883
+ options: {
2884
+ text: "Tab 2"
2885
+ }
2886
+ }
2887
+ }],
2888
+ content: [{
2889
+ ...defaultElement,
2890
+ component: {
2891
+ name: "Text",
2892
+ options: {
2893
+ text: "Tab 2 content"
2894
+ }
2895
+ }
2896
+ }]
2897
+ }]
3004
2898
  }, {
3005
- name: "grid",
3006
- helperText: "Display as a grid",
3007
- type: "boolean",
3008
- defaultValue: false
2899
+ name: "activeTabStyle",
2900
+ type: "uiStyle",
2901
+ helperText: "CSS styles for the active tab",
2902
+ defaultValue: {
2903
+ backgroundColor: "rgba(0, 0, 0, 0.1)"
2904
+ }
3009
2905
  }, {
3010
- name: "gridRowWidth",
3011
- helperText: "Display as a grid",
3012
- type: "string",
3013
- showIf: (options) => options.get("grid"),
3014
- defaultValue: "25%"
2906
+ name: "defaultActiveTab",
2907
+ type: "number",
2908
+ helperText: 'Default tab to open to. Set to "1" for the first tab, "2" for the second, or choose "0" for none',
2909
+ defaultValue: 1,
2910
+ advanced: true
3015
2911
  }, {
3016
- name: "useChildrenForItems",
2912
+ name: "collapsible",
3017
2913
  type: "boolean",
3018
- helperText: "Use child elements for each slide, instead of the array. Useful for dynamically repeating items",
3019
- advanced: true,
2914
+ helperText: "If on, clicking an open tab closes it so no tabs are active",
3020
2915
  defaultValue: false,
3021
- onChange: (options) => {
3022
- if (options.get("useChildrenForItems") === true) {
3023
- options.set("items", []);
3024
- }
3025
- }
2916
+ advanced: true
2917
+ }, {
2918
+ name: "tabHeaderLayout",
2919
+ type: "enum",
2920
+ helperText: "Change the layout of the tab headers (uses justify-content)",
2921
+ defaultValue: "flex-start",
2922
+ enum: [{
2923
+ label: "Center",
2924
+ value: "center"
2925
+ }, {
2926
+ label: "Space between",
2927
+ value: "space-between"
2928
+ }, {
2929
+ label: "Space around",
2930
+ value: "space-around"
2931
+ }, {
2932
+ label: "Left",
2933
+ value: "flex-start"
2934
+ }, {
2935
+ label: "Right",
2936
+ value: "flex-end"
2937
+ }]
3026
2938
  }]
3027
2939
  };
3028
2940
 
2941
+ // src/blocks/tabs/tabs.tsx
2942
+ import { Show as Show9, For as For6, createSignal as createSignal10 } from "solid-js";
2943
+ function Tabs(props) {
2944
+ const [activeTab, setActiveTab] = createSignal10(
2945
+ props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
2946
+ );
2947
+ function activeTabContent(active) {
2948
+ return props.tabs && props.tabs[active].content;
2949
+ }
2950
+ function onClick(index) {
2951
+ if (index === activeTab() && props.collapsible) {
2952
+ setActiveTab(-1);
2953
+ } else {
2954
+ setActiveTab(index);
2955
+ }
2956
+ }
2957
+ return <div>
2958
+ <div
2959
+ class="builder-tabs-wrap"
2960
+ style={{
2961
+ display: "flex",
2962
+ "flex-direction": "row",
2963
+ "justify-content": props.tabHeaderLayout || "flex-start",
2964
+ overflow: "auto"
2965
+ }}
2966
+ ><For6 each={props.tabs}>{(tab, _index) => {
2967
+ const index = _index();
2968
+ return <span
2969
+ class={`builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`}
2970
+ key={index}
2971
+ style={{
2972
+ ...activeTab() === index ? props.activeTabStyle : {}
2973
+ }}
2974
+ onClick={(event) => onClick(index)}
2975
+ ><Blocks_default
2976
+ parent={props.builderBlock.id}
2977
+ path={`component.options.tabs.${index}.label`}
2978
+ blocks={tab.label}
2979
+ context={props.builderContext}
2980
+ registeredComponents={props.builderComponents}
2981
+ linkComponent={props.builderLinkComponent}
2982
+ /></span>;
2983
+ }}</For6></div>
2984
+ <Show9 when={activeTabContent(activeTab())}><div><Blocks_default
2985
+ parent={props.builderBlock.id}
2986
+ path={`component.options.tabs.${activeTab()}.content`}
2987
+ blocks={activeTabContent(activeTab())}
2988
+ context={props.builderContext}
2989
+ registeredComponents={props.builderComponents}
2990
+ linkComponent={props.builderLinkComponent}
2991
+ /></div></Show9>
2992
+ </div>;
2993
+ }
2994
+ var tabs_default = Tabs;
2995
+
2996
+ // src/blocks/text/component-info.ts
2997
+ var componentInfo10 = {
2998
+ name: "Text",
2999
+ static: true,
3000
+ isRSC: true,
3001
+ 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",
3002
+ inputs: [{
3003
+ name: "text",
3004
+ type: "html",
3005
+ required: true,
3006
+ autoFocus: true,
3007
+ bubble: true,
3008
+ defaultValue: "Enter some text..."
3009
+ }],
3010
+ defaultStyles: {
3011
+ lineHeight: "normal",
3012
+ height: "auto",
3013
+ textAlign: "center"
3014
+ }
3015
+ };
3016
+
3017
+ // src/blocks/text/text.tsx
3018
+ function Text(props) {
3019
+ return <div
3020
+ class="builder-text"
3021
+ innerHTML={props.text?.toString() || ""}
3022
+ style={{
3023
+ outline: "none"
3024
+ }}
3025
+ />;
3026
+ }
3027
+ var text_default = Text;
3028
+
3029
3029
  // src/blocks/custom-code/component-info.ts
3030
3030
  var componentInfo11 = {
3031
3031
  name: "Custom Code",
@@ -3464,13 +3464,11 @@ function FormComponent(props) {
3464
3464
  return;
3465
3465
  }
3466
3466
  event.preventDefault();
3467
- const el = event.currentTarget;
3467
+ const el = event.currentTarget || event.target;
3468
3468
  const headers = props.customHeaders || {};
3469
3469
  let body;
3470
3470
  const formData = new FormData(el);
3471
- const formPairs = Array.from(
3472
- event.currentTarget.querySelectorAll("input,select,textarea")
3473
- ).filter((el2) => !!el2.name).map((el2) => {
3471
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
3474
3472
  let value;
3475
3473
  const key = el2.name;
3476
3474
  if (el2 instanceof HTMLInputElement) {
@@ -3633,6 +3631,7 @@ function FormComponent(props) {
3633
3631
  name={props.name}
3634
3632
  onSubmit={(event) => onSubmit(event)}
3635
3633
  {...{}}
3634
+ {...{}}
3636
3635
  {...props.attributes}
3637
3636
  >
3638
3637
  <Show10 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
@@ -4071,34 +4070,34 @@ var getExtraComponents = () => [{
4071
4070
  // src/constants/builder-registered-components.ts
4072
4071
  var getDefaultRegisteredComponents = () => [{
4073
4072
  component: button_default,
4074
- ...componentInfo
4073
+ ...componentInfo2
4075
4074
  }, {
4076
4075
  component: columns_default,
4077
- ...componentInfo2
4076
+ ...componentInfo3
4078
4077
  }, {
4079
4078
  component: fragment_default,
4080
- ...componentInfo3
4079
+ ...componentInfo4
4081
4080
  }, {
4082
4081
  component: image_default,
4083
- ...componentInfo4
4082
+ ...componentInfo5
4084
4083
  }, {
4085
4084
  component: section_default,
4086
- ...componentInfo5
4085
+ ...componentInfo6
4087
4086
  }, {
4088
4087
  component: slot_default,
4089
- ...componentInfo6
4088
+ ...componentInfo7
4090
4089
  }, {
4091
4090
  component: symbol_default,
4092
- ...componentInfo7
4091
+ ...componentInfo8
4093
4092
  }, {
4094
4093
  component: text_default,
4095
- ...componentInfo9
4094
+ ...componentInfo10
4096
4095
  }, ...TARGET === "rsc" ? [] : [{
4097
4096
  component: tabs_default,
4098
- ...componentInfo8
4097
+ ...componentInfo9
4099
4098
  }, {
4100
4099
  component: accordion_default,
4101
- ...componentInfo10
4100
+ ...componentInfo
4102
4101
  }], ...getExtraComponents()];
4103
4102
 
4104
4103
  // src/functions/register-component.ts
@@ -4677,7 +4676,7 @@ function isFromTrustedHost(trustedHosts, e) {
4677
4676
  }
4678
4677
 
4679
4678
  // src/constants/sdk-version.ts
4680
- var SDK_VERSION = "1.0.28";
4679
+ var SDK_VERSION = "1.0.29";
4681
4680
 
4682
4681
  // src/functions/register.ts
4683
4682
  var registry = {};
@@ -5156,7 +5155,7 @@ function EnableEditor(props) {
5156
5155
  const searchParams = new URL(location.href).searchParams;
5157
5156
  const searchParamPreviewModel = searchParams.get("builder.preview");
5158
5157
  const searchParamPreviewId = searchParams.get(
5159
- `builder.preview.${searchParamPreviewModel}`
5158
+ `builder.overrides.${searchParamPreviewModel}`
5160
5159
  );
5161
5160
  const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
5162
5161
  if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {