@builder.io/sdk-qwik 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.qwik.cjs +140 -108
- package/lib/index.qwik.mjs +141 -109
- package/package.json +1 -1
- package/types/blocks/button/button.d.ts +1 -1
- package/types/blocks/columns/columns.d.ts +33 -42
- package/types/blocks/image/image.d.ts +1 -1
- package/types/blocks/symbol/symbol.d.ts +1 -2
- package/types/components/render-blocks.d.ts +1 -1
- package/types/components/render-content/render-content.types.d.ts +2 -0
- package/types/context/types.d.ts +2 -0
- package/types/functions/get-content/types.d.ts +6 -0
- package/types/types/api-version.d.ts +1 -0
package/lib/index.qwik.cjs
CHANGED
|
@@ -29,7 +29,8 @@ const Button = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
|
29
29
|
const STYLES$3 = `
|
|
30
30
|
.button-Button {
|
|
31
31
|
all: unset;
|
|
32
|
-
}
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
33
34
|
const builderContext = qwik.createContext("Builder");
|
|
34
35
|
const TARGET = "qwik";
|
|
35
36
|
function isBrowser() {
|
|
@@ -586,7 +587,7 @@ const RenderBlock = (props) => {
|
|
|
586
587
|
}, "9d_3");
|
|
587
588
|
};
|
|
588
589
|
const RenderBlock$1 = RenderBlock;
|
|
589
|
-
const className
|
|
590
|
+
const className = function className2(props, state, builderContext2) {
|
|
590
591
|
return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
|
|
591
592
|
};
|
|
592
593
|
const onClick$1 = function onClick2(props, state, builderContext2) {
|
|
@@ -614,7 +615,7 @@ const RenderBlocks = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) =
|
|
|
614
615
|
const builderContext$1 = qwik.useContext(builderContext);
|
|
615
616
|
const state = {};
|
|
616
617
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
617
|
-
class: className
|
|
618
|
+
class: className(props) + " div-RenderBlocks",
|
|
618
619
|
get "builder-path"() {
|
|
619
620
|
return props.path;
|
|
620
621
|
},
|
|
@@ -667,91 +668,83 @@ const STYLES$2 = `
|
|
|
667
668
|
display: flex;
|
|
668
669
|
flex-direction: column;
|
|
669
670
|
align-items: stretch;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
return typeof props.space === "number" ? props.space || 0 : 20;
|
|
673
|
-
};
|
|
674
|
-
const getColumns = function getColumns2(props, state, builderContext2) {
|
|
675
|
-
return props.columns || [];
|
|
676
|
-
};
|
|
671
|
+
}
|
|
672
|
+
`;
|
|
677
673
|
const getWidth = function getWidth2(props, state, builderContext2, index) {
|
|
678
|
-
|
|
679
|
-
return columns[index]?.width || 100 / columns.length;
|
|
674
|
+
return state.cols[index]?.width || 100 / state.cols.length;
|
|
680
675
|
};
|
|
681
676
|
const getColumnCssWidth = function getColumnCssWidth2(props, state, builderContext2, index) {
|
|
682
|
-
const
|
|
683
|
-
const gutterSize = getGutterSize(props);
|
|
684
|
-
const subtractWidth = gutterSize * (columns.length - 1) / columns.length;
|
|
677
|
+
const subtractWidth = state.gutterSize * (state.cols.length - 1) / state.cols.length;
|
|
685
678
|
return `calc(${getWidth(props, state, builderContext2, index)}% - ${subtractWidth}px)`;
|
|
686
679
|
};
|
|
687
|
-
const
|
|
688
|
-
|
|
689
|
-
|
|
680
|
+
const getTabletStyle = function getTabletStyle2(props, state, builderContext2, { stackedStyle, desktopStyle }) {
|
|
681
|
+
return state.stackAt === "tablet" ? stackedStyle : desktopStyle;
|
|
682
|
+
};
|
|
683
|
+
const getMobileStyle = function getMobileStyle2(props, state, builderContext2, { stackedStyle, desktopStyle }) {
|
|
684
|
+
return state.stackAt === "never" ? desktopStyle : stackedStyle;
|
|
690
685
|
};
|
|
691
686
|
const columnsCssVars = function columnsCssVars2(props, state, builderContext2) {
|
|
692
|
-
const flexDir = props.stackColumnsAt === "never" ? "inherit" : props.reverseColumnsWhenStacked ? "column-reverse" : "column";
|
|
693
687
|
return {
|
|
694
|
-
"--flex-dir": flexDir,
|
|
695
|
-
"--flex-dir-tablet":
|
|
688
|
+
"--flex-dir": state.flexDir,
|
|
689
|
+
"--flex-dir-tablet": getTabletStyle(props, state, builderContext2, {
|
|
690
|
+
stackedStyle: state.flexDir,
|
|
691
|
+
desktopStyle: "row"
|
|
692
|
+
})
|
|
696
693
|
};
|
|
697
694
|
};
|
|
698
|
-
const columnCssVars = function columnCssVars2(props, state, builderContext2) {
|
|
699
|
-
const width =
|
|
700
|
-
const
|
|
695
|
+
const columnCssVars = function columnCssVars2(props, state, builderContext2, index) {
|
|
696
|
+
const width = getColumnCssWidth(props, state, builderContext2, index);
|
|
697
|
+
const gutter = `${index === 0 ? 0 : state.gutterSize}px`;
|
|
698
|
+
const mobileWidth = "100%";
|
|
699
|
+
const mobileMarginLeft = "0";
|
|
701
700
|
return {
|
|
702
|
-
|
|
703
|
-
"
|
|
704
|
-
"--column-width-
|
|
705
|
-
|
|
701
|
+
width,
|
|
702
|
+
"margin-left": gutter,
|
|
703
|
+
"--column-width-mobile": getMobileStyle(props, state, builderContext2, {
|
|
704
|
+
stackedStyle: mobileWidth,
|
|
705
|
+
desktopStyle: width
|
|
706
|
+
}),
|
|
707
|
+
"--column-margin-left-mobile": getMobileStyle(props, state, builderContext2, {
|
|
708
|
+
stackedStyle: mobileMarginLeft,
|
|
709
|
+
desktopStyle: gutter
|
|
710
|
+
}),
|
|
711
|
+
"--column-width-tablet": getTabletStyle(props, state, builderContext2, {
|
|
712
|
+
stackedStyle: mobileWidth,
|
|
713
|
+
desktopStyle: width
|
|
714
|
+
}),
|
|
715
|
+
"--column-margin-left-tablet": getTabletStyle(props, state, builderContext2, {
|
|
716
|
+
stackedStyle: mobileMarginLeft,
|
|
717
|
+
desktopStyle: gutter
|
|
718
|
+
})
|
|
706
719
|
};
|
|
707
720
|
};
|
|
708
721
|
const getWidthForBreakpointSize = function getWidthForBreakpointSize2(props, state, builderContext2, size) {
|
|
709
722
|
const breakpointSizes = getSizesForBreakpoints(builderContext2.content?.meta?.breakpoints || {});
|
|
710
723
|
return breakpointSizes[size].max;
|
|
711
724
|
};
|
|
712
|
-
const columnStyleObjects = function columnStyleObjects2(props, state, builderContext2) {
|
|
713
|
-
return {
|
|
714
|
-
columns: {
|
|
715
|
-
small: {
|
|
716
|
-
flexDirection: "var(--flex-dir)",
|
|
717
|
-
alignItems: "stretch"
|
|
718
|
-
},
|
|
719
|
-
medium: {
|
|
720
|
-
flexDirection: "var(--flex-dir-tablet)",
|
|
721
|
-
alignItems: "stretch"
|
|
722
|
-
}
|
|
723
|
-
},
|
|
724
|
-
column: {
|
|
725
|
-
small: {
|
|
726
|
-
width: "var(--column-width) !important",
|
|
727
|
-
marginLeft: "var(--column-margin-left) !important"
|
|
728
|
-
},
|
|
729
|
-
medium: {
|
|
730
|
-
width: "var(--column-width-tablet) !important",
|
|
731
|
-
marginLeft: "var(--column-margin-left-tablet) !important"
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
};
|
|
735
|
-
};
|
|
736
725
|
const columnsStyles = function columnsStyles2(props, state, builderContext2) {
|
|
737
726
|
return `
|
|
738
727
|
@media (max-width: ${getWidthForBreakpointSize(props, state, builderContext2, "medium")}px) {
|
|
739
728
|
.${props.builderBlock.id}-breakpoints {
|
|
740
|
-
|
|
729
|
+
flex-direction: var(--flex-dir-tablet);
|
|
730
|
+
align-items: stretch;
|
|
741
731
|
}
|
|
742
732
|
|
|
743
733
|
.${props.builderBlock.id}-breakpoints > .builder-column {
|
|
744
|
-
|
|
734
|
+
width: var(--column-width-tablet) !important;
|
|
735
|
+
margin-left: var(--column-margin-left-tablet) !important;
|
|
745
736
|
}
|
|
746
737
|
}
|
|
747
738
|
|
|
748
739
|
@media (max-width: ${getWidthForBreakpointSize(props, state, builderContext2, "small")}px) {
|
|
749
740
|
.${props.builderBlock.id}-breakpoints {
|
|
750
|
-
|
|
741
|
+
flex-direction: var(--flex-dir);
|
|
742
|
+
align-items: stretch;
|
|
751
743
|
}
|
|
752
744
|
|
|
753
745
|
.${props.builderBlock.id}-breakpoints > .builder-column {
|
|
754
|
-
|
|
746
|
+
width: var(--column-width-mobile) !important;
|
|
747
|
+
margin-left: var(--column-margin-left-mobile) !important;
|
|
755
748
|
}
|
|
756
749
|
},
|
|
757
750
|
`;
|
|
@@ -759,13 +752,15 @@ const columnsStyles = function columnsStyles2(props, state, builderContext2) {
|
|
|
759
752
|
const Columns = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
760
753
|
qwik.useStylesScopedQrl(qwik.inlinedQrl(STYLES$1, "Columns_component_useStylesScoped_s7JLZz7MCCQ"));
|
|
761
754
|
const builderContext$1 = qwik.useContext(builderContext);
|
|
762
|
-
const state = {
|
|
755
|
+
const state = qwik.useStore({
|
|
756
|
+
cols: props.columns || [],
|
|
757
|
+
flexDir: props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column",
|
|
758
|
+
gutterSize: typeof props.space === "number" ? props.space || 0 : 20,
|
|
759
|
+
stackAt: props.stackColumnsAt || "tablet"
|
|
760
|
+
});
|
|
763
761
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
764
762
|
class: `builder-columns ${props.builderBlock.id}-breakpoints div-Columns`,
|
|
765
|
-
style:
|
|
766
|
-
...{},
|
|
767
|
-
...columnsCssVars(props, state, builderContext$1)
|
|
768
|
-
},
|
|
763
|
+
style: columnsCssVars(props, state, builderContext$1),
|
|
769
764
|
children: [
|
|
770
765
|
/* @__PURE__ */ jsxRuntime.jsx(RenderInlinedStyles, {
|
|
771
766
|
styles: columnsStyles(props, state, builderContext$1)
|
|
@@ -773,12 +768,7 @@ const Columns = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
|
773
768
|
(props.columns || []).map(function(column, index) {
|
|
774
769
|
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
775
770
|
class: "builder-column div-Columns-2",
|
|
776
|
-
style:
|
|
777
|
-
width: getColumnCssWidth(props, state, builderContext$1, index),
|
|
778
|
-
marginLeft: `${index === 0 ? 0 : getGutterSize(props)}px`,
|
|
779
|
-
...{},
|
|
780
|
-
...columnCssVars(props, state, builderContext$1)
|
|
781
|
-
},
|
|
771
|
+
style: columnCssVars(props, state, builderContext$1, index),
|
|
782
772
|
children: /* @__PURE__ */ jsxRuntime.jsx(RenderBlocks, {
|
|
783
773
|
get blocks() {
|
|
784
774
|
return column.blocks;
|
|
@@ -807,11 +797,13 @@ const STYLES$1 = `
|
|
|
807
797
|
.div-Columns {
|
|
808
798
|
display: flex;
|
|
809
799
|
line-height: normal;
|
|
810
|
-
}
|
|
800
|
+
}
|
|
801
|
+
.div-Columns-2 {
|
|
811
802
|
display: flex;
|
|
812
803
|
flex-direction: column;
|
|
813
804
|
align-items: stretch;
|
|
814
|
-
}
|
|
805
|
+
}
|
|
806
|
+
`;
|
|
815
807
|
const FragmentComponent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
816
808
|
return /* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
817
809
|
children: /* @__PURE__ */ jsxRuntime.jsx(qwik.Slot, {}, "oj_0")
|
|
@@ -963,11 +955,13 @@ const STYLES = `
|
|
|
963
955
|
.img-Image {
|
|
964
956
|
opacity: 1;
|
|
965
957
|
transition: opacity 0.2s ease-in-out;
|
|
966
|
-
}
|
|
958
|
+
}
|
|
959
|
+
.div-Image {
|
|
967
960
|
width: 100%;
|
|
968
961
|
pointer-events: none;
|
|
969
962
|
font-size: 0;
|
|
970
|
-
}
|
|
963
|
+
}
|
|
964
|
+
.div-Image-2 {
|
|
971
965
|
display: flex;
|
|
972
966
|
flex-direction: column;
|
|
973
967
|
align-items: stretch;
|
|
@@ -976,7 +970,8 @@ const STYLES = `
|
|
|
976
970
|
left: 0;
|
|
977
971
|
width: 100%;
|
|
978
972
|
height: 100%;
|
|
979
|
-
}
|
|
973
|
+
}
|
|
974
|
+
`;
|
|
980
975
|
const componentInfo$a = {
|
|
981
976
|
name: "Core:Button",
|
|
982
977
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
|
|
@@ -1738,10 +1733,15 @@ const getBuilderSearchParamsFromWindow = () => {
|
|
|
1738
1733
|
};
|
|
1739
1734
|
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
1740
1735
|
const generateContentUrl = (options) => {
|
|
1741
|
-
const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, locale } = options;
|
|
1736
|
+
const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, locale, apiVersion = "v2" } = options;
|
|
1742
1737
|
if (!apiKey)
|
|
1743
1738
|
throw new Error("Missing API key");
|
|
1744
|
-
|
|
1739
|
+
if (![
|
|
1740
|
+
"v2",
|
|
1741
|
+
"v3"
|
|
1742
|
+
].includes(apiVersion))
|
|
1743
|
+
throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${apiVersion}'`);
|
|
1744
|
+
const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}&includeRefs=${includeRefs}${locale ? `&locale=${locale}` : ""}`);
|
|
1745
1745
|
const queryOptions = {
|
|
1746
1746
|
...getBuilderSearchParamsFromWindow(),
|
|
1747
1747
|
...normalizeSearchParams(options.options || {})
|
|
@@ -1779,39 +1779,47 @@ async function getAllContent(options) {
|
|
|
1779
1779
|
});
|
|
1780
1780
|
return content;
|
|
1781
1781
|
}
|
|
1782
|
-
const
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
props.
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
|
|
1782
|
+
const fetchContent = function fetchContent2(props, state, builderContext2) {
|
|
1783
|
+
if (!state.contentToUse && props.symbol?.model && builderContext2?.apiKey)
|
|
1784
|
+
getContent({
|
|
1785
|
+
model: props.symbol.model,
|
|
1786
|
+
apiKey: builderContext2.apiKey,
|
|
1787
|
+
apiVersion: builderContext2.apiVersion,
|
|
1788
|
+
query: {
|
|
1789
|
+
id: props.symbol.entry
|
|
1790
|
+
}
|
|
1791
|
+
}).then((response) => {
|
|
1792
|
+
if (response)
|
|
1793
|
+
state.contentToUse = response;
|
|
1794
|
+
}).catch((err) => {
|
|
1795
|
+
console.error("[Builder.io]: Could not fetch symbol content: ", err);
|
|
1796
|
+
});
|
|
1794
1797
|
};
|
|
1795
1798
|
const Symbol$1 = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
1796
1799
|
const builderContext$1 = qwik.useContext(builderContext);
|
|
1797
1800
|
const state = qwik.useStore({
|
|
1798
|
-
|
|
1801
|
+
className: [
|
|
1802
|
+
...[
|
|
1803
|
+
props.attributes.class
|
|
1804
|
+
],
|
|
1805
|
+
"builder-symbol",
|
|
1806
|
+
props.symbol?.inline ? "builder-inline-symbol" : void 0,
|
|
1807
|
+
props.symbol?.dynamic || props.dynamic ? "builder-dynamic-symbol" : void 0
|
|
1808
|
+
].filter(Boolean).join(" "),
|
|
1809
|
+
contentToUse: props.symbol?.content
|
|
1799
1810
|
});
|
|
1811
|
+
qwik.useClientEffectQrl(qwik.inlinedQrl(() => {
|
|
1812
|
+
const [builderContext2, props2, state2] = qwik.useLexicalScope();
|
|
1813
|
+
fetchContent(props2, state2, builderContext2);
|
|
1814
|
+
}, "Symbol_component_useClientEffect_Kfc9q3nzeSQ", [
|
|
1815
|
+
builderContext$1,
|
|
1816
|
+
props,
|
|
1817
|
+
state
|
|
1818
|
+
]));
|
|
1800
1819
|
qwik.useTaskQrl(qwik.inlinedQrl(({ track: track2 }) => {
|
|
1801
1820
|
const [builderContext2, props2, state2] = qwik.useLexicalScope();
|
|
1802
1821
|
track2(() => props2.symbol);
|
|
1803
|
-
|
|
1804
|
-
const symbolToUse = props2.symbol;
|
|
1805
|
-
if (symbolToUse && !symbolToUse.content && !state2.fetchedContent && symbolToUse.model && builderContext2?.apiKey)
|
|
1806
|
-
getContent({
|
|
1807
|
-
model: symbolToUse.model,
|
|
1808
|
-
apiKey: builderContext2.apiKey,
|
|
1809
|
-
query: {
|
|
1810
|
-
id: symbolToUse.entry
|
|
1811
|
-
}
|
|
1812
|
-
}).then((response) => {
|
|
1813
|
-
state2.fetchedContent = response;
|
|
1814
|
-
});
|
|
1822
|
+
fetchContent(props2, state2, builderContext2);
|
|
1815
1823
|
}, "Symbol_component_useTask_NIAWAC1bMBo", [
|
|
1816
1824
|
builderContext$1,
|
|
1817
1825
|
props,
|
|
@@ -1819,8 +1827,13 @@ const Symbol$1 = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
|
1819
1827
|
]));
|
|
1820
1828
|
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
1821
1829
|
...props.attributes,
|
|
1822
|
-
class
|
|
1830
|
+
get class() {
|
|
1831
|
+
return state.className;
|
|
1832
|
+
},
|
|
1823
1833
|
children: /* @__PURE__ */ jsxRuntime.jsx(RenderContent$1, {
|
|
1834
|
+
get apiVersion() {
|
|
1835
|
+
return builderContext$1.apiVersion;
|
|
1836
|
+
},
|
|
1824
1837
|
get apiKey() {
|
|
1825
1838
|
return builderContext$1.apiKey;
|
|
1826
1839
|
},
|
|
@@ -1831,15 +1844,22 @@ const Symbol$1 = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props) => {
|
|
|
1831
1844
|
data: {
|
|
1832
1845
|
...props.symbol?.data,
|
|
1833
1846
|
...builderContext$1.state,
|
|
1834
|
-
...
|
|
1847
|
+
...state.contentToUse?.data?.state
|
|
1835
1848
|
},
|
|
1836
1849
|
model: props.symbol?.model,
|
|
1837
|
-
content
|
|
1850
|
+
get content() {
|
|
1851
|
+
return state.contentToUse;
|
|
1852
|
+
},
|
|
1838
1853
|
[qwik._IMMUTABLE]: {
|
|
1854
|
+
apiVersion: qwik._wrapSignal(builderContext$1, "apiVersion"),
|
|
1839
1855
|
apiKey: qwik._wrapSignal(builderContext$1, "apiKey"),
|
|
1840
|
-
context: qwik._wrapSignal(builderContext$1, "context")
|
|
1856
|
+
context: qwik._wrapSignal(builderContext$1, "context"),
|
|
1857
|
+
content: qwik._wrapSignal(state, "contentToUse")
|
|
1841
1858
|
}
|
|
1842
|
-
}, "Wt_0")
|
|
1859
|
+
}, "Wt_0"),
|
|
1860
|
+
[qwik._IMMUTABLE]: {
|
|
1861
|
+
class: qwik._wrapSignal(state, "className")
|
|
1862
|
+
}
|
|
1843
1863
|
});
|
|
1844
1864
|
}, "Symbol_component_WVvggdkUPdk"));
|
|
1845
1865
|
const componentInfo$4 = {
|
|
@@ -2937,6 +2957,7 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
2937
2957
|
state: state.contentState,
|
|
2938
2958
|
context: props.context || {},
|
|
2939
2959
|
apiKey: props.apiKey,
|
|
2960
|
+
apiVersion: props.apiVersion,
|
|
2940
2961
|
registeredComponents: state.allRegisteredComponents
|
|
2941
2962
|
}));
|
|
2942
2963
|
qwik.useClientEffectQrl(qwik.inlinedQrl(() => {
|
|
@@ -2980,7 +3001,8 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
2980
3001
|
if (searchParamPreview === props2.model && previewApiKey === props2.apiKey)
|
|
2981
3002
|
getContent({
|
|
2982
3003
|
model: props2.model,
|
|
2983
|
-
apiKey: props2.apiKey
|
|
3004
|
+
apiKey: props2.apiKey,
|
|
3005
|
+
apiVersion: props2.apiVersion
|
|
2984
3006
|
}).then((content) => {
|
|
2985
3007
|
if (content)
|
|
2986
3008
|
mergeNewContent(props2, state2, elementRef2, content);
|
|
@@ -2995,12 +3017,22 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
2995
3017
|
props,
|
|
2996
3018
|
state
|
|
2997
3019
|
]));
|
|
3020
|
+
qwik.useTaskQrl(qwik.inlinedQrl(({ track: track2 }) => {
|
|
3021
|
+
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3022
|
+
track2(() => props2.content);
|
|
3023
|
+
if (props2.content)
|
|
3024
|
+
mergeNewContent(props2, state2, elementRef2, props2.content);
|
|
3025
|
+
}, "RenderContent_component_useTask_Kulmlf9pM08", [
|
|
3026
|
+
elementRef,
|
|
3027
|
+
props,
|
|
3028
|
+
state
|
|
3029
|
+
]));
|
|
2998
3030
|
qwik.useTaskQrl(qwik.inlinedQrl(({ track: track2 }) => {
|
|
2999
3031
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3000
3032
|
track2(() => state2.useContent?.data?.jsCode);
|
|
3001
3033
|
track2(() => state2.contentState);
|
|
3002
3034
|
evaluateJsCode(props2, state2);
|
|
3003
|
-
}, "
|
|
3035
|
+
}, "RenderContent_component_useTask_1_X59YMGOetns", [
|
|
3004
3036
|
elementRef,
|
|
3005
3037
|
props,
|
|
3006
3038
|
state
|
|
@@ -3009,7 +3041,7 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
3009
3041
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3010
3042
|
track2(() => state2.useContent?.data?.httpRequests);
|
|
3011
3043
|
runHttpRequests(props2, state2, elementRef2);
|
|
3012
|
-
}, "
|
|
3044
|
+
}, "RenderContent_component_useTask_2_u3gn3Pj2b2s", [
|
|
3013
3045
|
elementRef,
|
|
3014
3046
|
props,
|
|
3015
3047
|
state
|
|
@@ -3018,7 +3050,7 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(qwik.inlinedQrl((props)
|
|
|
3018
3050
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3019
3051
|
track2(() => state2.contentState);
|
|
3020
3052
|
emitStateUpdate(props2, state2);
|
|
3021
|
-
}, "
|
|
3053
|
+
}, "RenderContent_component_useTask_3_xLCHvjhJYRM", [
|
|
3022
3054
|
elementRef,
|
|
3023
3055
|
props,
|
|
3024
3056
|
state
|
package/lib/index.qwik.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, useStylesScopedQrl, _wrapSignal, _IMMUTABLE, createContext, useLexicalScope, useContextProvider, useStore, useContext, Slot, Fragment as Fragment$1, useTaskQrl, useRef,
|
|
1
|
+
import { componentQrl, inlinedQrl, useStylesScopedQrl, _wrapSignal, _IMMUTABLE, createContext, useLexicalScope, useContextProvider, useStore, useContext, Slot, Fragment as Fragment$1, useClientEffectQrl, useTaskQrl, useRef, useCleanupQrl } from "@builder.io/qwik";
|
|
2
2
|
import { jsx, Fragment, jsxs } from "@builder.io/qwik/jsx-runtime";
|
|
3
3
|
const Button = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
4
4
|
useStylesScopedQrl(inlinedQrl(STYLES$3, "Button_component_useStylesScoped_a1JZ0Q0Q2Oc"));
|
|
@@ -27,7 +27,8 @@ const Button = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
27
27
|
const STYLES$3 = `
|
|
28
28
|
.button-Button {
|
|
29
29
|
all: unset;
|
|
30
|
-
}
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
31
32
|
const builderContext = createContext("Builder");
|
|
32
33
|
const TARGET = "qwik";
|
|
33
34
|
function isBrowser() {
|
|
@@ -584,7 +585,7 @@ const RenderBlock = (props) => {
|
|
|
584
585
|
}, "9d_3");
|
|
585
586
|
};
|
|
586
587
|
const RenderBlock$1 = RenderBlock;
|
|
587
|
-
const className
|
|
588
|
+
const className = function className2(props, state, builderContext2) {
|
|
588
589
|
return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
|
|
589
590
|
};
|
|
590
591
|
const onClick$1 = function onClick2(props, state, builderContext2) {
|
|
@@ -612,7 +613,7 @@ const RenderBlocks = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
612
613
|
const builderContext$1 = useContext(builderContext);
|
|
613
614
|
const state = {};
|
|
614
615
|
return /* @__PURE__ */ jsxs("div", {
|
|
615
|
-
class: className
|
|
616
|
+
class: className(props) + " div-RenderBlocks",
|
|
616
617
|
get "builder-path"() {
|
|
617
618
|
return props.path;
|
|
618
619
|
},
|
|
@@ -665,91 +666,83 @@ const STYLES$2 = `
|
|
|
665
666
|
display: flex;
|
|
666
667
|
flex-direction: column;
|
|
667
668
|
align-items: stretch;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
return typeof props.space === "number" ? props.space || 0 : 20;
|
|
671
|
-
};
|
|
672
|
-
const getColumns = function getColumns2(props, state, builderContext2) {
|
|
673
|
-
return props.columns || [];
|
|
674
|
-
};
|
|
669
|
+
}
|
|
670
|
+
`;
|
|
675
671
|
const getWidth = function getWidth2(props, state, builderContext2, index) {
|
|
676
|
-
|
|
677
|
-
return columns[index]?.width || 100 / columns.length;
|
|
672
|
+
return state.cols[index]?.width || 100 / state.cols.length;
|
|
678
673
|
};
|
|
679
674
|
const getColumnCssWidth = function getColumnCssWidth2(props, state, builderContext2, index) {
|
|
680
|
-
const
|
|
681
|
-
const gutterSize = getGutterSize(props);
|
|
682
|
-
const subtractWidth = gutterSize * (columns.length - 1) / columns.length;
|
|
675
|
+
const subtractWidth = state.gutterSize * (state.cols.length - 1) / state.cols.length;
|
|
683
676
|
return `calc(${getWidth(props, state, builderContext2, index)}% - ${subtractWidth}px)`;
|
|
684
677
|
};
|
|
685
|
-
const
|
|
686
|
-
|
|
687
|
-
|
|
678
|
+
const getTabletStyle = function getTabletStyle2(props, state, builderContext2, { stackedStyle, desktopStyle }) {
|
|
679
|
+
return state.stackAt === "tablet" ? stackedStyle : desktopStyle;
|
|
680
|
+
};
|
|
681
|
+
const getMobileStyle = function getMobileStyle2(props, state, builderContext2, { stackedStyle, desktopStyle }) {
|
|
682
|
+
return state.stackAt === "never" ? desktopStyle : stackedStyle;
|
|
688
683
|
};
|
|
689
684
|
const columnsCssVars = function columnsCssVars2(props, state, builderContext2) {
|
|
690
|
-
const flexDir = props.stackColumnsAt === "never" ? "inherit" : props.reverseColumnsWhenStacked ? "column-reverse" : "column";
|
|
691
685
|
return {
|
|
692
|
-
"--flex-dir": flexDir,
|
|
693
|
-
"--flex-dir-tablet":
|
|
686
|
+
"--flex-dir": state.flexDir,
|
|
687
|
+
"--flex-dir-tablet": getTabletStyle(props, state, builderContext2, {
|
|
688
|
+
stackedStyle: state.flexDir,
|
|
689
|
+
desktopStyle: "row"
|
|
690
|
+
})
|
|
694
691
|
};
|
|
695
692
|
};
|
|
696
|
-
const columnCssVars = function columnCssVars2(props, state, builderContext2) {
|
|
697
|
-
const width =
|
|
698
|
-
const
|
|
693
|
+
const columnCssVars = function columnCssVars2(props, state, builderContext2, index) {
|
|
694
|
+
const width = getColumnCssWidth(props, state, builderContext2, index);
|
|
695
|
+
const gutter = `${index === 0 ? 0 : state.gutterSize}px`;
|
|
696
|
+
const mobileWidth = "100%";
|
|
697
|
+
const mobileMarginLeft = "0";
|
|
699
698
|
return {
|
|
700
|
-
|
|
701
|
-
"
|
|
702
|
-
"--column-width-
|
|
703
|
-
|
|
699
|
+
width,
|
|
700
|
+
"margin-left": gutter,
|
|
701
|
+
"--column-width-mobile": getMobileStyle(props, state, builderContext2, {
|
|
702
|
+
stackedStyle: mobileWidth,
|
|
703
|
+
desktopStyle: width
|
|
704
|
+
}),
|
|
705
|
+
"--column-margin-left-mobile": getMobileStyle(props, state, builderContext2, {
|
|
706
|
+
stackedStyle: mobileMarginLeft,
|
|
707
|
+
desktopStyle: gutter
|
|
708
|
+
}),
|
|
709
|
+
"--column-width-tablet": getTabletStyle(props, state, builderContext2, {
|
|
710
|
+
stackedStyle: mobileWidth,
|
|
711
|
+
desktopStyle: width
|
|
712
|
+
}),
|
|
713
|
+
"--column-margin-left-tablet": getTabletStyle(props, state, builderContext2, {
|
|
714
|
+
stackedStyle: mobileMarginLeft,
|
|
715
|
+
desktopStyle: gutter
|
|
716
|
+
})
|
|
704
717
|
};
|
|
705
718
|
};
|
|
706
719
|
const getWidthForBreakpointSize = function getWidthForBreakpointSize2(props, state, builderContext2, size) {
|
|
707
720
|
const breakpointSizes = getSizesForBreakpoints(builderContext2.content?.meta?.breakpoints || {});
|
|
708
721
|
return breakpointSizes[size].max;
|
|
709
722
|
};
|
|
710
|
-
const columnStyleObjects = function columnStyleObjects2(props, state, builderContext2) {
|
|
711
|
-
return {
|
|
712
|
-
columns: {
|
|
713
|
-
small: {
|
|
714
|
-
flexDirection: "var(--flex-dir)",
|
|
715
|
-
alignItems: "stretch"
|
|
716
|
-
},
|
|
717
|
-
medium: {
|
|
718
|
-
flexDirection: "var(--flex-dir-tablet)",
|
|
719
|
-
alignItems: "stretch"
|
|
720
|
-
}
|
|
721
|
-
},
|
|
722
|
-
column: {
|
|
723
|
-
small: {
|
|
724
|
-
width: "var(--column-width) !important",
|
|
725
|
-
marginLeft: "var(--column-margin-left) !important"
|
|
726
|
-
},
|
|
727
|
-
medium: {
|
|
728
|
-
width: "var(--column-width-tablet) !important",
|
|
729
|
-
marginLeft: "var(--column-margin-left-tablet) !important"
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
};
|
|
733
|
-
};
|
|
734
723
|
const columnsStyles = function columnsStyles2(props, state, builderContext2) {
|
|
735
724
|
return `
|
|
736
725
|
@media (max-width: ${getWidthForBreakpointSize(props, state, builderContext2, "medium")}px) {
|
|
737
726
|
.${props.builderBlock.id}-breakpoints {
|
|
738
|
-
|
|
727
|
+
flex-direction: var(--flex-dir-tablet);
|
|
728
|
+
align-items: stretch;
|
|
739
729
|
}
|
|
740
730
|
|
|
741
731
|
.${props.builderBlock.id}-breakpoints > .builder-column {
|
|
742
|
-
|
|
732
|
+
width: var(--column-width-tablet) !important;
|
|
733
|
+
margin-left: var(--column-margin-left-tablet) !important;
|
|
743
734
|
}
|
|
744
735
|
}
|
|
745
736
|
|
|
746
737
|
@media (max-width: ${getWidthForBreakpointSize(props, state, builderContext2, "small")}px) {
|
|
747
738
|
.${props.builderBlock.id}-breakpoints {
|
|
748
|
-
|
|
739
|
+
flex-direction: var(--flex-dir);
|
|
740
|
+
align-items: stretch;
|
|
749
741
|
}
|
|
750
742
|
|
|
751
743
|
.${props.builderBlock.id}-breakpoints > .builder-column {
|
|
752
|
-
|
|
744
|
+
width: var(--column-width-mobile) !important;
|
|
745
|
+
margin-left: var(--column-margin-left-mobile) !important;
|
|
753
746
|
}
|
|
754
747
|
},
|
|
755
748
|
`;
|
|
@@ -757,13 +750,15 @@ const columnsStyles = function columnsStyles2(props, state, builderContext2) {
|
|
|
757
750
|
const Columns = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
758
751
|
useStylesScopedQrl(inlinedQrl(STYLES$1, "Columns_component_useStylesScoped_s7JLZz7MCCQ"));
|
|
759
752
|
const builderContext$1 = useContext(builderContext);
|
|
760
|
-
const state = {
|
|
753
|
+
const state = useStore({
|
|
754
|
+
cols: props.columns || [],
|
|
755
|
+
flexDir: props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column",
|
|
756
|
+
gutterSize: typeof props.space === "number" ? props.space || 0 : 20,
|
|
757
|
+
stackAt: props.stackColumnsAt || "tablet"
|
|
758
|
+
});
|
|
761
759
|
return /* @__PURE__ */ jsxs("div", {
|
|
762
760
|
class: `builder-columns ${props.builderBlock.id}-breakpoints div-Columns`,
|
|
763
|
-
style:
|
|
764
|
-
...{},
|
|
765
|
-
...columnsCssVars(props, state, builderContext$1)
|
|
766
|
-
},
|
|
761
|
+
style: columnsCssVars(props, state, builderContext$1),
|
|
767
762
|
children: [
|
|
768
763
|
/* @__PURE__ */ jsx(RenderInlinedStyles, {
|
|
769
764
|
styles: columnsStyles(props, state, builderContext$1)
|
|
@@ -771,12 +766,7 @@ const Columns = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
771
766
|
(props.columns || []).map(function(column, index) {
|
|
772
767
|
return /* @__PURE__ */ jsx("div", {
|
|
773
768
|
class: "builder-column div-Columns-2",
|
|
774
|
-
style:
|
|
775
|
-
width: getColumnCssWidth(props, state, builderContext$1, index),
|
|
776
|
-
marginLeft: `${index === 0 ? 0 : getGutterSize(props)}px`,
|
|
777
|
-
...{},
|
|
778
|
-
...columnCssVars(props, state, builderContext$1)
|
|
779
|
-
},
|
|
769
|
+
style: columnCssVars(props, state, builderContext$1, index),
|
|
780
770
|
children: /* @__PURE__ */ jsx(RenderBlocks, {
|
|
781
771
|
get blocks() {
|
|
782
772
|
return column.blocks;
|
|
@@ -805,11 +795,13 @@ const STYLES$1 = `
|
|
|
805
795
|
.div-Columns {
|
|
806
796
|
display: flex;
|
|
807
797
|
line-height: normal;
|
|
808
|
-
}
|
|
798
|
+
}
|
|
799
|
+
.div-Columns-2 {
|
|
809
800
|
display: flex;
|
|
810
801
|
flex-direction: column;
|
|
811
802
|
align-items: stretch;
|
|
812
|
-
}
|
|
803
|
+
}
|
|
804
|
+
`;
|
|
813
805
|
const FragmentComponent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
814
806
|
return /* @__PURE__ */ jsx("span", {
|
|
815
807
|
children: /* @__PURE__ */ jsx(Slot, {}, "oj_0")
|
|
@@ -961,11 +953,13 @@ const STYLES = `
|
|
|
961
953
|
.img-Image {
|
|
962
954
|
opacity: 1;
|
|
963
955
|
transition: opacity 0.2s ease-in-out;
|
|
964
|
-
}
|
|
956
|
+
}
|
|
957
|
+
.div-Image {
|
|
965
958
|
width: 100%;
|
|
966
959
|
pointer-events: none;
|
|
967
960
|
font-size: 0;
|
|
968
|
-
}
|
|
961
|
+
}
|
|
962
|
+
.div-Image-2 {
|
|
969
963
|
display: flex;
|
|
970
964
|
flex-direction: column;
|
|
971
965
|
align-items: stretch;
|
|
@@ -974,7 +968,8 @@ const STYLES = `
|
|
|
974
968
|
left: 0;
|
|
975
969
|
width: 100%;
|
|
976
970
|
height: 100%;
|
|
977
|
-
}
|
|
971
|
+
}
|
|
972
|
+
`;
|
|
978
973
|
const componentInfo$a = {
|
|
979
974
|
name: "Core:Button",
|
|
980
975
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
|
|
@@ -1736,10 +1731,15 @@ const getBuilderSearchParamsFromWindow = () => {
|
|
|
1736
1731
|
};
|
|
1737
1732
|
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
1738
1733
|
const generateContentUrl = (options) => {
|
|
1739
|
-
const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, locale } = options;
|
|
1734
|
+
const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, locale, apiVersion = "v2" } = options;
|
|
1740
1735
|
if (!apiKey)
|
|
1741
1736
|
throw new Error("Missing API key");
|
|
1742
|
-
|
|
1737
|
+
if (![
|
|
1738
|
+
"v2",
|
|
1739
|
+
"v3"
|
|
1740
|
+
].includes(apiVersion))
|
|
1741
|
+
throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${apiVersion}'`);
|
|
1742
|
+
const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}&includeRefs=${includeRefs}${locale ? `&locale=${locale}` : ""}`);
|
|
1743
1743
|
const queryOptions = {
|
|
1744
1744
|
...getBuilderSearchParamsFromWindow(),
|
|
1745
1745
|
...normalizeSearchParams(options.options || {})
|
|
@@ -1777,39 +1777,47 @@ async function getAllContent(options) {
|
|
|
1777
1777
|
});
|
|
1778
1778
|
return content;
|
|
1779
1779
|
}
|
|
1780
|
-
const
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
props.
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
}
|
|
1790
|
-
|
|
1791
|
-
|
|
1780
|
+
const fetchContent = function fetchContent2(props, state, builderContext2) {
|
|
1781
|
+
if (!state.contentToUse && props.symbol?.model && builderContext2?.apiKey)
|
|
1782
|
+
getContent({
|
|
1783
|
+
model: props.symbol.model,
|
|
1784
|
+
apiKey: builderContext2.apiKey,
|
|
1785
|
+
apiVersion: builderContext2.apiVersion,
|
|
1786
|
+
query: {
|
|
1787
|
+
id: props.symbol.entry
|
|
1788
|
+
}
|
|
1789
|
+
}).then((response) => {
|
|
1790
|
+
if (response)
|
|
1791
|
+
state.contentToUse = response;
|
|
1792
|
+
}).catch((err) => {
|
|
1793
|
+
console.error("[Builder.io]: Could not fetch symbol content: ", err);
|
|
1794
|
+
});
|
|
1792
1795
|
};
|
|
1793
1796
|
const Symbol$1 = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
1794
1797
|
const builderContext$1 = useContext(builderContext);
|
|
1795
1798
|
const state = useStore({
|
|
1796
|
-
|
|
1799
|
+
className: [
|
|
1800
|
+
...[
|
|
1801
|
+
props.attributes.class
|
|
1802
|
+
],
|
|
1803
|
+
"builder-symbol",
|
|
1804
|
+
props.symbol?.inline ? "builder-inline-symbol" : void 0,
|
|
1805
|
+
props.symbol?.dynamic || props.dynamic ? "builder-dynamic-symbol" : void 0
|
|
1806
|
+
].filter(Boolean).join(" "),
|
|
1807
|
+
contentToUse: props.symbol?.content
|
|
1797
1808
|
});
|
|
1809
|
+
useClientEffectQrl(inlinedQrl(() => {
|
|
1810
|
+
const [builderContext2, props2, state2] = useLexicalScope();
|
|
1811
|
+
fetchContent(props2, state2, builderContext2);
|
|
1812
|
+
}, "Symbol_component_useClientEffect_Kfc9q3nzeSQ", [
|
|
1813
|
+
builderContext$1,
|
|
1814
|
+
props,
|
|
1815
|
+
state
|
|
1816
|
+
]));
|
|
1798
1817
|
useTaskQrl(inlinedQrl(({ track: track2 }) => {
|
|
1799
1818
|
const [builderContext2, props2, state2] = useLexicalScope();
|
|
1800
1819
|
track2(() => props2.symbol);
|
|
1801
|
-
|
|
1802
|
-
const symbolToUse = props2.symbol;
|
|
1803
|
-
if (symbolToUse && !symbolToUse.content && !state2.fetchedContent && symbolToUse.model && builderContext2?.apiKey)
|
|
1804
|
-
getContent({
|
|
1805
|
-
model: symbolToUse.model,
|
|
1806
|
-
apiKey: builderContext2.apiKey,
|
|
1807
|
-
query: {
|
|
1808
|
-
id: symbolToUse.entry
|
|
1809
|
-
}
|
|
1810
|
-
}).then((response) => {
|
|
1811
|
-
state2.fetchedContent = response;
|
|
1812
|
-
});
|
|
1820
|
+
fetchContent(props2, state2, builderContext2);
|
|
1813
1821
|
}, "Symbol_component_useTask_NIAWAC1bMBo", [
|
|
1814
1822
|
builderContext$1,
|
|
1815
1823
|
props,
|
|
@@ -1817,8 +1825,13 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
1817
1825
|
]));
|
|
1818
1826
|
return /* @__PURE__ */ jsx("div", {
|
|
1819
1827
|
...props.attributes,
|
|
1820
|
-
class
|
|
1828
|
+
get class() {
|
|
1829
|
+
return state.className;
|
|
1830
|
+
},
|
|
1821
1831
|
children: /* @__PURE__ */ jsx(RenderContent$1, {
|
|
1832
|
+
get apiVersion() {
|
|
1833
|
+
return builderContext$1.apiVersion;
|
|
1834
|
+
},
|
|
1822
1835
|
get apiKey() {
|
|
1823
1836
|
return builderContext$1.apiKey;
|
|
1824
1837
|
},
|
|
@@ -1829,15 +1842,22 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
1829
1842
|
data: {
|
|
1830
1843
|
...props.symbol?.data,
|
|
1831
1844
|
...builderContext$1.state,
|
|
1832
|
-
...
|
|
1845
|
+
...state.contentToUse?.data?.state
|
|
1833
1846
|
},
|
|
1834
1847
|
model: props.symbol?.model,
|
|
1835
|
-
content
|
|
1848
|
+
get content() {
|
|
1849
|
+
return state.contentToUse;
|
|
1850
|
+
},
|
|
1836
1851
|
[_IMMUTABLE]: {
|
|
1852
|
+
apiVersion: _wrapSignal(builderContext$1, "apiVersion"),
|
|
1837
1853
|
apiKey: _wrapSignal(builderContext$1, "apiKey"),
|
|
1838
|
-
context: _wrapSignal(builderContext$1, "context")
|
|
1854
|
+
context: _wrapSignal(builderContext$1, "context"),
|
|
1855
|
+
content: _wrapSignal(state, "contentToUse")
|
|
1839
1856
|
}
|
|
1840
|
-
}, "Wt_0")
|
|
1857
|
+
}, "Wt_0"),
|
|
1858
|
+
[_IMMUTABLE]: {
|
|
1859
|
+
class: _wrapSignal(state, "className")
|
|
1860
|
+
}
|
|
1841
1861
|
});
|
|
1842
1862
|
}, "Symbol_component_WVvggdkUPdk"));
|
|
1843
1863
|
const componentInfo$4 = {
|
|
@@ -2935,6 +2955,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
2935
2955
|
state: state.contentState,
|
|
2936
2956
|
context: props.context || {},
|
|
2937
2957
|
apiKey: props.apiKey,
|
|
2958
|
+
apiVersion: props.apiVersion,
|
|
2938
2959
|
registeredComponents: state.allRegisteredComponents
|
|
2939
2960
|
}));
|
|
2940
2961
|
useClientEffectQrl(inlinedQrl(() => {
|
|
@@ -2978,7 +2999,8 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
2978
2999
|
if (searchParamPreview === props2.model && previewApiKey === props2.apiKey)
|
|
2979
3000
|
getContent({
|
|
2980
3001
|
model: props2.model,
|
|
2981
|
-
apiKey: props2.apiKey
|
|
3002
|
+
apiKey: props2.apiKey,
|
|
3003
|
+
apiVersion: props2.apiVersion
|
|
2982
3004
|
}).then((content) => {
|
|
2983
3005
|
if (content)
|
|
2984
3006
|
mergeNewContent(props2, state2, elementRef2, content);
|
|
@@ -2993,12 +3015,22 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
2993
3015
|
props,
|
|
2994
3016
|
state
|
|
2995
3017
|
]));
|
|
3018
|
+
useTaskQrl(inlinedQrl(({ track: track2 }) => {
|
|
3019
|
+
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3020
|
+
track2(() => props2.content);
|
|
3021
|
+
if (props2.content)
|
|
3022
|
+
mergeNewContent(props2, state2, elementRef2, props2.content);
|
|
3023
|
+
}, "RenderContent_component_useTask_Kulmlf9pM08", [
|
|
3024
|
+
elementRef,
|
|
3025
|
+
props,
|
|
3026
|
+
state
|
|
3027
|
+
]));
|
|
2996
3028
|
useTaskQrl(inlinedQrl(({ track: track2 }) => {
|
|
2997
3029
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
2998
3030
|
track2(() => state2.useContent?.data?.jsCode);
|
|
2999
3031
|
track2(() => state2.contentState);
|
|
3000
3032
|
evaluateJsCode(props2, state2);
|
|
3001
|
-
}, "
|
|
3033
|
+
}, "RenderContent_component_useTask_1_X59YMGOetns", [
|
|
3002
3034
|
elementRef,
|
|
3003
3035
|
props,
|
|
3004
3036
|
state
|
|
@@ -3007,7 +3039,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
3007
3039
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3008
3040
|
track2(() => state2.useContent?.data?.httpRequests);
|
|
3009
3041
|
runHttpRequests(props2, state2, elementRef2);
|
|
3010
|
-
}, "
|
|
3042
|
+
}, "RenderContent_component_useTask_2_u3gn3Pj2b2s", [
|
|
3011
3043
|
elementRef,
|
|
3012
3044
|
props,
|
|
3013
3045
|
state
|
|
@@ -3016,7 +3048,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
|
|
|
3016
3048
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3017
3049
|
track2(() => state2.contentState);
|
|
3018
3050
|
emitStateUpdate(props2, state2);
|
|
3019
|
-
}, "
|
|
3051
|
+
}, "RenderContent_component_useTask_3_xLCHvjhJYRM", [
|
|
3020
3052
|
elementRef,
|
|
3021
3053
|
props,
|
|
3022
3054
|
state
|
package/package.json
CHANGED
|
@@ -6,4 +6,4 @@ export interface ButtonProps {
|
|
|
6
6
|
}
|
|
7
7
|
export declare const Button: import("@builder.io/qwik").Component<ButtonProps>;
|
|
8
8
|
export default Button;
|
|
9
|
-
export declare const STYLES = "\n.button-Button {\n all: unset;\n}";
|
|
9
|
+
export declare const STYLES = "\n.button-Button {\n all: unset;\n}\n";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BuilderBlock } from "../../types/builder-block";
|
|
2
2
|
import type { SizeName } from "../../constants/device-sizes";
|
|
3
3
|
type Column = {
|
|
4
|
-
blocks:
|
|
4
|
+
blocks: BuilderBlock[];
|
|
5
5
|
width?: number;
|
|
6
6
|
};
|
|
7
7
|
type StackColumnsAt = "tablet" | "mobile" | "never";
|
|
@@ -12,53 +12,44 @@ export interface ColumnProps {
|
|
|
12
12
|
stackColumnsAt?: StackColumnsAt;
|
|
13
13
|
reverseColumnsWhenStacked?: boolean;
|
|
14
14
|
}
|
|
15
|
-
export declare const getGutterSize: (props: any, state: any, builderContext: any) => any;
|
|
16
|
-
export declare const getColumns: (props: any, state: any, builderContext: any) => any;
|
|
17
15
|
export declare const getWidth: (props: any, state: any, builderContext: any, index: number) => any;
|
|
18
16
|
export declare const getColumnCssWidth: (props: any, state: any, builderContext: any, index: number) => string;
|
|
19
|
-
export declare const
|
|
17
|
+
export declare const getTabletStyle: (props: any, state: any, builderContext: any, { stackedStyle, desktopStyle, }: {
|
|
18
|
+
stackedStyle: string;
|
|
19
|
+
desktopStyle: string;
|
|
20
|
+
}) => string;
|
|
21
|
+
export declare const getMobileStyle: (props: any, state: any, builderContext: any, { stackedStyle, desktopStyle, }: {
|
|
22
|
+
stackedStyle: string;
|
|
23
|
+
desktopStyle: string;
|
|
24
|
+
}) => string;
|
|
20
25
|
export declare const columnsCssVars: (props: any, state: any, builderContext: any) => {
|
|
21
|
-
|
|
22
|
-
"--flex-dir
|
|
26
|
+
flexDirection: any;
|
|
27
|
+
"--flex-dir"?: undefined;
|
|
28
|
+
"--flex-dir-tablet"?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
"--flex-dir": any;
|
|
31
|
+
"--flex-dir-tablet": string;
|
|
32
|
+
flexDirection?: undefined;
|
|
23
33
|
};
|
|
24
|
-
export declare const columnCssVars: (props: any, state: any, builderContext: any) => {
|
|
25
|
-
"--column-width": string;
|
|
26
|
-
"--column-margin-left": string;
|
|
27
|
-
"--column-width-tablet": string | undefined;
|
|
28
|
-
"--column-margin-left-tablet": string | undefined;
|
|
29
|
-
};
|
|
30
|
-
export declare const getWidthForBreakpointSize: (props: any, state: any, builderContext: any, size: SizeName) => number;
|
|
31
|
-
export declare const columnStyleObjects: (props: any, state: any, builderContext: any) => {
|
|
32
|
-
columns: {
|
|
33
|
-
small: {
|
|
34
|
-
flexDirection: string;
|
|
35
|
-
alignItems: string;
|
|
36
|
-
};
|
|
37
|
-
medium: {
|
|
38
|
-
flexDirection: string;
|
|
39
|
-
alignItems: string;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
column: {
|
|
43
|
-
small: {
|
|
44
|
-
width: string;
|
|
45
|
-
marginLeft: string;
|
|
46
|
-
};
|
|
47
|
-
medium: {
|
|
48
|
-
width: string;
|
|
49
|
-
marginLeft: string;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
export declare const columnsStyles: (props: any, state: any, builderContext: any) => string;
|
|
54
|
-
export declare const reactNativeColumnsStyles: (props: any, state: any, builderContext: any) => {
|
|
55
|
-
flexDirection: string;
|
|
56
|
-
alignItems: string;
|
|
57
|
-
};
|
|
58
|
-
export declare const reactNativeColumnStyles: (props: any, state: any, builderContext: any) => {
|
|
34
|
+
export declare const columnCssVars: (props: any, state: any, builderContext: any, index: number) => {
|
|
59
35
|
width: string;
|
|
60
36
|
marginLeft: string;
|
|
37
|
+
"margin-left"?: undefined;
|
|
38
|
+
"--column-width-mobile"?: undefined;
|
|
39
|
+
"--column-margin-left-mobile"?: undefined;
|
|
40
|
+
"--column-width-tablet"?: undefined;
|
|
41
|
+
"--column-margin-left-tablet"?: undefined;
|
|
42
|
+
} | {
|
|
43
|
+
width: string;
|
|
44
|
+
"margin-left": string;
|
|
45
|
+
"--column-width-mobile": string;
|
|
46
|
+
"--column-margin-left-mobile": string;
|
|
47
|
+
"--column-width-tablet": string;
|
|
48
|
+
"--column-margin-left-tablet": string;
|
|
49
|
+
marginLeft?: undefined;
|
|
61
50
|
};
|
|
51
|
+
export declare const getWidthForBreakpointSize: (props: any, state: any, builderContext: any, size: SizeName) => number;
|
|
52
|
+
export declare const columnsStyles: (props: any, state: any, builderContext: any) => string;
|
|
62
53
|
export declare const Columns: import("@builder.io/qwik").Component<ColumnProps>;
|
|
63
54
|
export default Columns;
|
|
64
|
-
export declare const STYLES = "\n.div-Columns {\n display: flex;\n line-height: normal;\n}.div-Columns-2 {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n}";
|
|
55
|
+
export declare const STYLES = "\n.div-Columns {\n display: flex;\n line-height: normal;\n}\n.div-Columns-2 {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n}\n";
|
|
@@ -29,4 +29,4 @@ export declare const aspectRatioCss: (props: any, state: any) => {
|
|
|
29
29
|
} | undefined;
|
|
30
30
|
export declare const Image: import("@builder.io/qwik").Component<ImageProps>;
|
|
31
31
|
export default Image;
|
|
32
|
-
export declare const STYLES = "\n.img-Image {\n opacity: 1;\n transition: opacity 0.2s ease-in-out;\n}.div-Image {\n width: 100%;\n pointer-events: none;\n font-size: 0;\n}.div-Image-2 {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}";
|
|
32
|
+
export declare const STYLES = "\n.img-Image {\n opacity: 1;\n transition: opacity 0.2s ease-in-out;\n}\n.div-Image {\n width: 100%;\n pointer-events: none;\n font-size: 0;\n}\n.div-Image-2 {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n";
|
|
@@ -16,7 +16,6 @@ export interface SymbolProps {
|
|
|
16
16
|
attributes?: any;
|
|
17
17
|
inheritState?: boolean;
|
|
18
18
|
}
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const contentToUse: (props: any, state: any, builderContext: any) => any;
|
|
19
|
+
export declare const fetchContent: (props: any, state: any, builderContext: any) => void;
|
|
21
20
|
export declare const Symbol: import("@builder.io/qwik").Component<SymbolProps>;
|
|
22
21
|
export default Symbol;
|
|
@@ -10,4 +10,4 @@ export declare const onClick: (props: any, state: any, builderContext: any) => v
|
|
|
10
10
|
export declare const onMouseEnter: (props: any, state: any, builderContext: any) => void;
|
|
11
11
|
export declare const RenderBlocks: import("@builder.io/qwik").Component<RenderBlockProps>;
|
|
12
12
|
export default RenderBlocks;
|
|
13
|
-
export declare const STYLES = "\n.div-RenderBlocks {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n}";
|
|
13
|
+
export declare const STYLES = "\n.div-RenderBlocks {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n}\n";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BuilderRenderContext, RegisteredComponent, BuilderRenderState } from '../../context/types';
|
|
2
2
|
import type { BuilderContent } from '../../types/builder-content';
|
|
3
3
|
import type { Nullable } from '../../types/typescript';
|
|
4
|
+
import type { ApiVersion } from '../../types/api-version';
|
|
4
5
|
export type RenderContentProps = {
|
|
5
6
|
content?: Nullable<BuilderContent>;
|
|
6
7
|
model?: string;
|
|
@@ -9,6 +10,7 @@ export type RenderContentProps = {
|
|
|
9
10
|
};
|
|
10
11
|
context?: BuilderRenderContext;
|
|
11
12
|
apiKey: string;
|
|
13
|
+
apiVersion?: ApiVersion;
|
|
12
14
|
customComponents?: RegisteredComponent[];
|
|
13
15
|
canTrack?: boolean;
|
|
14
16
|
locale?: string;
|
package/types/context/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BuilderContent } from '../types/builder-content.js';
|
|
2
2
|
import type { ComponentInfo } from '../types/components.js';
|
|
3
3
|
import type { Dictionary, Nullable } from '../types/typescript.js';
|
|
4
|
+
import type { ApiVersion } from '../types/api-version.js';
|
|
4
5
|
export type RegisteredComponent = ComponentInfo & {
|
|
5
6
|
component: any;
|
|
6
7
|
};
|
|
@@ -13,6 +14,7 @@ export interface BuilderContextInterface {
|
|
|
13
14
|
state: BuilderRenderState;
|
|
14
15
|
setState?: (state: BuilderRenderState) => void;
|
|
15
16
|
apiKey: string | null;
|
|
17
|
+
apiVersion?: ApiVersion;
|
|
16
18
|
registeredComponents: RegisteredComponents;
|
|
17
19
|
inheritedStyles: Record<string, unknown>;
|
|
18
20
|
}
|
|
@@ -36,4 +36,10 @@ export interface GetContentOptions {
|
|
|
36
36
|
* If provided, the API will auto-resolve localized objects to the value of this `locale` key.
|
|
37
37
|
*/
|
|
38
38
|
locale?: string;
|
|
39
|
+
/**
|
|
40
|
+
* If provided, sets the Builder API version used to fetch content.
|
|
41
|
+
*
|
|
42
|
+
* Defaults to `v2`.
|
|
43
|
+
*/
|
|
44
|
+
apiVersion?: 'v2' | 'v3';
|
|
39
45
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ApiVersion = 'v2' | 'v3';
|