@builder.io/sdk-solid 2.0.15 → 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 +118 -87
- package/lib/browser/dev.jsx +176 -172
- package/lib/browser/index.js +118 -87
- package/lib/browser/index.jsx +176 -172
- package/lib/edge/dev.js +189 -121
- package/lib/edge/dev.jsx +247 -206
- package/lib/edge/index.js +189 -121
- package/lib/edge/index.jsx +247 -206
- package/lib/node/dev.js +119 -88
- package/lib/node/dev.jsx +177 -173
- package/lib/node/index.js +119 -88
- package/lib/node/index.jsx +177 -173
- package/package.json +1 -1
package/lib/edge/dev.js
CHANGED
|
@@ -263,29 +263,6 @@ var parseCode = (code, {
|
|
|
263
263
|
const useCode = useReturn ? `return (${code});` : code;
|
|
264
264
|
return useCode;
|
|
265
265
|
};
|
|
266
|
-
|
|
267
|
-
// src/functions/evaluate/browser-runtime/browser.ts
|
|
268
|
-
var runInBrowser = ({
|
|
269
|
-
code,
|
|
270
|
-
builder,
|
|
271
|
-
context,
|
|
272
|
-
event,
|
|
273
|
-
localState,
|
|
274
|
-
rootSetState,
|
|
275
|
-
rootState
|
|
276
|
-
}) => {
|
|
277
|
-
const functionArgs = getFunctionArguments({
|
|
278
|
-
builder,
|
|
279
|
-
context,
|
|
280
|
-
event,
|
|
281
|
-
state: flattenState({
|
|
282
|
-
rootState,
|
|
283
|
-
localState,
|
|
284
|
-
rootSetState
|
|
285
|
-
})
|
|
286
|
-
});
|
|
287
|
-
return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
|
|
288
|
-
};
|
|
289
266
|
function flattenState({
|
|
290
267
|
rootState,
|
|
291
268
|
localState,
|
|
@@ -320,14 +297,27 @@ function flattenState({
|
|
|
320
297
|
});
|
|
321
298
|
}
|
|
322
299
|
|
|
323
|
-
// src/functions/
|
|
324
|
-
var
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
300
|
+
// src/functions/evaluate/browser-runtime/browser.ts
|
|
301
|
+
var runInBrowser = ({
|
|
302
|
+
code,
|
|
303
|
+
builder,
|
|
304
|
+
context,
|
|
305
|
+
event,
|
|
306
|
+
localState,
|
|
307
|
+
rootSetState,
|
|
308
|
+
rootState
|
|
309
|
+
}) => {
|
|
310
|
+
const functionArgs = getFunctionArguments({
|
|
311
|
+
builder,
|
|
312
|
+
context,
|
|
313
|
+
event,
|
|
314
|
+
state: flattenState({
|
|
315
|
+
rootState,
|
|
316
|
+
localState,
|
|
317
|
+
rootSetState
|
|
318
|
+
})
|
|
319
|
+
});
|
|
320
|
+
return new Function(...functionArgs.map(([name]) => name), code)(...functionArgs.map(([, value]) => value));
|
|
331
321
|
};
|
|
332
322
|
|
|
333
323
|
// src/functions/evaluate/edge-runtime/acorn-interpreter.ts
|
|
@@ -3399,22 +3389,56 @@ t.VALUE_IN_DESCRIPTOR = Ia;
|
|
|
3399
3389
|
var acorn_interpreter_default = t;
|
|
3400
3390
|
|
|
3401
3391
|
// src/functions/evaluate/edge-runtime/edge-runtime.ts
|
|
3392
|
+
function patchInterpreter() {
|
|
3393
|
+
const originalGetProperty = acorn_interpreter_default.prototype.getProperty;
|
|
3394
|
+
const originalSetProperty = acorn_interpreter_default.prototype.setProperty;
|
|
3395
|
+
function newGetProperty(obj, name) {
|
|
3396
|
+
if (obj == null || !obj._connected) {
|
|
3397
|
+
return originalGetProperty.call(this, obj, name);
|
|
3398
|
+
}
|
|
3399
|
+
const value = obj._connected[name];
|
|
3400
|
+
if (Array.isArray(value)) {
|
|
3401
|
+
return this.nativeToPseudo(value);
|
|
3402
|
+
}
|
|
3403
|
+
if (typeof value === "object") {
|
|
3404
|
+
return this.createConnectedObject(value);
|
|
3405
|
+
}
|
|
3406
|
+
return value;
|
|
3407
|
+
}
|
|
3408
|
+
function newSetProperty(obj, name, value, opt_descriptor) {
|
|
3409
|
+
if (obj == null || !obj._connected) {
|
|
3410
|
+
return originalSetProperty.call(this, obj, name, value, opt_descriptor);
|
|
3411
|
+
}
|
|
3412
|
+
obj._connected[name] = this.pseudoToNative(value);
|
|
3413
|
+
}
|
|
3414
|
+
const getKeys = [];
|
|
3415
|
+
const setKeys = [];
|
|
3416
|
+
for (const key of Object.keys(acorn_interpreter_default.prototype)) {
|
|
3417
|
+
if (acorn_interpreter_default.prototype[key] === originalGetProperty) {
|
|
3418
|
+
getKeys.push(key);
|
|
3419
|
+
}
|
|
3420
|
+
if (acorn_interpreter_default.prototype[key] === originalSetProperty) {
|
|
3421
|
+
setKeys.push(key);
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
for (const key of getKeys) {
|
|
3425
|
+
acorn_interpreter_default.prototype[key] = newGetProperty;
|
|
3426
|
+
}
|
|
3427
|
+
for (const key of setKeys) {
|
|
3428
|
+
acorn_interpreter_default.prototype[key] = newSetProperty;
|
|
3429
|
+
}
|
|
3430
|
+
acorn_interpreter_default.prototype.createConnectedObject = function(obj) {
|
|
3431
|
+
const connectedObject = this.createObject(this.OBJECT);
|
|
3432
|
+
connectedObject._connected = obj;
|
|
3433
|
+
return connectedObject;
|
|
3434
|
+
};
|
|
3435
|
+
}
|
|
3436
|
+
patchInterpreter();
|
|
3402
3437
|
var processCode = (code) => {
|
|
3403
|
-
return code.
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
const isStateSetter = trimmed.startsWith("state.");
|
|
3408
|
-
if (!isStateSetter)
|
|
3409
|
-
return line;
|
|
3410
|
-
const [lhs, rhs] = trimmed.split("=");
|
|
3411
|
-
const setStr = lhs.replace("state.", "").trim();
|
|
3412
|
-
const setExpr = `setRootState('${setStr}', ${rhs.trim()})`;
|
|
3413
|
-
return `
|
|
3414
|
-
${line}
|
|
3415
|
-
${setExpr}
|
|
3416
|
-
`;
|
|
3417
|
-
}).filter(Boolean).join("\n");
|
|
3438
|
+
return code.replace(/^.*?function main\(\)/, `
|
|
3439
|
+
var __awaiter = function (e, t, n, r) {return r()},
|
|
3440
|
+
__generator = function (e, t) { return t() };
|
|
3441
|
+
function main()`).replace(/\?\./g, ".");
|
|
3418
3442
|
};
|
|
3419
3443
|
var getJSONValName = (val) => val + "JSON";
|
|
3420
3444
|
var runInEdge = ({
|
|
@@ -3426,10 +3450,11 @@ var runInEdge = ({
|
|
|
3426
3450
|
rootSetState,
|
|
3427
3451
|
code
|
|
3428
3452
|
}) => {
|
|
3429
|
-
const state = {
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3453
|
+
const state = flattenState({
|
|
3454
|
+
rootState,
|
|
3455
|
+
localState,
|
|
3456
|
+
rootSetState
|
|
3457
|
+
});
|
|
3433
3458
|
const properties = getFunctionArguments({
|
|
3434
3459
|
builder,
|
|
3435
3460
|
context,
|
|
@@ -3438,6 +3463,9 @@ var runInEdge = ({
|
|
|
3438
3463
|
});
|
|
3439
3464
|
const prependedCode = properties.map(([key]) => {
|
|
3440
3465
|
const jsonValName = getJSONValName(key);
|
|
3466
|
+
if (key === "state") {
|
|
3467
|
+
return ``;
|
|
3468
|
+
}
|
|
3441
3469
|
return `var ${key} = ${jsonValName} === undefined ? undefined : JSON.parse(${jsonValName});`;
|
|
3442
3470
|
}).join("\n");
|
|
3443
3471
|
const cleanedCode = processCode(code);
|
|
@@ -3453,16 +3481,15 @@ function theFunction() {
|
|
|
3453
3481
|
}
|
|
3454
3482
|
theFunction();
|
|
3455
3483
|
`;
|
|
3456
|
-
const setRootState = (prop, value) => {
|
|
3457
|
-
const newState = set(state, prop, value);
|
|
3458
|
-
rootSetState?.(newState);
|
|
3459
|
-
};
|
|
3460
3484
|
const initFunc = function(interpreter, globalObject) {
|
|
3461
3485
|
properties.forEach(([key, val]) => {
|
|
3462
|
-
|
|
3463
|
-
|
|
3486
|
+
if (key === "state") {
|
|
3487
|
+
interpreter.setProperty(globalObject, key, interpreter.createConnectedObject(val), interpreter.READONLY_DESCRIPTOR);
|
|
3488
|
+
} else {
|
|
3489
|
+
const jsonVal = JSON.stringify(val);
|
|
3490
|
+
interpreter.setProperty(globalObject, getJSONValName(key), jsonVal);
|
|
3491
|
+
}
|
|
3464
3492
|
});
|
|
3465
|
-
interpreter.setProperty(globalObject, "setRootState", interpreter.createNativeFunction(setRootState));
|
|
3466
3493
|
};
|
|
3467
3494
|
const myInterpreter = new acorn_interpreter_default(transformed, initFunc);
|
|
3468
3495
|
myInterpreter.run();
|
|
@@ -3479,24 +3506,30 @@ function isNodeRuntime() {
|
|
|
3479
3506
|
}
|
|
3480
3507
|
|
|
3481
3508
|
// src/functions/evaluate/should-force-browser-runtime-in-node.ts
|
|
3482
|
-
var shouldForceBrowserRuntimeInNode = (
|
|
3509
|
+
var shouldForceBrowserRuntimeInNode = ({
|
|
3510
|
+
shouldLogWarning
|
|
3511
|
+
}) => {
|
|
3483
3512
|
if (!isNodeRuntime())
|
|
3484
3513
|
return false;
|
|
3485
3514
|
const isArm64 = process.arch === "arm64";
|
|
3486
3515
|
const isNode20 = process.version.startsWith("v20");
|
|
3487
3516
|
const hasNoNodeSnapshotNodeOption = process.env.NODE_OPTIONS?.includes("--no-node-snapshot");
|
|
3488
3517
|
if (isArm64 && isNode20 && !hasNoNodeSnapshotNodeOption) {
|
|
3489
|
-
|
|
3518
|
+
if (shouldLogWarning) {
|
|
3519
|
+
logger.log(`Skipping usage of \`isolated-vm\` to avoid crashes in Node v20 on an arm64 machine.
|
|
3490
3520
|
If you would like to use the \`isolated-vm\` package on this machine, please provide the \`NODE_OPTIONS=--no-node-snapshot\` config to your Node process.
|
|
3491
3521
|
See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.
|
|
3492
3522
|
`);
|
|
3523
|
+
}
|
|
3493
3524
|
return true;
|
|
3494
3525
|
}
|
|
3495
3526
|
return false;
|
|
3496
3527
|
};
|
|
3497
3528
|
|
|
3498
3529
|
// src/functions/evaluate/choose-eval.ts
|
|
3499
|
-
var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode(
|
|
3530
|
+
var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode({
|
|
3531
|
+
shouldLogWarning: true
|
|
3532
|
+
}) ? runInBrowser(args) : runInEdge(args);
|
|
3500
3533
|
|
|
3501
3534
|
// src/functions/evaluate/evaluate.ts
|
|
3502
3535
|
var DISABLE_CACHE = true;
|
|
@@ -3573,6 +3606,16 @@ function evaluate({
|
|
|
3573
3606
|
// src/functions/fast-clone.ts
|
|
3574
3607
|
var fastClone = (obj) => JSON.parse(JSON.stringify(obj));
|
|
3575
3608
|
|
|
3609
|
+
// src/functions/set.ts
|
|
3610
|
+
var set = (obj, _path, value) => {
|
|
3611
|
+
if (Object(obj) !== obj) {
|
|
3612
|
+
return obj;
|
|
3613
|
+
}
|
|
3614
|
+
const path = Array.isArray(_path) ? _path : _path.toString().match(/[^.[\]]+/g);
|
|
3615
|
+
path.slice(0, -1).reduce((a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(Number(path[i + 1])) >> 0 === +path[i + 1] ? [] : {}, obj)[path[path.length - 1]] = value;
|
|
3616
|
+
return obj;
|
|
3617
|
+
};
|
|
3618
|
+
|
|
3576
3619
|
// src/functions/transform-block.ts
|
|
3577
3620
|
function transformBlock(block) {
|
|
3578
3621
|
return block;
|
|
@@ -4248,6 +4291,14 @@ function BlockWrapper(props) {
|
|
|
4248
4291
|
});
|
|
4249
4292
|
}
|
|
4250
4293
|
var block_wrapper_default = BlockWrapper;
|
|
4294
|
+
function Awaiter(props) {
|
|
4295
|
+
onMount(() => {
|
|
4296
|
+
});
|
|
4297
|
+
return memo(() => props.children);
|
|
4298
|
+
}
|
|
4299
|
+
var awaiter_default = Awaiter;
|
|
4300
|
+
|
|
4301
|
+
// src/components/block/components/interactive-element.tsx
|
|
4251
4302
|
function InteractiveElement(props) {
|
|
4252
4303
|
const attributes = createMemo(() => {
|
|
4253
4304
|
return props.includeBlockProps ? {
|
|
@@ -4264,17 +4315,43 @@ function InteractiveElement(props) {
|
|
|
4264
4315
|
})
|
|
4265
4316
|
} : {};
|
|
4266
4317
|
});
|
|
4267
|
-
return createComponent(
|
|
4268
|
-
get
|
|
4269
|
-
return
|
|
4318
|
+
return createComponent(Show, {
|
|
4319
|
+
get fallback() {
|
|
4320
|
+
return createComponent(Dynamic, mergeProps(() => props.wrapperProps, {
|
|
4321
|
+
get attributes() {
|
|
4322
|
+
return attributes();
|
|
4323
|
+
},
|
|
4324
|
+
get component() {
|
|
4325
|
+
return props.Wrapper;
|
|
4326
|
+
},
|
|
4327
|
+
get children() {
|
|
4328
|
+
return props.children;
|
|
4329
|
+
}
|
|
4330
|
+
}));
|
|
4270
4331
|
},
|
|
4271
|
-
get
|
|
4272
|
-
return props.Wrapper;
|
|
4332
|
+
get when() {
|
|
4333
|
+
return props.Wrapper.load;
|
|
4273
4334
|
},
|
|
4274
4335
|
get children() {
|
|
4275
|
-
return
|
|
4336
|
+
return createComponent(awaiter_default, {
|
|
4337
|
+
get load() {
|
|
4338
|
+
return props.Wrapper.load;
|
|
4339
|
+
},
|
|
4340
|
+
get fallback() {
|
|
4341
|
+
return props.Wrapper.fallback;
|
|
4342
|
+
},
|
|
4343
|
+
get props() {
|
|
4344
|
+
return props.wrapperProps;
|
|
4345
|
+
},
|
|
4346
|
+
get attributes() {
|
|
4347
|
+
return attributes();
|
|
4348
|
+
},
|
|
4349
|
+
get children() {
|
|
4350
|
+
return props.children;
|
|
4351
|
+
}
|
|
4352
|
+
});
|
|
4276
4353
|
}
|
|
4277
|
-
})
|
|
4354
|
+
});
|
|
4278
4355
|
}
|
|
4279
4356
|
var interactive_element_default = InteractiveElement;
|
|
4280
4357
|
|
|
@@ -4649,7 +4726,7 @@ function Block(props) {
|
|
|
4649
4726
|
});
|
|
4650
4727
|
}
|
|
4651
4728
|
var block_default = Block;
|
|
4652
|
-
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-
|
|
4729
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-68b2d7fe {
|
|
4653
4730
|
display: flex;
|
|
4654
4731
|
flex-direction: column;
|
|
4655
4732
|
align-items: stretch;
|
|
@@ -4685,7 +4762,7 @@ function BlocksWrapper(props) {
|
|
|
4685
4762
|
});
|
|
4686
4763
|
return [createComponent(Dynamic, mergeProps({
|
|
4687
4764
|
get ["class"]() {
|
|
4688
|
-
return className() + " dynamic-
|
|
4765
|
+
return className() + " dynamic-68b2d7fe";
|
|
4689
4766
|
},
|
|
4690
4767
|
ref(r$) {
|
|
4691
4768
|
const _ref$ = blocksWrapperRef;
|
|
@@ -4781,7 +4858,7 @@ var getColumnsClass = (id2) => {
|
|
|
4781
4858
|
|
|
4782
4859
|
// src/blocks/columns/columns.tsx
|
|
4783
4860
|
var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
|
|
4784
|
-
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-
|
|
4861
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<style>.div-46766f1c {
|
|
4785
4862
|
display: flex;
|
|
4786
4863
|
line-height: normal;
|
|
4787
4864
|
}`);
|
|
@@ -4902,7 +4979,7 @@ function Columns(props) {
|
|
|
4902
4979
|
const _el$ = _tmpl$3();
|
|
4903
4980
|
spread(_el$, mergeProps({
|
|
4904
4981
|
get ["class"]() {
|
|
4905
|
-
return getColumnsClass(props.builderBlock?.id) + " div-
|
|
4982
|
+
return getColumnsClass(props.builderBlock?.id) + " div-46766f1c";
|
|
4906
4983
|
},
|
|
4907
4984
|
get style() {
|
|
4908
4985
|
return columnsCssVars();
|
|
@@ -5027,16 +5104,16 @@ function getSrcSet(url) {
|
|
|
5027
5104
|
// src/blocks/image/image.tsx
|
|
5028
5105
|
var _tmpl$5 = /* @__PURE__ */ template(`<source type=image/webp>`);
|
|
5029
5106
|
var _tmpl$23 = /* @__PURE__ */ template(`<picture><img>`);
|
|
5030
|
-
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-
|
|
5031
|
-
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-
|
|
5032
|
-
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-
|
|
5107
|
+
var _tmpl$32 = /* @__PURE__ */ template(`<div class="builder-image-sizer div-7e6ffddc">`);
|
|
5108
|
+
var _tmpl$42 = /* @__PURE__ */ template(`<div class=div-7e6ffddc-2>`);
|
|
5109
|
+
var _tmpl$52 = /* @__PURE__ */ template(`<style>.img-7e6ffddc {
|
|
5033
5110
|
opacity: 1;
|
|
5034
5111
|
transition: opacity 0.2s ease-in-out;
|
|
5035
|
-
}.div-
|
|
5112
|
+
}.div-7e6ffddc {
|
|
5036
5113
|
width: 100%;
|
|
5037
5114
|
pointer-events: none;
|
|
5038
5115
|
font-size: 0;
|
|
5039
|
-
}.div-
|
|
5116
|
+
}.div-7e6ffddc-2 {
|
|
5040
5117
|
display: flex;
|
|
5041
5118
|
flex-direction: column;
|
|
5042
5119
|
align-items: stretch;
|
|
@@ -5101,7 +5178,7 @@ function Image(props) {
|
|
|
5101
5178
|
}
|
|
5102
5179
|
}), _el$3);
|
|
5103
5180
|
effect((_p$) => {
|
|
5104
|
-
const _v$ = "builder-image" + (props.className ? " " + props.className : "") + " img-
|
|
5181
|
+
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 = {
|
|
5105
5182
|
"object-position": props.backgroundPosition || "center",
|
|
5106
5183
|
"object-fit": props.backgroundSize || "cover",
|
|
5107
5184
|
...aspectRatioCss()
|
|
@@ -8391,7 +8468,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
8391
8468
|
}
|
|
8392
8469
|
|
|
8393
8470
|
// src/constants/sdk-version.ts
|
|
8394
|
-
var SDK_VERSION = "2.0.
|
|
8471
|
+
var SDK_VERSION = "2.0.21";
|
|
8395
8472
|
|
|
8396
8473
|
// src/functions/register.ts
|
|
8397
8474
|
var registry = {};
|
|
@@ -8745,22 +8822,6 @@ function EnableEditor(props) {
|
|
|
8745
8822
|
}
|
|
8746
8823
|
})(event);
|
|
8747
8824
|
}
|
|
8748
|
-
function evaluateJsCode() {
|
|
8749
|
-
const jsCode = props.builderContextSignal.content?.data?.jsCode;
|
|
8750
|
-
if (jsCode) {
|
|
8751
|
-
evaluate({
|
|
8752
|
-
code: jsCode,
|
|
8753
|
-
context: props.context || {},
|
|
8754
|
-
localState: void 0,
|
|
8755
|
-
rootState: props.builderContextSignal.rootState,
|
|
8756
|
-
rootSetState: props.builderContextSignal.rootSetState,
|
|
8757
|
-
/**
|
|
8758
|
-
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
8759
|
-
*/
|
|
8760
|
-
enableCache: false
|
|
8761
|
-
});
|
|
8762
|
-
}
|
|
8763
|
-
}
|
|
8764
8825
|
function onClick(event) {
|
|
8765
8826
|
if (props.builderContextSignal.content) {
|
|
8766
8827
|
const variationId = props.builderContextSignal.content?.testVariationId;
|
|
@@ -8797,7 +8858,7 @@ function EnableEditor(props) {
|
|
|
8797
8858
|
rootSetState: props.builderContextSignal.rootSetState,
|
|
8798
8859
|
enableCache: true
|
|
8799
8860
|
})));
|
|
8800
|
-
|
|
8861
|
+
fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
|
|
8801
8862
|
mergeNewRootState({
|
|
8802
8863
|
[key]: json
|
|
8803
8864
|
});
|
|
@@ -8822,6 +8883,8 @@ function EnableEditor(props) {
|
|
|
8822
8883
|
}
|
|
8823
8884
|
}
|
|
8824
8885
|
let elementRef;
|
|
8886
|
+
runHttpRequests();
|
|
8887
|
+
emitStateUpdate();
|
|
8825
8888
|
onMount(() => {
|
|
8826
8889
|
if (isBrowser()) {
|
|
8827
8890
|
if (isEditing()) {
|
|
@@ -8876,14 +8939,6 @@ function EnableEditor(props) {
|
|
|
8876
8939
|
}
|
|
8877
8940
|
}
|
|
8878
8941
|
});
|
|
8879
|
-
onMount(() => {
|
|
8880
|
-
if (!props.apiKey) {
|
|
8881
|
-
logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
|
|
8882
|
-
}
|
|
8883
|
-
evaluateJsCode();
|
|
8884
|
-
runHttpRequests();
|
|
8885
|
-
emitStateUpdate();
|
|
8886
|
-
});
|
|
8887
8942
|
const onUpdateFn_0_props_content = createMemo(() => props.content);
|
|
8888
8943
|
function onUpdateFn_0() {
|
|
8889
8944
|
if (props.content) {
|
|
@@ -8891,37 +8946,27 @@ function EnableEditor(props) {
|
|
|
8891
8946
|
}
|
|
8892
8947
|
}
|
|
8893
8948
|
createEffect(on(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
8894
|
-
const
|
|
8949
|
+
const onUpdateFn_1_props_builderContextSignal_rootState = createMemo(() => props.builderContextSignal.rootState);
|
|
8895
8950
|
function onUpdateFn_1() {
|
|
8896
|
-
evaluateJsCode();
|
|
8897
|
-
}
|
|
8898
|
-
createEffect(on(() => [onUpdateFn_1_props_builderContextSignal_content__data__jsCode()], onUpdateFn_1));
|
|
8899
|
-
const onUpdateFn_2_props_builderContextSignal_content__data__httpRequests = createMemo(() => props.builderContextSignal.content?.data?.httpRequests);
|
|
8900
|
-
function onUpdateFn_2() {
|
|
8901
|
-
runHttpRequests();
|
|
8902
|
-
}
|
|
8903
|
-
createEffect(on(() => [onUpdateFn_2_props_builderContextSignal_content__data__httpRequests()], onUpdateFn_2));
|
|
8904
|
-
const onUpdateFn_3_props_builderContextSignal_rootState = createMemo(() => props.builderContextSignal.rootState);
|
|
8905
|
-
function onUpdateFn_3() {
|
|
8906
8951
|
emitStateUpdate();
|
|
8907
8952
|
}
|
|
8908
|
-
createEffect(on(() => [
|
|
8909
|
-
const
|
|
8910
|
-
function
|
|
8953
|
+
createEffect(on(() => [onUpdateFn_1_props_builderContextSignal_rootState()], onUpdateFn_1));
|
|
8954
|
+
const onUpdateFn_2_props_data = createMemo(() => props.data);
|
|
8955
|
+
function onUpdateFn_2() {
|
|
8911
8956
|
if (props.data) {
|
|
8912
8957
|
mergeNewRootState(props.data);
|
|
8913
8958
|
}
|
|
8914
8959
|
}
|
|
8915
|
-
createEffect(on(() => [
|
|
8916
|
-
const
|
|
8917
|
-
function
|
|
8960
|
+
createEffect(on(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
|
|
8961
|
+
const onUpdateFn_3_props_locale = createMemo(() => props.locale);
|
|
8962
|
+
function onUpdateFn_3() {
|
|
8918
8963
|
if (props.locale) {
|
|
8919
8964
|
mergeNewRootState({
|
|
8920
8965
|
locale: props.locale
|
|
8921
8966
|
});
|
|
8922
8967
|
}
|
|
8923
8968
|
}
|
|
8924
|
-
createEffect(on(() => [
|
|
8969
|
+
createEffect(on(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
|
|
8925
8970
|
return createComponent(builder_context_default.Provider, {
|
|
8926
8971
|
get value() {
|
|
8927
8972
|
return props.builderContextSignal;
|
|
@@ -9089,6 +9134,29 @@ function ContentComponent(props) {
|
|
|
9089
9134
|
rootState: newRootState
|
|
9090
9135
|
}));
|
|
9091
9136
|
}
|
|
9137
|
+
if (!props.apiKey) {
|
|
9138
|
+
logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
|
|
9139
|
+
}
|
|
9140
|
+
const jsCode = builderContextSignal().content?.data?.jsCode;
|
|
9141
|
+
if (jsCode) {
|
|
9142
|
+
evaluate({
|
|
9143
|
+
code: jsCode,
|
|
9144
|
+
context: props.context || {},
|
|
9145
|
+
localState: void 0,
|
|
9146
|
+
rootState: builderContextSignal().rootState,
|
|
9147
|
+
rootSetState: (newState) => {
|
|
9148
|
+
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
9149
|
+
...PREVIOUS_VALUE,
|
|
9150
|
+
rootState: newState
|
|
9151
|
+
}));
|
|
9152
|
+
},
|
|
9153
|
+
isExpression: false,
|
|
9154
|
+
/**
|
|
9155
|
+
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
9156
|
+
*/
|
|
9157
|
+
enableCache: false
|
|
9158
|
+
});
|
|
9159
|
+
}
|
|
9092
9160
|
return createComponent(components_context_default.Provider, {
|
|
9093
9161
|
get value() {
|
|
9094
9162
|
return {
|