@builder.io/sdk-solid 2.0.2 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -1
- package/lib/browser/dev.js +45 -24
- package/lib/browser/dev.jsx +102 -77
- package/lib/browser/index.js +45 -24
- package/lib/browser/index.jsx +102 -77
- package/lib/edge/dev.js +45 -24
- package/lib/edge/dev.jsx +102 -77
- package/lib/edge/index.js +45 -24
- package/lib/edge/index.jsx +102 -77
- package/lib/node/dev.js +45 -24
- package/lib/node/dev.jsx +102 -77
- package/lib/node/index.js +45 -24
- package/lib/node/index.jsx +102 -77
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -558,6 +558,7 @@ interface FragmentProps {
|
|
|
558
558
|
declare function FragmentComponent(props: FragmentProps): solid_js.JSX.Element;
|
|
559
559
|
|
|
560
560
|
interface ImageProps {
|
|
561
|
+
attributes?: string;
|
|
561
562
|
highPriority?: boolean;
|
|
562
563
|
className?: string;
|
|
563
564
|
image: string;
|
|
@@ -570,6 +571,7 @@ interface ImageProps {
|
|
|
570
571
|
backgroundPosition?: string;
|
|
571
572
|
srcset?: string;
|
|
572
573
|
aspectRatio?: number;
|
|
574
|
+
lockAspectRatio?: boolean;
|
|
573
575
|
children?: any;
|
|
574
576
|
fitContent?: boolean;
|
|
575
577
|
builderBlock?: BuilderBlock;
|
|
@@ -602,6 +604,7 @@ interface SymbolProps extends BuilderComponentsProp, BuilderDataProps, BuilderLi
|
|
|
602
604
|
dynamic?: boolean;
|
|
603
605
|
attributes?: any;
|
|
604
606
|
inheritState?: boolean;
|
|
607
|
+
renderToLiquid?: boolean;
|
|
605
608
|
}
|
|
606
609
|
|
|
607
610
|
declare function Symbol(props: SymbolProps): solid_js.JSX.Element;
|
|
@@ -748,7 +751,7 @@ declare function isPreviewing(_search?: Search): boolean;
|
|
|
748
751
|
|
|
749
752
|
declare const createRegisterComponentMessage: (info: ComponentInfo) => {
|
|
750
753
|
type: string;
|
|
751
|
-
data:
|
|
754
|
+
data: any;
|
|
752
755
|
};
|
|
753
756
|
|
|
754
757
|
type DeepPartial<T> = {
|
package/lib/browser/dev.js
CHANGED
|
@@ -533,6 +533,9 @@ function assign(target, ..._args) {
|
|
|
533
533
|
return to;
|
|
534
534
|
}
|
|
535
535
|
function bindAnimations(animations) {
|
|
536
|
+
if (TARGET === "reactNative") {
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
536
539
|
for (const animation of animations) {
|
|
537
540
|
switch (animation.trigger) {
|
|
538
541
|
case "pageLoad":
|
|
@@ -1563,7 +1566,7 @@ var getColumnsClass = (id) => {
|
|
|
1563
1566
|
|
|
1564
1567
|
// src/blocks/columns/columns.tsx
|
|
1565
1568
|
var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
|
|
1566
|
-
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-
|
|
1569
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-3ff242de {
|
|
1567
1570
|
display: flex;
|
|
1568
1571
|
line-height: normal;
|
|
1569
1572
|
}`);
|
|
@@ -1643,6 +1646,7 @@ function Columns(props) {
|
|
|
1643
1646
|
return breakpointSizes[size].max;
|
|
1644
1647
|
}
|
|
1645
1648
|
function columnsStyles() {
|
|
1649
|
+
const childColumnDiv = `.${props.builderBlock.id}-breakpoints > .builder-column`;
|
|
1646
1650
|
return `
|
|
1647
1651
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
1648
1652
|
.${props.builderBlock.id}-breakpoints {
|
|
@@ -1650,7 +1654,7 @@ function Columns(props) {
|
|
|
1650
1654
|
align-items: stretch;
|
|
1651
1655
|
}
|
|
1652
1656
|
|
|
1653
|
-
|
|
1657
|
+
${childColumnDiv} {
|
|
1654
1658
|
width: var(--column-width-tablet) !important;
|
|
1655
1659
|
margin-left: var(--column-margin-left-tablet) !important;
|
|
1656
1660
|
}
|
|
@@ -1662,7 +1666,7 @@ function Columns(props) {
|
|
|
1662
1666
|
align-items: stretch;
|
|
1663
1667
|
}
|
|
1664
1668
|
|
|
1665
|
-
|
|
1669
|
+
${childColumnDiv} {
|
|
1666
1670
|
width: var(--column-width-mobile) !important;
|
|
1667
1671
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
1668
1672
|
}
|
|
@@ -1683,7 +1687,7 @@ function Columns(props) {
|
|
|
1683
1687
|
const _el$ = _tmpl$3();
|
|
1684
1688
|
spread(_el$, mergeProps({
|
|
1685
1689
|
get ["class"]() {
|
|
1686
|
-
return getColumnsClass(props.builderBlock?.id) + " div-
|
|
1690
|
+
return getColumnsClass(props.builderBlock?.id) + " div-3ff242de";
|
|
1687
1691
|
},
|
|
1688
1692
|
get style() {
|
|
1689
1693
|
return columnsCssVars();
|
|
@@ -1808,16 +1812,16 @@ function getSrcSet(url) {
|
|
|
1808
1812
|
// src/blocks/image/image.tsx
|
|
1809
1813
|
var _tmpl$5 = /* @__PURE__ */ template(`<source type=image/webp>`);
|
|
1810
1814
|
var _tmpl$23 = /* @__PURE__ */ template(`<picture><img>`);
|
|
1811
|
-
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-
|
|
1812
|
-
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-
|
|
1813
|
-
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-
|
|
1815
|
+
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-4512e110">`);
|
|
1816
|
+
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-4512e110-2>`);
|
|
1817
|
+
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-4512e110 {
|
|
1814
1818
|
opacity: 1;
|
|
1815
1819
|
transition: opacity 0.2s ease-in-out;
|
|
1816
|
-
}.div-
|
|
1820
|
+
}.div-4512e110 {
|
|
1817
1821
|
width: 100%;
|
|
1818
1822
|
pointer-events: none;
|
|
1819
1823
|
font-size: 0;
|
|
1820
|
-
}.div-
|
|
1824
|
+
}.div-4512e110-2 {
|
|
1821
1825
|
display: flex;
|
|
1822
1826
|
flex-direction: column;
|
|
1823
1827
|
align-items: stretch;
|
|
@@ -1867,6 +1871,8 @@ function Image(props) {
|
|
|
1867
1871
|
const out = props.aspectRatio ? aspectRatioStyles : void 0;
|
|
1868
1872
|
return out;
|
|
1869
1873
|
});
|
|
1874
|
+
onMount(() => {
|
|
1875
|
+
});
|
|
1870
1876
|
return [[(() => {
|
|
1871
1877
|
const _el$ = _tmpl$23(), _el$3 = _el$.firstChild;
|
|
1872
1878
|
insert(_el$, createComponent(Show, {
|
|
@@ -1880,7 +1886,7 @@ function Image(props) {
|
|
|
1880
1886
|
}
|
|
1881
1887
|
}), _el$3);
|
|
1882
1888
|
effect((_p$) => {
|
|
1883
|
-
const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
1889
|
+
const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-4512e110", _v$2 = props.highPriority ? "eager" : "lazy", _v$3 = props.highPriority ? "high" : "auto", _v$4 = props.altText, _v$5 = props.altText ? void 0 : "presentation", _v$6 = {
|
|
1884
1890
|
"object-position": props.backgroundPosition || "center",
|
|
1885
1891
|
"object-fit": props.backgroundSize || "cover",
|
|
1886
1892
|
...aspectRatioCss()
|
|
@@ -3251,7 +3257,8 @@ delegateEvents(["click"]);
|
|
|
3251
3257
|
// src/blocks/text/component-info.ts
|
|
3252
3258
|
var componentInfo10 = {
|
|
3253
3259
|
shouldReceiveBuilderProps: {
|
|
3254
|
-
builderBlock: TARGET === "reactNative" ? true : false
|
|
3260
|
+
builderBlock: TARGET === "reactNative" ? true : false,
|
|
3261
|
+
builderContext: true
|
|
3255
3262
|
},
|
|
3256
3263
|
name: "Text",
|
|
3257
3264
|
static: true,
|
|
@@ -3273,10 +3280,27 @@ var componentInfo10 = {
|
|
|
3273
3280
|
};
|
|
3274
3281
|
var _tmpl$10 = /* @__PURE__ */ template(`<div class=builder-text>`);
|
|
3275
3282
|
function Text(props) {
|
|
3283
|
+
const processedText = createMemo(() => {
|
|
3284
|
+
const context = props.builderContext;
|
|
3285
|
+
const {
|
|
3286
|
+
context: contextContext,
|
|
3287
|
+
localState,
|
|
3288
|
+
rootState,
|
|
3289
|
+
rootSetState
|
|
3290
|
+
} = context;
|
|
3291
|
+
return String(props.text?.toString() || "").replace(/{{([^}]+)}}/g, (match, group) => evaluate({
|
|
3292
|
+
code: group,
|
|
3293
|
+
context: contextContext,
|
|
3294
|
+
localState,
|
|
3295
|
+
rootState,
|
|
3296
|
+
rootSetState,
|
|
3297
|
+
enableCache: false
|
|
3298
|
+
}));
|
|
3299
|
+
});
|
|
3276
3300
|
return (() => {
|
|
3277
3301
|
const _el$ = _tmpl$10();
|
|
3278
3302
|
_el$.style.setProperty("outline", "none");
|
|
3279
|
-
effect(() => _el$.innerHTML =
|
|
3303
|
+
effect(() => _el$.innerHTML = processedText());
|
|
3280
3304
|
return _el$;
|
|
3281
3305
|
})();
|
|
3282
3306
|
}
|
|
@@ -4575,17 +4599,14 @@ var serializeFn = (fnValue) => {
|
|
|
4575
4599
|
const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
|
|
4576
4600
|
return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
|
|
4577
4601
|
};
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
}
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
[key]: serializeValue(value)
|
|
4587
|
-
}), {}))
|
|
4588
|
-
});
|
|
4602
|
+
function serializeComponentInfo(info) {
|
|
4603
|
+
return JSON.parse(JSON.stringify(info, (key, value) => {
|
|
4604
|
+
if (typeof value === "function") {
|
|
4605
|
+
return serializeFn(value);
|
|
4606
|
+
}
|
|
4607
|
+
return value;
|
|
4608
|
+
}));
|
|
4609
|
+
}
|
|
4589
4610
|
|
|
4590
4611
|
// src/components/content-variants/inlined-fns.ts
|
|
4591
4612
|
var UPDATE_COOKIES_AND_STYLES_SCRIPT = "function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {\n function getAndSetVariantId() {\n function setCookie(name, value, days) {\n let expires = '';\n if (days) {\n const date = new Date();\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = '; expires=' + date.toUTCString();\n }\n document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${contentId}`;\n const variantInCookie = getCookie(cookieName);\n const availableIDs = variants.map(vr => vr.id).concat(contentId);\n if (variantInCookie && availableIDs.includes(variantInCookie)) {\n return variantInCookie;\n }\n let n = 0;\n const random = Math.random();\n for (let i = 0; i < variants.length; i++) {\n const variant = variants[i];\n const testRatio = variant.testRatio;\n n += testRatio;\n if (random < n) {\n setCookie(cookieName, variant.id);\n return variant.id;\n }\n }\n setCookie(cookieName, contentId);\n return contentId;\n }\n const winningVariantId = getAndSetVariantId();\n const styleEl = document.currentScript?.previousElementSibling;\n if (isHydrationTarget) {\n styleEl.remove();\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n } else {\n const newStyleStr = variants.concat({\n id: contentId\n }).filter(variant => variant.id !== winningVariantId).map(value => {\n return `.variant-${value.id} { display: none; }\n `;\n }).join('');\n styleEl.innerHTML = newStyleStr;\n }\n}";
|
|
@@ -5151,7 +5172,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
5151
5172
|
}
|
|
5152
5173
|
|
|
5153
5174
|
// src/constants/sdk-version.ts
|
|
5154
|
-
var SDK_VERSION = "2.0.
|
|
5175
|
+
var SDK_VERSION = "2.0.5";
|
|
5155
5176
|
|
|
5156
5177
|
// src/functions/register.ts
|
|
5157
5178
|
var registry = {};
|