@builder.io/sdk-solid 2.0.16 → 2.0.21
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 +6 -1
- package/lib/browser/dev.js +109 -84
- package/lib/browser/dev.jsx +167 -169
- package/lib/browser/index.js +109 -84
- package/lib/browser/index.jsx +167 -169
- package/lib/edge/dev.js +180 -118
- package/lib/edge/dev.jsx +238 -203
- package/lib/edge/index.js +180 -118
- package/lib/edge/index.jsx +238 -203
- package/lib/node/dev.js +110 -85
- package/lib/node/dev.jsx +168 -170
- package/lib/node/index.js +110 -85
- package/lib/node/index.jsx +168 -170
- package/package.json +1 -1
package/lib/node/dev.js
CHANGED
|
@@ -258,29 +258,6 @@ var parseCode = (code, {
|
|
|
258
258
|
const useCode = useReturn ? `return (${code});` : code;
|
|
259
259
|
return useCode;
|
|
260
260
|
};
|
|
261
|
-
|
|
262
|
-
// src/functions/evaluate/browser-runtime/browser.ts
|
|
263
|
-
var runInBrowser = ({
|
|
264
|
-
code,
|
|
265
|
-
builder,
|
|
266
|
-
context,
|
|
267
|
-
event,
|
|
268
|
-
localState,
|
|
269
|
-
rootSetState,
|
|
270
|
-
rootState
|
|
271
|
-
}) => {
|
|
272
|
-
const functionArgs = getFunctionArguments({
|
|
273
|
-
builder,
|
|
274
|
-
context,
|
|
275
|
-
event,
|
|
276
|
-
state: flattenState({
|
|
277
|
-
rootState,
|
|
278
|
-
localState,
|
|
279
|
-
rootSetState
|
|
280
|
-
})
|
|
281
|
-
});
|
|
282
|
-
return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
|
|
283
|
-
};
|
|
284
261
|
function flattenState({
|
|
285
262
|
rootState,
|
|
286
263
|
localState,
|
|
@@ -315,6 +292,29 @@ function flattenState({
|
|
|
315
292
|
});
|
|
316
293
|
}
|
|
317
294
|
|
|
295
|
+
// src/functions/evaluate/browser-runtime/browser.ts
|
|
296
|
+
var runInBrowser = ({
|
|
297
|
+
code,
|
|
298
|
+
builder,
|
|
299
|
+
context,
|
|
300
|
+
event,
|
|
301
|
+
localState,
|
|
302
|
+
rootSetState,
|
|
303
|
+
rootState
|
|
304
|
+
}) => {
|
|
305
|
+
const functionArgs = getFunctionArguments({
|
|
306
|
+
builder,
|
|
307
|
+
context,
|
|
308
|
+
event,
|
|
309
|
+
state: flattenState({
|
|
310
|
+
rootState,
|
|
311
|
+
localState,
|
|
312
|
+
rootSetState
|
|
313
|
+
})
|
|
314
|
+
});
|
|
315
|
+
return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
|
|
316
|
+
};
|
|
317
|
+
|
|
318
318
|
// src/constants/sdk-name.ts
|
|
319
319
|
var SDK_NAME_FOR_TARGET = (() => {
|
|
320
320
|
switch (TARGET) {
|
|
@@ -406,7 +406,7 @@ if (typeof output === 'object' && output !== null) {
|
|
|
406
406
|
};
|
|
407
407
|
var IVM_INSTANCE = null;
|
|
408
408
|
var IVM_CONTEXT = null;
|
|
409
|
-
var SHOULD_MENTION_INITIALIZE_SCRIPT = SDK_NAME === "@builder.io/sdk-react-nextjs" || SDK_NAME === "@builder.io/sdk-react" || SDK_NAME === "@builder.io/sdk-qwik";
|
|
409
|
+
var SHOULD_MENTION_INITIALIZE_SCRIPT = SDK_NAME === "@builder.io/sdk-react-nextjs" || SDK_NAME === "@builder.io/sdk-react" || SDK_NAME === "@builder.io/sdk-qwik" || SDK_NAME === "@builder.io/sdk-vue";
|
|
410
410
|
var getIvm = () => {
|
|
411
411
|
try {
|
|
412
412
|
if (IVM_INSTANCE)
|
|
@@ -1278,6 +1278,14 @@ function BlockWrapper(props) {
|
|
|
1278
1278
|
});
|
|
1279
1279
|
}
|
|
1280
1280
|
var block_wrapper_default = BlockWrapper;
|
|
1281
|
+
function Awaiter(props) {
|
|
1282
|
+
onMount(() => {
|
|
1283
|
+
});
|
|
1284
|
+
return memo(() => props.children);
|
|
1285
|
+
}
|
|
1286
|
+
var awaiter_default = Awaiter;
|
|
1287
|
+
|
|
1288
|
+
// src/components/block/components/interactive-element.tsx
|
|
1281
1289
|
function InteractiveElement(props) {
|
|
1282
1290
|
const attributes = createMemo(() => {
|
|
1283
1291
|
return props.includeBlockProps ? {
|
|
@@ -1294,17 +1302,43 @@ function InteractiveElement(props) {
|
|
|
1294
1302
|
})
|
|
1295
1303
|
} : {};
|
|
1296
1304
|
});
|
|
1297
|
-
return createComponent(
|
|
1298
|
-
get
|
|
1299
|
-
return
|
|
1305
|
+
return createComponent(Show, {
|
|
1306
|
+
get fallback() {
|
|
1307
|
+
return createComponent(Dynamic, mergeProps(() => props.wrapperProps, {
|
|
1308
|
+
get attributes() {
|
|
1309
|
+
return attributes();
|
|
1310
|
+
},
|
|
1311
|
+
get component() {
|
|
1312
|
+
return props.Wrapper;
|
|
1313
|
+
},
|
|
1314
|
+
get children() {
|
|
1315
|
+
return props.children;
|
|
1316
|
+
}
|
|
1317
|
+
}));
|
|
1300
1318
|
},
|
|
1301
|
-
get
|
|
1302
|
-
return props.Wrapper;
|
|
1319
|
+
get when() {
|
|
1320
|
+
return props.Wrapper.load;
|
|
1303
1321
|
},
|
|
1304
1322
|
get children() {
|
|
1305
|
-
return
|
|
1323
|
+
return createComponent(awaiter_default, {
|
|
1324
|
+
get load() {
|
|
1325
|
+
return props.Wrapper.load;
|
|
1326
|
+
},
|
|
1327
|
+
get fallback() {
|
|
1328
|
+
return props.Wrapper.fallback;
|
|
1329
|
+
},
|
|
1330
|
+
get props() {
|
|
1331
|
+
return props.wrapperProps;
|
|
1332
|
+
},
|
|
1333
|
+
get attributes() {
|
|
1334
|
+
return attributes();
|
|
1335
|
+
},
|
|
1336
|
+
get children() {
|
|
1337
|
+
return props.children;
|
|
1338
|
+
}
|
|
1339
|
+
});
|
|
1306
1340
|
}
|
|
1307
|
-
})
|
|
1341
|
+
});
|
|
1308
1342
|
}
|
|
1309
1343
|
var interactive_element_default = InteractiveElement;
|
|
1310
1344
|
|
|
@@ -1679,7 +1713,7 @@ function Block(props) {
|
|
|
1679
1713
|
});
|
|
1680
1714
|
}
|
|
1681
1715
|
var block_default = Block;
|
|
1682
|
-
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-
|
|
1716
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-68b2d7fe {
|
|
1683
1717
|
display: flex;
|
|
1684
1718
|
flex-direction: column;
|
|
1685
1719
|
align-items: stretch;
|
|
@@ -1715,7 +1749,7 @@ function BlocksWrapper(props) {
|
|
|
1715
1749
|
});
|
|
1716
1750
|
return [createComponent(Dynamic, mergeProps({
|
|
1717
1751
|
get ["class"]() {
|
|
1718
|
-
return className() + " dynamic-
|
|
1752
|
+
return className() + " dynamic-68b2d7fe";
|
|
1719
1753
|
},
|
|
1720
1754
|
ref(r$) {
|
|
1721
1755
|
const _ref$ = blocksWrapperRef;
|
|
@@ -1811,7 +1845,7 @@ var getColumnsClass = (id) => {
|
|
|
1811
1845
|
|
|
1812
1846
|
// src/blocks/columns/columns.tsx
|
|
1813
1847
|
var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
|
|
1814
|
-
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-
|
|
1848
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-46766f1c {
|
|
1815
1849
|
display: flex;
|
|
1816
1850
|
line-height: normal;
|
|
1817
1851
|
}`);
|
|
@@ -1932,7 +1966,7 @@ function Columns(props) {
|
|
|
1932
1966
|
const _el$ = _tmpl$3();
|
|
1933
1967
|
spread(_el$, mergeProps({
|
|
1934
1968
|
get ["class"]() {
|
|
1935
|
-
return getColumnsClass(props.builderBlock?.id) + " div-
|
|
1969
|
+
return getColumnsClass(props.builderBlock?.id) + " div-46766f1c";
|
|
1936
1970
|
},
|
|
1937
1971
|
get style() {
|
|
1938
1972
|
return columnsCssVars();
|
|
@@ -2057,16 +2091,16 @@ function getSrcSet(url) {
|
|
|
2057
2091
|
// src/blocks/image/image.tsx
|
|
2058
2092
|
var _tmpl$5 = /* @__PURE__ */ template(`<source type=image/webp>`);
|
|
2059
2093
|
var _tmpl$23 = /* @__PURE__ */ template(`<picture><img>`);
|
|
2060
|
-
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-
|
|
2061
|
-
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-
|
|
2062
|
-
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-
|
|
2094
|
+
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-7e6ffddc">`);
|
|
2095
|
+
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-7e6ffddc-2>`);
|
|
2096
|
+
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-7e6ffddc {
|
|
2063
2097
|
opacity: 1;
|
|
2064
2098
|
transition: opacity 0.2s ease-in-out;
|
|
2065
|
-
}.div-
|
|
2099
|
+
}.div-7e6ffddc {
|
|
2066
2100
|
width: 100%;
|
|
2067
2101
|
pointer-events: none;
|
|
2068
2102
|
font-size: 0;
|
|
2069
|
-
}.div-
|
|
2103
|
+
}.div-7e6ffddc-2 {
|
|
2070
2104
|
display: flex;
|
|
2071
2105
|
flex-direction: column;
|
|
2072
2106
|
align-items: stretch;
|
|
@@ -2131,7 +2165,7 @@ function Image(props) {
|
|
|
2131
2165
|
}
|
|
2132
2166
|
}), _el$3);
|
|
2133
2167
|
effect((_p$) => {
|
|
2134
|
-
const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
2168
|
+
const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-7e6ffddc", _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 = {
|
|
2135
2169
|
"object-position": props.backgroundPosition || "center",
|
|
2136
2170
|
"object-fit": props.backgroundSize || "cover",
|
|
2137
2171
|
...aspectRatioCss()
|
|
@@ -5421,7 +5455,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
5421
5455
|
}
|
|
5422
5456
|
|
|
5423
5457
|
// src/constants/sdk-version.ts
|
|
5424
|
-
var SDK_VERSION = "2.0.
|
|
5458
|
+
var SDK_VERSION = "2.0.21";
|
|
5425
5459
|
|
|
5426
5460
|
// src/functions/register.ts
|
|
5427
5461
|
var registry = {};
|
|
@@ -5775,22 +5809,6 @@ function EnableEditor(props) {
|
|
|
5775
5809
|
}
|
|
5776
5810
|
})(event);
|
|
5777
5811
|
}
|
|
5778
|
-
function evaluateJsCode() {
|
|
5779
|
-
const jsCode = props.builderContextSignal.content?.data?.jsCode;
|
|
5780
|
-
if (jsCode) {
|
|
5781
|
-
evaluate({
|
|
5782
|
-
code: jsCode,
|
|
5783
|
-
context: props.context || {},
|
|
5784
|
-
localState: void 0,
|
|
5785
|
-
rootState: props.builderContextSignal.rootState,
|
|
5786
|
-
rootSetState: props.builderContextSignal.rootSetState,
|
|
5787
|
-
/**
|
|
5788
|
-
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
5789
|
-
*/
|
|
5790
|
-
enableCache: false
|
|
5791
|
-
});
|
|
5792
|
-
}
|
|
5793
|
-
}
|
|
5794
5812
|
function onClick(event) {
|
|
5795
5813
|
if (props.builderContextSignal.content) {
|
|
5796
5814
|
const variationId = props.builderContextSignal.content?.testVariationId;
|
|
@@ -5827,7 +5845,7 @@ function EnableEditor(props) {
|
|
|
5827
5845
|
rootSetState: props.builderContextSignal.rootSetState,
|
|
5828
5846
|
enableCache: true
|
|
5829
5847
|
})));
|
|
5830
|
-
|
|
5848
|
+
fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
|
|
5831
5849
|
mergeNewRootState({
|
|
5832
5850
|
[key]: json
|
|
5833
5851
|
});
|
|
@@ -5852,6 +5870,8 @@ function EnableEditor(props) {
|
|
|
5852
5870
|
}
|
|
5853
5871
|
}
|
|
5854
5872
|
let elementRef;
|
|
5873
|
+
runHttpRequests();
|
|
5874
|
+
emitStateUpdate();
|
|
5855
5875
|
onMount(() => {
|
|
5856
5876
|
if (isBrowser()) {
|
|
5857
5877
|
if (isEditing()) {
|
|
@@ -5906,14 +5926,6 @@ function EnableEditor(props) {
|
|
|
5906
5926
|
}
|
|
5907
5927
|
}
|
|
5908
5928
|
});
|
|
5909
|
-
onMount(() => {
|
|
5910
|
-
if (!props.apiKey) {
|
|
5911
|
-
logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
|
|
5912
|
-
}
|
|
5913
|
-
evaluateJsCode();
|
|
5914
|
-
runHttpRequests();
|
|
5915
|
-
emitStateUpdate();
|
|
5916
|
-
});
|
|
5917
5929
|
const onUpdateFn_0_props_content = createMemo(() => props.content);
|
|
5918
5930
|
function onUpdateFn_0() {
|
|
5919
5931
|
if (props.content) {
|
|
@@ -5921,37 +5933,27 @@ function EnableEditor(props) {
|
|
|
5921
5933
|
}
|
|
5922
5934
|
}
|
|
5923
5935
|
createEffect(on(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
5924
|
-
const
|
|
5936
|
+
const onUpdateFn_1_props_builderContextSignal_rootState = createMemo(() => props.builderContextSignal.rootState);
|
|
5925
5937
|
function onUpdateFn_1() {
|
|
5926
|
-
evaluateJsCode();
|
|
5927
|
-
}
|
|
5928
|
-
createEffect(on(() => [onUpdateFn_1_props_builderContextSignal_content__data__jsCode()], onUpdateFn_1));
|
|
5929
|
-
const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests = createMemo(() => props.builderContextSignal.content?.data?.httpRequests);
|
|
5930
|
-
function onUpdateFn_2() {
|
|
5931
|
-
runHttpRequests();
|
|
5932
|
-
}
|
|
5933
|
-
createEffect(on(() => [onUpdateFn_2_props_builderContextSignal_content__data__httpRequests()], onUpdateFn_2));
|
|
5934
|
-
const onUpdateFn_3_props_builderContextSignal_rootState = createMemo(() => props.builderContextSignal.rootState);
|
|
5935
|
-
function onUpdateFn_3() {
|
|
5936
5938
|
emitStateUpdate();
|
|
5937
5939
|
}
|
|
5938
|
-
createEffect(on(() => [
|
|
5939
|
-
const
|
|
5940
|
-
function
|
|
5940
|
+
createEffect(on(() => [onUpdateFn_1_props_builderContextSignal_rootState()], onUpdateFn_1));
|
|
5941
|
+
const onUpdateFn_2_props_data = createMemo(() => props.data);
|
|
5942
|
+
function onUpdateFn_2() {
|
|
5941
5943
|
if (props.data) {
|
|
5942
5944
|
mergeNewRootState(props.data);
|
|
5943
5945
|
}
|
|
5944
5946
|
}
|
|
5945
|
-
createEffect(on(() => [
|
|
5946
|
-
const
|
|
5947
|
-
function
|
|
5947
|
+
createEffect(on(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
|
|
5948
|
+
const onUpdateFn_3_props_locale = createMemo(() => props.locale);
|
|
5949
|
+
function onUpdateFn_3() {
|
|
5948
5950
|
if (props.locale) {
|
|
5949
5951
|
mergeNewRootState({
|
|
5950
5952
|
locale: props.locale
|
|
5951
5953
|
});
|
|
5952
5954
|
}
|
|
5953
5955
|
}
|
|
5954
|
-
createEffect(on(() => [
|
|
5956
|
+
createEffect(on(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
|
|
5955
5957
|
return createComponent(builder_context_default.Provider, {
|
|
5956
5958
|
get value() {
|
|
5957
5959
|
return props.builderContextSignal;
|
|
@@ -6119,6 +6121,29 @@ function ContentComponent(props) {
|
|
|
6119
6121
|
rootState: newRootState
|
|
6120
6122
|
}));
|
|
6121
6123
|
}
|
|
6124
|
+
if (!props.apiKey) {
|
|
6125
|
+
logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
|
|
6126
|
+
}
|
|
6127
|
+
const jsCode = builderContextSignal().content?.data?.jsCode;
|
|
6128
|
+
if (jsCode) {
|
|
6129
|
+
evaluate({
|
|
6130
|
+
code: jsCode,
|
|
6131
|
+
context: props.context || {},
|
|
6132
|
+
localState: void 0,
|
|
6133
|
+
rootState: builderContextSignal().rootState,
|
|
6134
|
+
rootSetState: (newState) => {
|
|
6135
|
+
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
6136
|
+
...PREVIOUS_VALUE,
|
|
6137
|
+
rootState: newState
|
|
6138
|
+
}));
|
|
6139
|
+
},
|
|
6140
|
+
isExpression: false,
|
|
6141
|
+
/**
|
|
6142
|
+
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
6143
|
+
*/
|
|
6144
|
+
enableCache: false
|
|
6145
|
+
});
|
|
6146
|
+
}
|
|
6122
6147
|
return createComponent(components_context_default.Provider, {
|
|
6123
6148
|
get value() {
|
|
6124
6149
|
return {
|