@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.
@@ -1866,1009 +1866,1009 @@ var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : tru
1866
1866
  // src/components/content/content.tsx
1867
1867
  import { Show as Show13, createSignal as createSignal17 } from "solid-js";
1868
1868
 
1869
- // src/blocks/button/component-info.ts
1870
- var componentInfo = {
1871
- name: "Core:Button",
1872
- image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
1873
- defaultStyles: {
1874
- // TODO: make min width more intuitive and set one
1875
- appearance: "none",
1876
- paddingTop: "15px",
1877
- paddingBottom: "15px",
1878
- paddingLeft: "25px",
1879
- paddingRight: "25px",
1880
- backgroundColor: "#000000",
1881
- color: "white",
1882
- borderRadius: "4px",
1883
- textAlign: "center",
1884
- cursor: "pointer"
1869
+ // src/blocks/accordion/component-info.ts
1870
+ var defaultTitle = {
1871
+ "@type": "@builder.io/sdk:Element",
1872
+ layerName: "Accordion item title",
1873
+ responsiveStyles: {
1874
+ large: {
1875
+ marginTop: "10px",
1876
+ position: "relative",
1877
+ display: "flex",
1878
+ alignItems: "stretch",
1879
+ flexDirection: "column",
1880
+ paddingBottom: "10px"
1881
+ }
1885
1882
  },
1886
- inputs: [{
1887
- name: "text",
1888
- type: "text",
1889
- defaultValue: "Click me!",
1890
- bubble: true
1891
- }, {
1892
- name: "link",
1893
- type: "url",
1894
- bubble: true
1895
- }, {
1896
- name: "openLinkInNewTab",
1897
- type: "boolean",
1898
- defaultValue: false,
1899
- friendlyName: "Open link in new tab"
1900
- }],
1901
- static: true,
1902
- noWrap: true
1903
- };
1904
-
1905
- // src/blocks/columns/component-info.ts
1906
- var componentInfo2 = {
1907
- // TODO: ways to statically preprocess JSON for references, functions, etc
1908
- name: "Columns",
1909
- isRSC: true,
1910
- inputs: [{
1911
- name: "columns",
1912
- type: "array",
1913
- broadcast: true,
1914
- subFields: [{
1915
- name: "blocks",
1916
- type: "array",
1917
- hideFromUI: true,
1918
- defaultValue: [{
1919
- "@type": "@builder.io/sdk:Element",
1920
- responsiveStyles: {
1921
- large: {
1922
- display: "flex",
1923
- flexDirection: "column",
1924
- alignItems: "stretch",
1925
- flexShrink: "0",
1926
- position: "relative",
1927
- marginTop: "30px",
1928
- textAlign: "center",
1929
- lineHeight: "normal",
1930
- height: "auto",
1931
- minHeight: "20px",
1932
- minWidth: "20px",
1933
- overflow: "hidden"
1934
- }
1935
- },
1936
- component: {
1937
- name: "Image",
1938
- options: {
1939
- image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
1940
- backgroundPosition: "center",
1941
- backgroundSize: "cover",
1942
- aspectRatio: 0.7004048582995948
1943
- }
1944
- }
1945
- }, {
1946
- "@type": "@builder.io/sdk:Element",
1947
- responsiveStyles: {
1948
- large: {
1949
- display: "flex",
1950
- flexDirection: "column",
1951
- alignItems: "stretch",
1952
- flexShrink: "0",
1953
- position: "relative",
1954
- marginTop: "30px",
1955
- textAlign: "center",
1956
- lineHeight: "normal",
1957
- height: "auto"
1958
- }
1959
- },
1960
- component: {
1961
- name: "Text",
1962
- options: {
1963
- text: "<p>Enter some text...</p>"
1964
- }
1965
- }
1966
- }]
1967
- }, {
1968
- name: "width",
1969
- type: "number",
1970
- hideFromUI: true,
1971
- helperText: "Width %, e.g. set to 50 to fill half of the space"
1972
- }, {
1973
- name: "link",
1974
- type: "url",
1975
- helperText: "Optionally set a url that clicking this column will link to"
1976
- }],
1977
- defaultValue: [{
1978
- blocks: [{
1979
- "@type": "@builder.io/sdk:Element",
1980
- responsiveStyles: {
1981
- large: {
1982
- display: "flex",
1983
- flexDirection: "column",
1984
- alignItems: "stretch",
1985
- flexShrink: "0",
1986
- position: "relative",
1987
- marginTop: "30px",
1988
- textAlign: "center",
1989
- lineHeight: "normal",
1990
- height: "auto",
1991
- minHeight: "20px",
1992
- minWidth: "20px",
1993
- overflow: "hidden"
1994
- }
1995
- },
1996
- component: {
1997
- name: "Image",
1998
- options: {
1999
- image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
2000
- backgroundPosition: "center",
2001
- backgroundSize: "cover",
2002
- aspectRatio: 0.7004048582995948
2003
- }
2004
- }
2005
- }, {
2006
- "@type": "@builder.io/sdk:Element",
2007
- responsiveStyles: {
2008
- large: {
2009
- display: "flex",
2010
- flexDirection: "column",
2011
- alignItems: "stretch",
2012
- flexShrink: "0",
2013
- position: "relative",
2014
- marginTop: "30px",
2015
- textAlign: "center",
2016
- lineHeight: "normal",
2017
- height: "auto"
2018
- }
2019
- },
2020
- component: {
2021
- name: "Text",
2022
- options: {
2023
- text: "<p>Enter some text...</p>"
2024
- }
2025
- }
2026
- }]
2027
- }, {
2028
- blocks: [{
2029
- "@type": "@builder.io/sdk:Element",
2030
- responsiveStyles: {
2031
- large: {
2032
- display: "flex",
2033
- flexDirection: "column",
2034
- alignItems: "stretch",
2035
- flexShrink: "0",
2036
- position: "relative",
2037
- marginTop: "30px",
2038
- textAlign: "center",
2039
- lineHeight: "normal",
2040
- height: "auto",
2041
- minHeight: "20px",
2042
- minWidth: "20px",
2043
- overflow: "hidden"
2044
- }
2045
- },
2046
- component: {
2047
- name: "Image",
2048
- options: {
2049
- image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
2050
- backgroundPosition: "center",
2051
- backgroundSize: "cover",
2052
- aspectRatio: 0.7004048582995948
2053
- }
2054
- }
2055
- }, {
2056
- "@type": "@builder.io/sdk:Element",
2057
- responsiveStyles: {
2058
- large: {
2059
- display: "flex",
2060
- flexDirection: "column",
2061
- alignItems: "stretch",
2062
- flexShrink: "0",
2063
- position: "relative",
2064
- marginTop: "30px",
2065
- textAlign: "center",
2066
- lineHeight: "normal",
2067
- height: "auto"
2068
- }
2069
- },
2070
- component: {
2071
- name: "Text",
2072
- options: {
2073
- text: "<p>Enter some text...</p>"
2074
- }
2075
- }
2076
- }]
2077
- }],
2078
- onChange: (options) => {
2079
- function clearWidths() {
2080
- columns.forEach((col) => {
2081
- col.delete("width");
2082
- });
1883
+ children: [{
1884
+ "@type": "@builder.io/sdk:Element",
1885
+ responsiveStyles: {
1886
+ large: {
1887
+ textAlign: "left",
1888
+ display: "flex",
1889
+ flexDirection: "column"
2083
1890
  }
2084
- const columns = options.get("columns");
2085
- if (Array.isArray(columns)) {
2086
- const containsColumnWithWidth = !!columns.find((col) => col.get("width"));
2087
- if (containsColumnWithWidth) {
2088
- const containsColumnWithoutWidth = !!columns.find((col) => !col.get("width"));
2089
- if (containsColumnWithoutWidth) {
2090
- clearWidths();
2091
- } else {
2092
- const sumWidths = columns.reduce((memo, col) => {
2093
- return memo + col.get("width");
2094
- }, 0);
2095
- const widthsDontAddUp = sumWidths !== 100;
2096
- if (widthsDontAddUp) {
2097
- clearWidths();
2098
- }
2099
- }
2100
- }
1891
+ },
1892
+ component: {
1893
+ name: "Text",
1894
+ options: {
1895
+ text: "I am an accordion title. Click me!"
2101
1896
  }
2102
1897
  }
2103
- }, {
2104
- name: "space",
2105
- type: "number",
2106
- defaultValue: 20,
2107
- helperText: "Size of gap between columns",
2108
- advanced: true
2109
- }, {
2110
- name: "stackColumnsAt",
2111
- type: "string",
2112
- defaultValue: "tablet",
2113
- helperText: "Convert horizontal columns to vertical at what device size",
2114
- enum: ["tablet", "mobile", "never"],
2115
- advanced: true
2116
- }, {
2117
- name: "reverseColumnsWhenStacked",
2118
- type: "boolean",
2119
- defaultValue: false,
2120
- helperText: "When stacking columns for mobile devices, reverse the ordering",
2121
- advanced: true
2122
1898
  }]
2123
1899
  };
2124
-
2125
- // src/blocks/fragment/component-info.ts
2126
- var componentInfo3 = {
2127
- name: "Fragment",
2128
- static: true,
2129
- hidden: true,
2130
- canHaveChildren: true,
2131
- noWrap: true
2132
- };
2133
-
2134
- // src/blocks/image/component-info.ts
2135
- var componentInfo4 = {
2136
- name: "Image",
2137
- static: true,
2138
- 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",
2139
- defaultStyles: {
2140
- position: "relative",
2141
- minHeight: "20px",
2142
- minWidth: "20px",
2143
- overflow: "hidden"
1900
+ var defaultDetail = {
1901
+ "@type": "@builder.io/sdk:Element",
1902
+ layerName: "Accordion item detail",
1903
+ responsiveStyles: {
1904
+ large: {
1905
+ position: "relative",
1906
+ display: "flex",
1907
+ alignItems: "stretch",
1908
+ flexDirection: "column",
1909
+ marginTop: "10px",
1910
+ paddingBottom: "10px"
1911
+ }
2144
1912
  },
2145
- canHaveChildren: true,
2146
- inputs: [{
2147
- name: "image",
2148
- type: "file",
2149
- bubble: true,
2150
- allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
2151
- required: true,
2152
- defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
2153
- onChange: (options) => {
2154
- const DEFAULT_ASPECT_RATIO = 0.7041;
2155
- options.delete("srcset");
2156
- options.delete("noWebp");
2157
- function loadImage(url, timeout = 6e4) {
2158
- return new Promise((resolve, reject) => {
2159
- const img = document.createElement("img");
2160
- let loaded = false;
2161
- img.onload = () => {
2162
- loaded = true;
2163
- resolve(img);
2164
- };
2165
- img.addEventListener("error", (event) => {
2166
- reject(event.error);
2167
- });
2168
- img.src = url;
2169
- setTimeout(() => {
2170
- if (!loaded) {
2171
- reject(new Error("Image load timed out"));
2172
- }
2173
- }, timeout);
2174
- });
2175
- }
2176
- function round2(num) {
2177
- return Math.round(num * 1e3) / 1e3;
1913
+ children: [{
1914
+ "@type": "@builder.io/sdk:Element",
1915
+ responsiveStyles: {
1916
+ large: {
1917
+ paddingTop: "50px",
1918
+ textAlign: "left",
1919
+ display: "flex",
1920
+ flexDirection: "column",
1921
+ paddingBottom: "50px"
2178
1922
  }
2179
- const value = options.get("image");
2180
- const aspectRatio = options.get("aspectRatio");
2181
- fetch(value).then((res) => res.blob()).then((blob) => {
2182
- if (blob.type.includes("svg")) {
2183
- options.set("noWebp", true);
2184
- }
2185
- });
2186
- if (value && (!aspectRatio || aspectRatio === DEFAULT_ASPECT_RATIO)) {
2187
- return loadImage(value).then((img) => {
2188
- const possiblyUpdatedAspectRatio = options.get("aspectRatio");
2189
- if (options.get("image") === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === DEFAULT_ASPECT_RATIO)) {
2190
- if (img.width && img.height) {
2191
- options.set("aspectRatio", round2(img.height / img.width));
2192
- options.set("height", img.height);
2193
- options.set("width", img.width);
2194
- }
2195
- }
2196
- });
1923
+ },
1924
+ component: {
1925
+ name: "Text",
1926
+ options: {
1927
+ text: "I am an accordion detail, hello!"
2197
1928
  }
2198
1929
  }
2199
- }, {
2200
- name: "backgroundSize",
2201
- type: "text",
2202
- defaultValue: "cover",
2203
- enum: [{
2204
- label: "contain",
2205
- value: "contain",
2206
- helperText: "The image should never get cropped"
2207
- }, {
2208
- label: "cover",
2209
- value: "cover",
2210
- helperText: "The image should fill it's box, cropping when needed"
2211
- }]
2212
- }, {
2213
- name: "backgroundPosition",
2214
- type: "text",
2215
- defaultValue: "center",
2216
- enum: ["center", "top", "left", "right", "bottom", "top left", "top right", "bottom left", "bottom right"]
2217
- }, {
2218
- name: "altText",
2219
- type: "string",
2220
- helperText: "Text to display when the user has images off"
2221
- }, {
2222
- name: "height",
2223
- type: "number",
2224
- hideFromUI: true
2225
- }, {
2226
- name: "width",
2227
- type: "number",
2228
- hideFromUI: true
2229
- }, {
2230
- name: "sizes",
2231
- type: "string",
2232
- hideFromUI: true
2233
- }, {
2234
- name: "srcset",
2235
- type: "string",
2236
- hideFromUI: true
2237
- }, {
2238
- name: "lazy",
2239
- type: "boolean",
2240
- defaultValue: true,
2241
- hideFromUI: true
2242
- }, {
2243
- name: "fitContent",
2244
- type: "boolean",
2245
- helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
2246
- defaultValue: true
2247
- }, {
2248
- name: "aspectRatio",
2249
- type: "number",
2250
- 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",
2251
- advanced: true,
2252
- defaultValue: 0.7041
2253
1930
  }]
2254
1931
  };
2255
-
2256
- // src/blocks/section/component-info.ts
2257
- var componentInfo5 = {
2258
- name: "Core:Section",
2259
- static: true,
2260
- image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
1932
+ var componentInfo = {
1933
+ name: "Builder:Accordion",
1934
+ canHaveChildren: true,
1935
+ image: "https://cdn.builder.io/api/v1/image/assets%2FagZ9n5CUKRfbL9t6CaJOyVSK4Es2%2Ffab6c1fd3fe542408cbdec078bca7f35",
1936
+ defaultStyles: {
1937
+ display: "flex",
1938
+ flexDirection: "column",
1939
+ alignItems: "stretch"
1940
+ },
2261
1941
  inputs: [{
2262
- name: "maxWidth",
2263
- type: "number",
2264
- defaultValue: 1200
1942
+ name: "items",
1943
+ type: "list",
1944
+ broadcast: true,
1945
+ subFields: [{
1946
+ name: "title",
1947
+ type: "uiBlocks",
1948
+ hideFromUI: true,
1949
+ defaultValue: [defaultTitle]
1950
+ }, {
1951
+ name: "detail",
1952
+ type: "uiBlocks",
1953
+ hideFromUI: true,
1954
+ defaultValue: [defaultDetail]
1955
+ }],
1956
+ defaultValue: [{
1957
+ title: [defaultTitle],
1958
+ detail: [defaultDetail]
1959
+ }, {
1960
+ title: [defaultTitle],
1961
+ detail: [defaultDetail]
1962
+ }],
1963
+ showIf: (options) => !options.get("useChildrenForItems")
2265
1964
  }, {
2266
- name: "lazyLoad",
1965
+ name: "oneAtATime",
1966
+ helperText: "Only allow opening one at a time (collapse all others when new item openned)",
2267
1967
  type: "boolean",
2268
- defaultValue: false,
1968
+ defaultValue: false
1969
+ }, {
1970
+ name: "grid",
1971
+ helperText: "Display as a grid",
1972
+ type: "boolean",
1973
+ defaultValue: false
1974
+ }, {
1975
+ name: "gridRowWidth",
1976
+ helperText: "Display as a grid",
1977
+ type: "string",
1978
+ showIf: (options) => options.get("grid"),
1979
+ defaultValue: "25%"
1980
+ }, {
1981
+ name: "useChildrenForItems",
1982
+ type: "boolean",
1983
+ helperText: "Use child elements for each slide, instead of the array. Useful for dynamically repeating items",
2269
1984
  advanced: true,
2270
- description: "Only render this section when in view"
2271
- }],
2272
- defaultStyles: {
2273
- paddingLeft: "20px",
2274
- paddingRight: "20px",
2275
- paddingTop: "50px",
2276
- paddingBottom: "50px",
2277
- marginTop: "0px",
2278
- width: "100vw",
2279
- marginLeft: "calc(50% - 50vw)"
2280
- },
2281
- canHaveChildren: true,
2282
- defaultChildren: [{
2283
- "@type": "@builder.io/sdk:Element",
2284
- responsiveStyles: {
2285
- large: {
2286
- textAlign: "center"
2287
- }
2288
- },
2289
- component: {
2290
- name: "Text",
2291
- options: {
2292
- 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>"
1985
+ defaultValue: false,
1986
+ onChange: (options) => {
1987
+ if (options.get("useChildrenForItems") === true) {
1988
+ options.set("items", []);
2293
1989
  }
2294
1990
  }
2295
1991
  }]
2296
1992
  };
2297
1993
 
2298
- // src/blocks/slot/component-info.ts
2299
- var componentInfo6 = {
2300
- name: "Slot",
2301
- isRSC: true,
2302
- description: "Allow child blocks to be inserted into this content when used as a Symbol",
2303
- docsLink: "https://www.builder.io/c/docs/symbols-with-blocks",
2304
- image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",
2305
- // Maybe wrap this for canHaveChildren so bind children to this hm
2306
- inputs: [{
2307
- name: "name",
2308
- type: "string",
2309
- required: true,
2310
- defaultValue: "children"
2311
- }]
1994
+ // src/blocks/accordion/accordion.tsx
1995
+ import { Show as Show8, For as For5, createSignal as createSignal9, createMemo as createMemo9 } from "solid-js";
1996
+
1997
+ // src/blocks/accordion/helpers.ts
1998
+ var convertOrderNumberToString = (order) => {
1999
+ return order.toString();
2312
2000
  };
2313
2001
 
2314
- // src/blocks/slot/slot.tsx
2315
- function Slot(props) {
2316
- return <div
2317
- style={{
2318
- "pointer-events": "auto"
2319
- }}
2320
- {...!props.builderContext.context?.symbolId && {
2321
- "builder-slot": props.name
2322
- }}
2323
- ><Blocks_default
2324
- parent={props.builderContext.context?.symbolId}
2325
- path={`symbol.data.${props.name}`}
2326
- context={props.builderContext}
2327
- blocks={props.builderContext.rootState?.[props.name]}
2328
- /></div>;
2002
+ // src/blocks/accordion/accordion.tsx
2003
+ function Accordion(props) {
2004
+ const [open, setOpen] = createSignal9([]);
2005
+ const onlyOneAtATime = createMemo9(() => {
2006
+ return Boolean(props.grid || props.oneAtATime);
2007
+ });
2008
+ const accordionStyles = createMemo9(() => {
2009
+ const styles = {
2010
+ display: "flex",
2011
+ alignItems: "stretch",
2012
+ flexDirection: "column",
2013
+ ...props.grid && {
2014
+ flexDirection: "row",
2015
+ alignItems: "flex-start",
2016
+ flexWrap: "wrap"
2017
+ }
2018
+ };
2019
+ return Object.fromEntries(
2020
+ Object.entries(styles).map(([key, value]) => [
2021
+ camelToKebabCase(key),
2022
+ value
2023
+ ])
2024
+ );
2025
+ });
2026
+ const accordionTitleStyles = createMemo9(() => {
2027
+ const shared = {
2028
+ display: "flex",
2029
+ flexDirection: "column"
2030
+ };
2031
+ const styles = Object.fromEntries(
2032
+ Object.entries({
2033
+ ...shared,
2034
+ alignItems: "stretch",
2035
+ cursor: "pointer"
2036
+ }).map(([key, value]) => [camelToKebabCase(key), value])
2037
+ );
2038
+ return Object.fromEntries(
2039
+ Object.entries(styles).filter(([_, value]) => value !== void 0)
2040
+ );
2041
+ });
2042
+ function getAccordionTitleClassName(index) {
2043
+ return `builder-accordion-title builder-accordion-title-${open().includes(index) ? "open" : "closed"}`;
2044
+ }
2045
+ function getAccordionDetailClassName(index) {
2046
+ return `builder-accordion-detail builder-accordion-detail-${open().includes(index) ? "open" : "closed"}`;
2047
+ }
2048
+ const openGridItemOrder = createMemo9(() => {
2049
+ let itemOrder = null;
2050
+ const getOpenGridItemPosition = props.grid && open().length;
2051
+ if (getOpenGridItemPosition && document) {
2052
+ const openItemIndex = open()[0];
2053
+ const openItem = document.querySelector(
2054
+ `.builder-accordion-title[data-index="${openItemIndex}"]`
2055
+ );
2056
+ let subjectItem = openItem;
2057
+ itemOrder = openItemIndex;
2058
+ if (subjectItem) {
2059
+ let prevItemRect = subjectItem.getBoundingClientRect();
2060
+ while (subjectItem = subjectItem && subjectItem.nextElementSibling) {
2061
+ if (subjectItem) {
2062
+ if (subjectItem.classList.contains("builder-accordion-detail")) {
2063
+ continue;
2064
+ }
2065
+ const subjectItemRect = subjectItem.getBoundingClientRect();
2066
+ if (subjectItemRect.left > prevItemRect.left) {
2067
+ const index = parseInt(
2068
+ subjectItem.getAttribute("data-index") || "",
2069
+ 10
2070
+ );
2071
+ if (!isNaN(index)) {
2072
+ prevItemRect = subjectItemRect;
2073
+ itemOrder = index;
2074
+ }
2075
+ } else {
2076
+ break;
2077
+ }
2078
+ }
2079
+ }
2080
+ }
2081
+ }
2082
+ if (typeof itemOrder === "number") {
2083
+ itemOrder = itemOrder + 1;
2084
+ }
2085
+ return itemOrder;
2086
+ });
2087
+ const accordionDetailStyles = createMemo9(() => {
2088
+ const styles = {
2089
+ ...{
2090
+ order: typeof openGridItemOrder() === "number" ? openGridItemOrder() : void 0
2091
+ },
2092
+ ...props.grid && {
2093
+ width: "100%"
2094
+ }
2095
+ };
2096
+ return Object.fromEntries(
2097
+ Object.entries(styles).filter(([_, value]) => value !== void 0)
2098
+ );
2099
+ });
2100
+ function onClick(index) {
2101
+ if (open().includes(index)) {
2102
+ setOpen(onlyOneAtATime() ? [] : open().filter((item) => item !== index));
2103
+ } else {
2104
+ setOpen(onlyOneAtATime() ? [index] : open().concat(index));
2105
+ }
2106
+ }
2107
+ return <div class="builder-accordion" style={accordionStyles()}><For5 each={props.items}>{(item, _index) => {
2108
+ const index = _index();
2109
+ return <>
2110
+ <div
2111
+ class={getAccordionTitleClassName(index)}
2112
+ style={{
2113
+ ...accordionTitleStyles(),
2114
+ width: props.grid ? props.gridRowWidth : void 0,
2115
+ ...{
2116
+ order: openGridItemOrder() !== null ? convertOrderNumberToString(index) : convertOrderNumberToString(index + 1)
2117
+ }
2118
+ }}
2119
+ data-index={index}
2120
+ onClick={(event) => onClick(index)}
2121
+ ><Blocks_default
2122
+ blocks={item.title}
2123
+ path={`items.${index}.title`}
2124
+ parent={props.builderBlock.id}
2125
+ context={props.builderContext}
2126
+ registeredComponents={props.builderComponents}
2127
+ linkComponent={props.builderLinkComponent}
2128
+ /></div>
2129
+ <Show8 when={open().includes(index)}><div
2130
+ class={getAccordionDetailClassName(index)}
2131
+ style={accordionDetailStyles()}
2132
+ ><Blocks_default
2133
+ blocks={item.detail}
2134
+ path={`items.${index}.detail`}
2135
+ parent={props.builderBlock.id}
2136
+ context={props.builderContext}
2137
+ registeredComponents={props.builderComponents}
2138
+ linkComponent={props.builderLinkComponent}
2139
+ /></div></Show8>
2140
+ </>;
2141
+ }}</For5></div>;
2329
2142
  }
2330
- var slot_default = Slot;
2143
+ var accordion_default = Accordion;
2331
2144
 
2332
- // src/blocks/symbol/component-info.ts
2333
- var componentInfo7 = {
2334
- name: "Symbol",
2335
- noWrap: true,
2336
- static: true,
2337
- isRSC: true,
2145
+ // src/blocks/button/component-info.ts
2146
+ var componentInfo2 = {
2147
+ name: "Core:Button",
2148
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
2149
+ defaultStyles: {
2150
+ // TODO: make min width more intuitive and set one
2151
+ appearance: "none",
2152
+ paddingTop: "15px",
2153
+ paddingBottom: "15px",
2154
+ paddingLeft: "25px",
2155
+ paddingRight: "25px",
2156
+ backgroundColor: "#000000",
2157
+ color: "white",
2158
+ borderRadius: "4px",
2159
+ textAlign: "center",
2160
+ cursor: "pointer"
2161
+ },
2338
2162
  inputs: [{
2339
- name: "symbol",
2340
- type: "uiSymbol"
2341
- }, {
2342
- name: "dataOnly",
2343
- helperText: "Make this a data symbol that doesn't display any UI",
2344
- type: "boolean",
2345
- defaultValue: false,
2346
- advanced: true,
2347
- hideFromUI: true
2348
- }, {
2349
- name: "inheritState",
2350
- helperText: "Inherit the parent component state and data",
2351
- type: "boolean",
2352
- defaultValue: false,
2353
- advanced: true
2163
+ name: "text",
2164
+ type: "text",
2165
+ defaultValue: "Click me!",
2166
+ bubble: true
2354
2167
  }, {
2355
- name: "renderToLiquid",
2356
- helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
2168
+ name: "link",
2169
+ type: "url",
2170
+ bubble: true
2171
+ }, {
2172
+ name: "openLinkInNewTab",
2357
2173
  type: "boolean",
2358
2174
  defaultValue: false,
2359
- advanced: true,
2360
- hideFromUI: true
2361
- }, {
2362
- name: "useChildren",
2363
- hideFromUI: true,
2364
- type: "boolean"
2365
- }]
2175
+ friendlyName: "Open link in new tab"
2176
+ }],
2177
+ static: true,
2178
+ noWrap: true
2366
2179
  };
2367
2180
 
2368
- // src/blocks/tabs/component-info.ts
2369
- var defaultTab = {
2370
- "@type": "@builder.io/sdk:Element",
2371
- responsiveStyles: {
2372
- large: {
2373
- paddingLeft: "20px",
2374
- paddingRight: "20px",
2375
- paddingTop: "10px",
2376
- paddingBottom: "10px",
2377
- minWidth: "100px",
2378
- textAlign: "center",
2379
- display: "flex",
2380
- flexDirection: "column",
2381
- cursor: "pointer",
2382
- userSelect: "none"
2383
- }
2384
- },
2385
- component: {
2386
- name: "Text",
2387
- options: {
2388
- text: "New tab"
2389
- }
2390
- }
2391
- };
2392
- var defaultElement = {
2393
- "@type": "@builder.io/sdk:Element",
2394
- responsiveStyles: {
2395
- large: {
2396
- height: "200px",
2397
- display: "flex",
2398
- marginTop: "20px",
2399
- flexDirection: "column"
2400
- }
2401
- },
2402
- component: {
2403
- name: "Text",
2404
- options: {
2405
- text: "New tab content "
2406
- }
2407
- }
2408
- };
2409
- var componentInfo8 = {
2410
- name: "Builder: Tabs",
2181
+ // src/blocks/columns/component-info.ts
2182
+ var componentInfo3 = {
2183
+ // TODO: ways to statically preprocess JSON for references, functions, etc
2184
+ name: "Columns",
2185
+ isRSC: true,
2411
2186
  inputs: [{
2412
- name: "tabs",
2413
- type: "list",
2187
+ name: "columns",
2188
+ type: "array",
2414
2189
  broadcast: true,
2415
2190
  subFields: [{
2416
- name: "label",
2417
- type: "uiBlocks",
2191
+ name: "blocks",
2192
+ type: "array",
2418
2193
  hideFromUI: true,
2419
- defaultValue: [defaultTab]
2194
+ defaultValue: [{
2195
+ "@type": "@builder.io/sdk:Element",
2196
+ responsiveStyles: {
2197
+ large: {
2198
+ display: "flex",
2199
+ flexDirection: "column",
2200
+ alignItems: "stretch",
2201
+ flexShrink: "0",
2202
+ position: "relative",
2203
+ marginTop: "30px",
2204
+ textAlign: "center",
2205
+ lineHeight: "normal",
2206
+ height: "auto",
2207
+ minHeight: "20px",
2208
+ minWidth: "20px",
2209
+ overflow: "hidden"
2210
+ }
2211
+ },
2212
+ component: {
2213
+ name: "Image",
2214
+ options: {
2215
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
2216
+ backgroundPosition: "center",
2217
+ backgroundSize: "cover",
2218
+ aspectRatio: 0.7004048582995948
2219
+ }
2220
+ }
2221
+ }, {
2222
+ "@type": "@builder.io/sdk:Element",
2223
+ responsiveStyles: {
2224
+ large: {
2225
+ display: "flex",
2226
+ flexDirection: "column",
2227
+ alignItems: "stretch",
2228
+ flexShrink: "0",
2229
+ position: "relative",
2230
+ marginTop: "30px",
2231
+ textAlign: "center",
2232
+ lineHeight: "normal",
2233
+ height: "auto"
2234
+ }
2235
+ },
2236
+ component: {
2237
+ name: "Text",
2238
+ options: {
2239
+ text: "<p>Enter some text...</p>"
2240
+ }
2241
+ }
2242
+ }]
2420
2243
  }, {
2421
- name: "content",
2422
- type: "uiBlocks",
2244
+ name: "width",
2245
+ type: "number",
2423
2246
  hideFromUI: true,
2424
- defaultValue: [defaultElement]
2247
+ helperText: "Width %, e.g. set to 50 to fill half of the space"
2248
+ }, {
2249
+ name: "link",
2250
+ type: "url",
2251
+ helperText: "Optionally set a url that clicking this column will link to"
2425
2252
  }],
2426
2253
  defaultValue: [{
2427
- label: [{
2428
- ...defaultTab,
2254
+ blocks: [{
2255
+ "@type": "@builder.io/sdk:Element",
2256
+ responsiveStyles: {
2257
+ large: {
2258
+ display: "flex",
2259
+ flexDirection: "column",
2260
+ alignItems: "stretch",
2261
+ flexShrink: "0",
2262
+ position: "relative",
2263
+ marginTop: "30px",
2264
+ textAlign: "center",
2265
+ lineHeight: "normal",
2266
+ height: "auto",
2267
+ minHeight: "20px",
2268
+ minWidth: "20px",
2269
+ overflow: "hidden"
2270
+ }
2271
+ },
2429
2272
  component: {
2430
- name: "Text",
2273
+ name: "Image",
2431
2274
  options: {
2432
- text: "Tab 1"
2275
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
2276
+ backgroundPosition: "center",
2277
+ backgroundSize: "cover",
2278
+ aspectRatio: 0.7004048582995948
2433
2279
  }
2434
2280
  }
2435
- }],
2436
- content: [{
2437
- ...defaultElement,
2281
+ }, {
2282
+ "@type": "@builder.io/sdk:Element",
2283
+ responsiveStyles: {
2284
+ large: {
2285
+ display: "flex",
2286
+ flexDirection: "column",
2287
+ alignItems: "stretch",
2288
+ flexShrink: "0",
2289
+ position: "relative",
2290
+ marginTop: "30px",
2291
+ textAlign: "center",
2292
+ lineHeight: "normal",
2293
+ height: "auto"
2294
+ }
2295
+ },
2438
2296
  component: {
2439
2297
  name: "Text",
2440
2298
  options: {
2441
- text: "Tab 1 content"
2299
+ text: "<p>Enter some text...</p>"
2442
2300
  }
2443
2301
  }
2444
2302
  }]
2445
2303
  }, {
2446
- label: [{
2447
- ...defaultTab,
2304
+ blocks: [{
2305
+ "@type": "@builder.io/sdk:Element",
2306
+ responsiveStyles: {
2307
+ large: {
2308
+ display: "flex",
2309
+ flexDirection: "column",
2310
+ alignItems: "stretch",
2311
+ flexShrink: "0",
2312
+ position: "relative",
2313
+ marginTop: "30px",
2314
+ textAlign: "center",
2315
+ lineHeight: "normal",
2316
+ height: "auto",
2317
+ minHeight: "20px",
2318
+ minWidth: "20px",
2319
+ overflow: "hidden"
2320
+ }
2321
+ },
2448
2322
  component: {
2449
- name: "Text",
2323
+ name: "Image",
2450
2324
  options: {
2451
- text: "Tab 2"
2325
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
2326
+ backgroundPosition: "center",
2327
+ backgroundSize: "cover",
2328
+ aspectRatio: 0.7004048582995948
2452
2329
  }
2453
2330
  }
2454
- }],
2455
- content: [{
2456
- ...defaultElement,
2331
+ }, {
2332
+ "@type": "@builder.io/sdk:Element",
2333
+ responsiveStyles: {
2334
+ large: {
2335
+ display: "flex",
2336
+ flexDirection: "column",
2337
+ alignItems: "stretch",
2338
+ flexShrink: "0",
2339
+ position: "relative",
2340
+ marginTop: "30px",
2341
+ textAlign: "center",
2342
+ lineHeight: "normal",
2343
+ height: "auto"
2344
+ }
2345
+ },
2457
2346
  component: {
2458
2347
  name: "Text",
2459
2348
  options: {
2460
- text: "Tab 2 content"
2349
+ text: "<p>Enter some text...</p>"
2461
2350
  }
2462
2351
  }
2463
2352
  }]
2464
- }]
2465
- }, {
2466
- name: "activeTabStyle",
2467
- type: "uiStyle",
2468
- helperText: "CSS styles for the active tab",
2469
- defaultValue: {
2470
- backgroundColor: "rgba(0, 0, 0, 0.1)"
2353
+ }],
2354
+ onChange: (options) => {
2355
+ function clearWidths() {
2356
+ columns.forEach((col) => {
2357
+ col.delete("width");
2358
+ });
2359
+ }
2360
+ const columns = options.get("columns");
2361
+ if (Array.isArray(columns)) {
2362
+ const containsColumnWithWidth = !!columns.find((col) => col.get("width"));
2363
+ if (containsColumnWithWidth) {
2364
+ const containsColumnWithoutWidth = !!columns.find((col) => !col.get("width"));
2365
+ if (containsColumnWithoutWidth) {
2366
+ clearWidths();
2367
+ } else {
2368
+ const sumWidths = columns.reduce((memo, col) => {
2369
+ return memo + col.get("width");
2370
+ }, 0);
2371
+ const widthsDontAddUp = sumWidths !== 100;
2372
+ if (widthsDontAddUp) {
2373
+ clearWidths();
2374
+ }
2375
+ }
2376
+ }
2377
+ }
2471
2378
  }
2472
2379
  }, {
2473
- name: "defaultActiveTab",
2380
+ name: "space",
2474
2381
  type: "number",
2475
- helperText: 'Default tab to open to. Set to "1" for the first tab, "2" for the second, or choose "0" for none',
2476
- defaultValue: 1,
2382
+ defaultValue: 20,
2383
+ helperText: "Size of gap between columns",
2477
2384
  advanced: true
2478
2385
  }, {
2479
- name: "collapsible",
2386
+ name: "stackColumnsAt",
2387
+ type: "string",
2388
+ defaultValue: "tablet",
2389
+ helperText: "Convert horizontal columns to vertical at what device size",
2390
+ enum: ["tablet", "mobile", "never"],
2391
+ advanced: true
2392
+ }, {
2393
+ name: "reverseColumnsWhenStacked",
2480
2394
  type: "boolean",
2481
- helperText: "If on, clicking an open tab closes it so no tabs are active",
2482
2395
  defaultValue: false,
2396
+ helperText: "When stacking columns for mobile devices, reverse the ordering",
2483
2397
  advanced: true
2398
+ }]
2399
+ };
2400
+
2401
+ // src/blocks/fragment/component-info.ts
2402
+ var componentInfo4 = {
2403
+ name: "Fragment",
2404
+ static: true,
2405
+ hidden: true,
2406
+ canHaveChildren: true,
2407
+ noWrap: true
2408
+ };
2409
+
2410
+ // src/blocks/image/component-info.ts
2411
+ var componentInfo5 = {
2412
+ name: "Image",
2413
+ static: true,
2414
+ 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",
2415
+ defaultStyles: {
2416
+ position: "relative",
2417
+ minHeight: "20px",
2418
+ minWidth: "20px",
2419
+ overflow: "hidden"
2420
+ },
2421
+ canHaveChildren: true,
2422
+ inputs: [{
2423
+ name: "image",
2424
+ type: "file",
2425
+ bubble: true,
2426
+ allowedFileTypes: ["jpeg", "jpg", "png", "svg"],
2427
+ required: true,
2428
+ defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
2429
+ onChange: (options) => {
2430
+ const DEFAULT_ASPECT_RATIO = 0.7041;
2431
+ options.delete("srcset");
2432
+ options.delete("noWebp");
2433
+ function loadImage(url, timeout = 6e4) {
2434
+ return new Promise((resolve, reject) => {
2435
+ const img = document.createElement("img");
2436
+ let loaded = false;
2437
+ img.onload = () => {
2438
+ loaded = true;
2439
+ resolve(img);
2440
+ };
2441
+ img.addEventListener("error", (event) => {
2442
+ reject(event.error);
2443
+ });
2444
+ img.src = url;
2445
+ setTimeout(() => {
2446
+ if (!loaded) {
2447
+ reject(new Error("Image load timed out"));
2448
+ }
2449
+ }, timeout);
2450
+ });
2451
+ }
2452
+ function round2(num) {
2453
+ return Math.round(num * 1e3) / 1e3;
2454
+ }
2455
+ const value = options.get("image");
2456
+ const aspectRatio = options.get("aspectRatio");
2457
+ fetch(value).then((res) => res.blob()).then((blob) => {
2458
+ if (blob.type.includes("svg")) {
2459
+ options.set("noWebp", true);
2460
+ }
2461
+ });
2462
+ if (value && (!aspectRatio || aspectRatio === DEFAULT_ASPECT_RATIO)) {
2463
+ return loadImage(value).then((img) => {
2464
+ const possiblyUpdatedAspectRatio = options.get("aspectRatio");
2465
+ if (options.get("image") === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === DEFAULT_ASPECT_RATIO)) {
2466
+ if (img.width && img.height) {
2467
+ options.set("aspectRatio", round2(img.height / img.width));
2468
+ options.set("height", img.height);
2469
+ options.set("width", img.width);
2470
+ }
2471
+ }
2472
+ });
2473
+ }
2474
+ }
2484
2475
  }, {
2485
- name: "tabHeaderLayout",
2486
- type: "enum",
2487
- helperText: "Change the layout of the tab headers (uses justify-content)",
2488
- defaultValue: "flex-start",
2476
+ name: "backgroundSize",
2477
+ type: "text",
2478
+ defaultValue: "cover",
2489
2479
  enum: [{
2490
- label: "Center",
2491
- value: "center"
2492
- }, {
2493
- label: "Space between",
2494
- value: "space-between"
2495
- }, {
2496
- label: "Space around",
2497
- value: "space-around"
2498
- }, {
2499
- label: "Left",
2500
- value: "flex-start"
2480
+ label: "contain",
2481
+ value: "contain",
2482
+ helperText: "The image should never get cropped"
2501
2483
  }, {
2502
- label: "Right",
2503
- value: "flex-end"
2484
+ label: "cover",
2485
+ value: "cover",
2486
+ helperText: "The image should fill it's box, cropping when needed"
2504
2487
  }]
2488
+ }, {
2489
+ name: "backgroundPosition",
2490
+ type: "text",
2491
+ defaultValue: "center",
2492
+ enum: ["center", "top", "left", "right", "bottom", "top left", "top right", "bottom left", "bottom right"]
2493
+ }, {
2494
+ name: "altText",
2495
+ type: "string",
2496
+ helperText: "Text to display when the user has images off"
2497
+ }, {
2498
+ name: "height",
2499
+ type: "number",
2500
+ hideFromUI: true
2501
+ }, {
2502
+ name: "width",
2503
+ type: "number",
2504
+ hideFromUI: true
2505
+ }, {
2506
+ name: "sizes",
2507
+ type: "string",
2508
+ hideFromUI: true
2509
+ }, {
2510
+ name: "srcset",
2511
+ type: "string",
2512
+ hideFromUI: true
2513
+ }, {
2514
+ name: "lazy",
2515
+ type: "boolean",
2516
+ defaultValue: true,
2517
+ hideFromUI: true
2518
+ }, {
2519
+ name: "fitContent",
2520
+ type: "boolean",
2521
+ helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
2522
+ defaultValue: true
2523
+ }, {
2524
+ name: "aspectRatio",
2525
+ type: "number",
2526
+ 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",
2527
+ advanced: true,
2528
+ defaultValue: 0.7041
2505
2529
  }]
2506
2530
  };
2507
2531
 
2508
- // src/blocks/tabs/tabs.tsx
2509
- import { Show as Show8, For as For5, createSignal as createSignal9 } from "solid-js";
2510
- function Tabs(props) {
2511
- const [activeTab, setActiveTab] = createSignal9(
2512
- props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
2513
- );
2514
- function activeTabContent(active) {
2515
- return props.tabs && props.tabs[active].content;
2516
- }
2517
- function onClick(index) {
2518
- if (index === activeTab() && props.collapsible) {
2519
- setActiveTab(-1);
2520
- } else {
2521
- setActiveTab(index);
2522
- }
2523
- }
2524
- return <div>
2525
- <div
2526
- class="builder-tabs-wrap"
2527
- style={{
2528
- display: "flex",
2529
- "flex-direction": "row",
2530
- "justify-content": props.tabHeaderLayout || "flex-start",
2531
- overflow: "auto"
2532
- }}
2533
- ><For5 each={props.tabs}>{(tab, _index) => {
2534
- const index = _index();
2535
- return <span
2536
- class={`builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`}
2537
- key={index}
2538
- style={{
2539
- ...activeTab() === index ? props.activeTabStyle : {}
2540
- }}
2541
- onClick={(event) => onClick(index)}
2542
- ><Blocks_default
2543
- parent={props.builderBlock.id}
2544
- path={`component.options.tabs.${index}.label`}
2545
- blocks={tab.label}
2546
- context={props.builderContext}
2547
- registeredComponents={props.builderComponents}
2548
- linkComponent={props.builderLinkComponent}
2549
- /></span>;
2550
- }}</For5></div>
2551
- <Show8 when={activeTabContent(activeTab())}><div><Blocks_default
2552
- parent={props.builderBlock.id}
2553
- path={`component.options.tabs.${activeTab()}.content`}
2554
- blocks={activeTabContent(activeTab())}
2555
- context={props.builderContext}
2556
- registeredComponents={props.builderComponents}
2557
- linkComponent={props.builderLinkComponent}
2558
- /></div></Show8>
2559
- </div>;
2560
- }
2561
- var tabs_default = Tabs;
2562
-
2563
- // src/blocks/text/component-info.ts
2564
- var componentInfo9 = {
2565
- name: "Text",
2532
+ // src/blocks/section/component-info.ts
2533
+ var componentInfo6 = {
2534
+ name: "Core:Section",
2566
2535
  static: true,
2536
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
2537
+ inputs: [{
2538
+ name: "maxWidth",
2539
+ type: "number",
2540
+ defaultValue: 1200
2541
+ }, {
2542
+ name: "lazyLoad",
2543
+ type: "boolean",
2544
+ defaultValue: false,
2545
+ advanced: true,
2546
+ description: "Only render this section when in view"
2547
+ }],
2548
+ defaultStyles: {
2549
+ paddingLeft: "20px",
2550
+ paddingRight: "20px",
2551
+ paddingTop: "50px",
2552
+ paddingBottom: "50px",
2553
+ marginTop: "0px",
2554
+ width: "100vw",
2555
+ marginLeft: "calc(50% - 50vw)"
2556
+ },
2557
+ canHaveChildren: true,
2558
+ defaultChildren: [{
2559
+ "@type": "@builder.io/sdk:Element",
2560
+ responsiveStyles: {
2561
+ large: {
2562
+ textAlign: "center"
2563
+ }
2564
+ },
2565
+ component: {
2566
+ name: "Text",
2567
+ options: {
2568
+ 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>"
2569
+ }
2570
+ }
2571
+ }]
2572
+ };
2573
+
2574
+ // src/blocks/slot/component-info.ts
2575
+ var componentInfo7 = {
2576
+ name: "Slot",
2567
2577
  isRSC: true,
2568
- 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",
2578
+ description: "Allow child blocks to be inserted into this content when used as a Symbol",
2579
+ docsLink: "https://www.builder.io/c/docs/symbols-with-blocks",
2580
+ image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",
2581
+ // Maybe wrap this for canHaveChildren so bind children to this hm
2569
2582
  inputs: [{
2570
- name: "text",
2571
- type: "html",
2583
+ name: "name",
2584
+ type: "string",
2572
2585
  required: true,
2573
- autoFocus: true,
2574
- bubble: true,
2575
- defaultValue: "Enter some text..."
2576
- }],
2577
- defaultStyles: {
2578
- lineHeight: "normal",
2579
- height: "auto",
2580
- textAlign: "center"
2581
- }
2586
+ defaultValue: "children"
2587
+ }]
2582
2588
  };
2583
2589
 
2584
- // src/blocks/text/text.tsx
2585
- function Text(props) {
2590
+ // src/blocks/slot/slot.tsx
2591
+ function Slot(props) {
2586
2592
  return <div
2587
- class="builder-text"
2588
- innerHTML={props.text?.toString() || ""}
2589
2593
  style={{
2590
- outline: "none"
2594
+ "pointer-events": "auto"
2591
2595
  }}
2592
- />;
2596
+ {...!props.builderContext.context?.symbolId && {
2597
+ "builder-slot": props.name
2598
+ }}
2599
+ ><Blocks_default
2600
+ parent={props.builderContext.context?.symbolId}
2601
+ path={`symbol.data.${props.name}`}
2602
+ context={props.builderContext}
2603
+ blocks={props.builderContext.rootState?.[props.name]}
2604
+ /></div>;
2593
2605
  }
2594
- var text_default = Text;
2595
-
2596
- // src/blocks/accordion/accordion.tsx
2597
- import { Show as Show9, For as For6, createSignal as createSignal10, createMemo as createMemo10 } from "solid-js";
2606
+ var slot_default = Slot;
2598
2607
 
2599
- // src/blocks/accordion/helpers.ts
2600
- var convertOrderNumberToString = (order) => {
2601
- return order.toString();
2608
+ // src/blocks/symbol/component-info.ts
2609
+ var componentInfo8 = {
2610
+ name: "Symbol",
2611
+ noWrap: true,
2612
+ static: true,
2613
+ isRSC: true,
2614
+ inputs: [{
2615
+ name: "symbol",
2616
+ type: "uiSymbol"
2617
+ }, {
2618
+ name: "dataOnly",
2619
+ helperText: "Make this a data symbol that doesn't display any UI",
2620
+ type: "boolean",
2621
+ defaultValue: false,
2622
+ advanced: true,
2623
+ hideFromUI: true
2624
+ }, {
2625
+ name: "inheritState",
2626
+ helperText: "Inherit the parent component state and data",
2627
+ type: "boolean",
2628
+ defaultValue: false,
2629
+ advanced: true
2630
+ }, {
2631
+ name: "renderToLiquid",
2632
+ helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
2633
+ type: "boolean",
2634
+ defaultValue: false,
2635
+ advanced: true,
2636
+ hideFromUI: true
2637
+ }, {
2638
+ name: "useChildren",
2639
+ hideFromUI: true,
2640
+ type: "boolean"
2641
+ }]
2602
2642
  };
2603
2643
 
2604
- // src/blocks/accordion/accordion.tsx
2605
- function Accordion(props) {
2606
- const [open, setOpen] = createSignal10([]);
2607
- const onlyOneAtATime = createMemo10(() => {
2608
- return Boolean(props.grid || props.oneAtATime);
2609
- });
2610
- const accordionStyles = createMemo10(() => {
2611
- const styles = {
2612
- display: "flex",
2613
- alignItems: "stretch",
2614
- flexDirection: "column",
2615
- ...props.grid && {
2616
- flexDirection: "row",
2617
- alignItems: "flex-start",
2618
- flexWrap: "wrap"
2619
- }
2620
- };
2621
- return Object.fromEntries(
2622
- Object.entries(styles).map(([key, value]) => [
2623
- camelToKebabCase(key),
2624
- value
2625
- ])
2626
- );
2627
- });
2628
- const accordionTitleStyles = createMemo10(() => {
2629
- const shared = {
2630
- display: "flex",
2631
- flexDirection: "column"
2632
- };
2633
- const styles = Object.fromEntries(
2634
- Object.entries({
2635
- ...shared,
2636
- alignItems: "stretch",
2637
- cursor: "pointer"
2638
- }).map(([key, value]) => [camelToKebabCase(key), value])
2639
- );
2640
- return Object.fromEntries(
2641
- Object.entries(styles).filter(([_, value]) => value !== void 0)
2642
- );
2643
- });
2644
- function getAccordionTitleClassName(index) {
2645
- return `builder-accordion-title builder-accordion-title-${open().includes(index) ? "open" : "closed"}`;
2646
- }
2647
- function getAccordionDetailClassName(index) {
2648
- return `builder-accordion-detail builder-accordion-detail-${open().includes(index) ? "open" : "closed"}`;
2649
- }
2650
- const openGridItemOrder = createMemo10(() => {
2651
- let itemOrder = null;
2652
- const getOpenGridItemPosition = props.grid && open().length;
2653
- if (getOpenGridItemPosition && document) {
2654
- const openItemIndex = open()[0];
2655
- const openItem = document.querySelector(
2656
- `.builder-accordion-title[data-index="${openItemIndex}"]`
2657
- );
2658
- let subjectItem = openItem;
2659
- itemOrder = openItemIndex;
2660
- if (subjectItem) {
2661
- let prevItemRect = subjectItem.getBoundingClientRect();
2662
- while (subjectItem = subjectItem && subjectItem.nextElementSibling) {
2663
- if (subjectItem) {
2664
- if (subjectItem.classList.contains("builder-accordion-detail")) {
2665
- continue;
2666
- }
2667
- const subjectItemRect = subjectItem.getBoundingClientRect();
2668
- if (subjectItemRect.left > prevItemRect.left) {
2669
- const index = parseInt(
2670
- subjectItem.getAttribute("data-index") || "",
2671
- 10
2672
- );
2673
- if (!isNaN(index)) {
2674
- prevItemRect = subjectItemRect;
2675
- itemOrder = index;
2676
- }
2677
- } else {
2678
- break;
2679
- }
2680
- }
2681
- }
2682
- }
2683
- }
2684
- if (typeof itemOrder === "number") {
2685
- itemOrder = itemOrder + 1;
2686
- }
2687
- return itemOrder;
2688
- });
2689
- const accordionDetailStyles = createMemo10(() => {
2690
- const styles = {
2691
- ...{
2692
- order: typeof openGridItemOrder() === "number" ? openGridItemOrder() : void 0
2693
- },
2694
- ...props.grid && {
2695
- width: "100%"
2696
- }
2697
- };
2698
- return Object.fromEntries(
2699
- Object.entries(styles).filter(([_, value]) => value !== void 0)
2700
- );
2701
- });
2702
- function onClick(index) {
2703
- if (open().includes(index)) {
2704
- setOpen(onlyOneAtATime() ? [] : open().filter((item) => item !== index));
2705
- } else {
2706
- setOpen(onlyOneAtATime() ? [index] : open().concat(index));
2707
- }
2708
- }
2709
- return <div class="builder-accordion" style={accordionStyles()}><For6 each={props.items}>{(item, _index) => {
2710
- const index = _index();
2711
- return <>
2712
- <div
2713
- class={getAccordionTitleClassName(index)}
2714
- style={{
2715
- ...accordionTitleStyles(),
2716
- width: props.grid ? props.gridRowWidth : void 0,
2717
- ...{
2718
- order: openGridItemOrder() !== null ? convertOrderNumberToString(index) : convertOrderNumberToString(index + 1)
2719
- }
2720
- }}
2721
- data-index={index}
2722
- onClick={(event) => onClick(index)}
2723
- ><Blocks_default
2724
- blocks={item.title}
2725
- path={`items.${index}.title`}
2726
- parent={props.builderBlock.id}
2727
- context={props.builderContext}
2728
- registeredComponents={props.builderComponents}
2729
- linkComponent={props.builderLinkComponent}
2730
- /></div>
2731
- <Show9 when={open().includes(index)}><div
2732
- class={getAccordionDetailClassName(index)}
2733
- style={accordionDetailStyles()}
2734
- ><Blocks_default
2735
- blocks={item.detail}
2736
- path={`items.${index}.detail`}
2737
- parent={props.builderBlock.id}
2738
- context={props.builderContext}
2739
- registeredComponents={props.builderComponents}
2740
- linkComponent={props.builderLinkComponent}
2741
- /></div></Show9>
2742
- </>;
2743
- }}</For6></div>;
2744
- }
2745
- var accordion_default = Accordion;
2746
-
2747
- // src/blocks/accordion/component-info.ts
2748
- var defaultTitle = {
2644
+ // src/blocks/tabs/component-info.ts
2645
+ var defaultTab = {
2749
2646
  "@type": "@builder.io/sdk:Element",
2750
- layerName: "Accordion item title",
2751
2647
  responsiveStyles: {
2752
2648
  large: {
2753
- marginTop: "10px",
2754
- position: "relative",
2649
+ paddingLeft: "20px",
2650
+ paddingRight: "20px",
2651
+ paddingTop: "10px",
2652
+ paddingBottom: "10px",
2653
+ minWidth: "100px",
2654
+ textAlign: "center",
2755
2655
  display: "flex",
2756
- alignItems: "stretch",
2757
2656
  flexDirection: "column",
2758
- paddingBottom: "10px"
2657
+ cursor: "pointer",
2658
+ userSelect: "none"
2759
2659
  }
2760
2660
  },
2761
- children: [{
2762
- "@type": "@builder.io/sdk:Element",
2763
- responsiveStyles: {
2764
- large: {
2765
- textAlign: "left",
2766
- display: "flex",
2767
- flexDirection: "column"
2768
- }
2769
- },
2770
- component: {
2771
- name: "Text",
2772
- options: {
2773
- text: "I am an accordion title. Click me!"
2774
- }
2661
+ component: {
2662
+ name: "Text",
2663
+ options: {
2664
+ text: "New tab"
2775
2665
  }
2776
- }]
2666
+ }
2777
2667
  };
2778
- var defaultDetail = {
2668
+ var defaultElement = {
2779
2669
  "@type": "@builder.io/sdk:Element",
2780
- layerName: "Accordion item detail",
2781
2670
  responsiveStyles: {
2782
2671
  large: {
2783
- position: "relative",
2672
+ height: "200px",
2784
2673
  display: "flex",
2785
- alignItems: "stretch",
2786
- flexDirection: "column",
2787
- marginTop: "10px",
2788
- paddingBottom: "10px"
2674
+ marginTop: "20px",
2675
+ flexDirection: "column"
2789
2676
  }
2790
2677
  },
2791
- children: [{
2792
- "@type": "@builder.io/sdk:Element",
2793
- responsiveStyles: {
2794
- large: {
2795
- paddingTop: "50px",
2796
- textAlign: "left",
2797
- display: "flex",
2798
- flexDirection: "column",
2799
- paddingBottom: "50px"
2800
- }
2801
- },
2802
- component: {
2803
- name: "Text",
2804
- options: {
2805
- text: "I am an accordion detail, hello!"
2806
- }
2678
+ component: {
2679
+ name: "Text",
2680
+ options: {
2681
+ text: "New tab content "
2807
2682
  }
2808
- }]
2683
+ }
2809
2684
  };
2810
- var componentInfo10 = {
2811
- name: "Builder:Accordion",
2812
- canHaveChildren: true,
2813
- image: "https://cdn.builder.io/api/v1/image/assets%2FagZ9n5CUKRfbL9t6CaJOyVSK4Es2%2Ffab6c1fd3fe542408cbdec078bca7f35",
2814
- defaultStyles: {
2815
- display: "flex",
2816
- flexDirection: "column",
2817
- alignItems: "stretch"
2818
- },
2685
+ var componentInfo9 = {
2686
+ name: "Builder: Tabs",
2819
2687
  inputs: [{
2820
- name: "items",
2688
+ name: "tabs",
2821
2689
  type: "list",
2822
2690
  broadcast: true,
2823
2691
  subFields: [{
2824
- name: "title",
2692
+ name: "label",
2825
2693
  type: "uiBlocks",
2826
2694
  hideFromUI: true,
2827
- defaultValue: [defaultTitle]
2695
+ defaultValue: [defaultTab]
2828
2696
  }, {
2829
- name: "detail",
2697
+ name: "content",
2830
2698
  type: "uiBlocks",
2831
2699
  hideFromUI: true,
2832
- defaultValue: [defaultDetail]
2700
+ defaultValue: [defaultElement]
2833
2701
  }],
2834
2702
  defaultValue: [{
2835
- title: [defaultTitle],
2836
- detail: [defaultDetail]
2703
+ label: [{
2704
+ ...defaultTab,
2705
+ component: {
2706
+ name: "Text",
2707
+ options: {
2708
+ text: "Tab 1"
2709
+ }
2710
+ }
2711
+ }],
2712
+ content: [{
2713
+ ...defaultElement,
2714
+ component: {
2715
+ name: "Text",
2716
+ options: {
2717
+ text: "Tab 1 content"
2718
+ }
2719
+ }
2720
+ }]
2837
2721
  }, {
2838
- title: [defaultTitle],
2839
- detail: [defaultDetail]
2840
- }],
2841
- showIf: (options) => !options.get("useChildrenForItems")
2842
- }, {
2843
- name: "oneAtATime",
2844
- helperText: "Only allow opening one at a time (collapse all others when new item openned)",
2845
- type: "boolean",
2846
- defaultValue: false
2722
+ label: [{
2723
+ ...defaultTab,
2724
+ component: {
2725
+ name: "Text",
2726
+ options: {
2727
+ text: "Tab 2"
2728
+ }
2729
+ }
2730
+ }],
2731
+ content: [{
2732
+ ...defaultElement,
2733
+ component: {
2734
+ name: "Text",
2735
+ options: {
2736
+ text: "Tab 2 content"
2737
+ }
2738
+ }
2739
+ }]
2740
+ }]
2847
2741
  }, {
2848
- name: "grid",
2849
- helperText: "Display as a grid",
2850
- type: "boolean",
2851
- defaultValue: false
2742
+ name: "activeTabStyle",
2743
+ type: "uiStyle",
2744
+ helperText: "CSS styles for the active tab",
2745
+ defaultValue: {
2746
+ backgroundColor: "rgba(0, 0, 0, 0.1)"
2747
+ }
2852
2748
  }, {
2853
- name: "gridRowWidth",
2854
- helperText: "Display as a grid",
2855
- type: "string",
2856
- showIf: (options) => options.get("grid"),
2857
- defaultValue: "25%"
2749
+ name: "defaultActiveTab",
2750
+ type: "number",
2751
+ helperText: 'Default tab to open to. Set to "1" for the first tab, "2" for the second, or choose "0" for none',
2752
+ defaultValue: 1,
2753
+ advanced: true
2858
2754
  }, {
2859
- name: "useChildrenForItems",
2755
+ name: "collapsible",
2860
2756
  type: "boolean",
2861
- helperText: "Use child elements for each slide, instead of the array. Useful for dynamically repeating items",
2862
- advanced: true,
2757
+ helperText: "If on, clicking an open tab closes it so no tabs are active",
2863
2758
  defaultValue: false,
2864
- onChange: (options) => {
2865
- if (options.get("useChildrenForItems") === true) {
2866
- options.set("items", []);
2867
- }
2868
- }
2759
+ advanced: true
2760
+ }, {
2761
+ name: "tabHeaderLayout",
2762
+ type: "enum",
2763
+ helperText: "Change the layout of the tab headers (uses justify-content)",
2764
+ defaultValue: "flex-start",
2765
+ enum: [{
2766
+ label: "Center",
2767
+ value: "center"
2768
+ }, {
2769
+ label: "Space between",
2770
+ value: "space-between"
2771
+ }, {
2772
+ label: "Space around",
2773
+ value: "space-around"
2774
+ }, {
2775
+ label: "Left",
2776
+ value: "flex-start"
2777
+ }, {
2778
+ label: "Right",
2779
+ value: "flex-end"
2780
+ }]
2869
2781
  }]
2870
2782
  };
2871
2783
 
2784
+ // src/blocks/tabs/tabs.tsx
2785
+ import { Show as Show9, For as For6, createSignal as createSignal10 } from "solid-js";
2786
+ function Tabs(props) {
2787
+ const [activeTab, setActiveTab] = createSignal10(
2788
+ props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
2789
+ );
2790
+ function activeTabContent(active) {
2791
+ return props.tabs && props.tabs[active].content;
2792
+ }
2793
+ function onClick(index) {
2794
+ if (index === activeTab() && props.collapsible) {
2795
+ setActiveTab(-1);
2796
+ } else {
2797
+ setActiveTab(index);
2798
+ }
2799
+ }
2800
+ return <div>
2801
+ <div
2802
+ class="builder-tabs-wrap"
2803
+ style={{
2804
+ display: "flex",
2805
+ "flex-direction": "row",
2806
+ "justify-content": props.tabHeaderLayout || "flex-start",
2807
+ overflow: "auto"
2808
+ }}
2809
+ ><For6 each={props.tabs}>{(tab, _index) => {
2810
+ const index = _index();
2811
+ return <span
2812
+ class={`builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`}
2813
+ key={index}
2814
+ style={{
2815
+ ...activeTab() === index ? props.activeTabStyle : {}
2816
+ }}
2817
+ onClick={(event) => onClick(index)}
2818
+ ><Blocks_default
2819
+ parent={props.builderBlock.id}
2820
+ path={`component.options.tabs.${index}.label`}
2821
+ blocks={tab.label}
2822
+ context={props.builderContext}
2823
+ registeredComponents={props.builderComponents}
2824
+ linkComponent={props.builderLinkComponent}
2825
+ /></span>;
2826
+ }}</For6></div>
2827
+ <Show9 when={activeTabContent(activeTab())}><div><Blocks_default
2828
+ parent={props.builderBlock.id}
2829
+ path={`component.options.tabs.${activeTab()}.content`}
2830
+ blocks={activeTabContent(activeTab())}
2831
+ context={props.builderContext}
2832
+ registeredComponents={props.builderComponents}
2833
+ linkComponent={props.builderLinkComponent}
2834
+ /></div></Show9>
2835
+ </div>;
2836
+ }
2837
+ var tabs_default = Tabs;
2838
+
2839
+ // src/blocks/text/component-info.ts
2840
+ var componentInfo10 = {
2841
+ name: "Text",
2842
+ static: true,
2843
+ isRSC: true,
2844
+ 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",
2845
+ inputs: [{
2846
+ name: "text",
2847
+ type: "html",
2848
+ required: true,
2849
+ autoFocus: true,
2850
+ bubble: true,
2851
+ defaultValue: "Enter some text..."
2852
+ }],
2853
+ defaultStyles: {
2854
+ lineHeight: "normal",
2855
+ height: "auto",
2856
+ textAlign: "center"
2857
+ }
2858
+ };
2859
+
2860
+ // src/blocks/text/text.tsx
2861
+ function Text(props) {
2862
+ return <div
2863
+ class="builder-text"
2864
+ innerHTML={props.text?.toString() || ""}
2865
+ style={{
2866
+ outline: "none"
2867
+ }}
2868
+ />;
2869
+ }
2870
+ var text_default = Text;
2871
+
2872
2872
  // src/blocks/custom-code/component-info.ts
2873
2873
  var componentInfo11 = {
2874
2874
  name: "Custom Code",
@@ -3307,13 +3307,11 @@ function FormComponent(props) {
3307
3307
  return;
3308
3308
  }
3309
3309
  event.preventDefault();
3310
- const el = event.currentTarget;
3310
+ const el = event.currentTarget || event.target;
3311
3311
  const headers = props.customHeaders || {};
3312
3312
  let body;
3313
3313
  const formData = new FormData(el);
3314
- const formPairs = Array.from(
3315
- event.currentTarget.querySelectorAll("input,select,textarea")
3316
- ).filter((el2) => !!el2.name).map((el2) => {
3314
+ const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
3317
3315
  let value;
3318
3316
  const key = el2.name;
3319
3317
  if (el2 instanceof HTMLInputElement) {
@@ -3476,6 +3474,7 @@ function FormComponent(props) {
3476
3474
  name={props.name}
3477
3475
  onSubmit={(event) => onSubmit(event)}
3478
3476
  {...{}}
3477
+ {...{}}
3479
3478
  {...props.attributes}
3480
3479
  >
3481
3480
  <Show10 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
@@ -3914,34 +3913,34 @@ var getExtraComponents = () => [{
3914
3913
  // src/constants/builder-registered-components.ts
3915
3914
  var getDefaultRegisteredComponents = () => [{
3916
3915
  component: button_default,
3917
- ...componentInfo
3916
+ ...componentInfo2
3918
3917
  }, {
3919
3918
  component: columns_default,
3920
- ...componentInfo2
3919
+ ...componentInfo3
3921
3920
  }, {
3922
3921
  component: fragment_default,
3923
- ...componentInfo3
3922
+ ...componentInfo4
3924
3923
  }, {
3925
3924
  component: image_default,
3926
- ...componentInfo4
3925
+ ...componentInfo5
3927
3926
  }, {
3928
3927
  component: section_default,
3929
- ...componentInfo5
3928
+ ...componentInfo6
3930
3929
  }, {
3931
3930
  component: slot_default,
3932
- ...componentInfo6
3931
+ ...componentInfo7
3933
3932
  }, {
3934
3933
  component: symbol_default,
3935
- ...componentInfo7
3934
+ ...componentInfo8
3936
3935
  }, {
3937
3936
  component: text_default,
3938
- ...componentInfo9
3937
+ ...componentInfo10
3939
3938
  }, ...TARGET === "rsc" ? [] : [{
3940
3939
  component: tabs_default,
3941
- ...componentInfo8
3940
+ ...componentInfo9
3942
3941
  }, {
3943
3942
  component: accordion_default,
3944
- ...componentInfo10
3943
+ ...componentInfo
3945
3944
  }], ...getExtraComponents()];
3946
3945
 
3947
3946
  // src/functions/register-component.ts
@@ -4520,7 +4519,7 @@ function isFromTrustedHost(trustedHosts, e) {
4520
4519
  }
4521
4520
 
4522
4521
  // src/constants/sdk-version.ts
4523
- var SDK_VERSION = "1.0.28";
4522
+ var SDK_VERSION = "1.0.29";
4524
4523
 
4525
4524
  // src/functions/register.ts
4526
4525
  var registry = {};
@@ -4999,7 +4998,7 @@ function EnableEditor(props) {
4999
4998
  const searchParams = new URL(location.href).searchParams;
5000
4999
  const searchParamPreviewModel = searchParams.get("builder.preview");
5001
5000
  const searchParamPreviewId = searchParams.get(
5002
- `builder.preview.${searchParamPreviewModel}`
5001
+ `builder.overrides.${searchParamPreviewModel}`
5003
5002
  );
5004
5003
  const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
5005
5004
  if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {