@builder.io/sdk-solid 0.14.6 → 1.0.12
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/browser/dev.js +187 -134
- package/lib/browser/dev.jsx +254 -173
- package/lib/browser/index.js +187 -134
- package/lib/browser/index.jsx +254 -173
- package/lib/edge/dev.js +187 -134
- package/lib/edge/dev.jsx +254 -173
- package/lib/edge/index.js +187 -134
- package/lib/edge/index.jsx +254 -173
- package/lib/node/dev.js +187 -134
- package/lib/node/dev.jsx +254 -173
- package/lib/node/index.js +187 -134
- package/lib/node/index.jsx +254 -173
- package/package.json +1 -1
package/lib/edge/dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createComponent, spread, mergeProps, insert, effect, setAttribute, className, style, template, Dynamic, memo, use } from 'solid-js/web';
|
|
2
|
-
import { createContext, useContext, Show, For, createSignal, onMount, createEffect, on } from 'solid-js';
|
|
2
|
+
import { createContext, useContext, Show, For, createSignal, createMemo, onMount, createEffect, on } from 'solid-js';
|
|
3
3
|
import { css } from 'solid-styled-components';
|
|
4
4
|
|
|
5
5
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
@@ -287,7 +287,7 @@ function flattenState({
|
|
|
287
287
|
return localState[prop];
|
|
288
288
|
}
|
|
289
289
|
const val = target[prop];
|
|
290
|
-
if (typeof val === "object") {
|
|
290
|
+
if (typeof val === "object" && val !== null) {
|
|
291
291
|
return flattenState({
|
|
292
292
|
rootState: val,
|
|
293
293
|
localState: void 0,
|
|
@@ -3496,6 +3496,30 @@ var shouldForceBrowserRuntimeInNode = () => {
|
|
|
3496
3496
|
var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode() ? runInBrowser(args) : runInEdge(args);
|
|
3497
3497
|
|
|
3498
3498
|
// src/functions/evaluate/evaluate.ts
|
|
3499
|
+
var EvalCache = class _EvalCache {
|
|
3500
|
+
static cacheLimit = 20;
|
|
3501
|
+
static cache = /* @__PURE__ */ new Map();
|
|
3502
|
+
static getCacheKey(args) {
|
|
3503
|
+
return JSON.stringify({
|
|
3504
|
+
...args,
|
|
3505
|
+
// replace the event with a random number to break cache
|
|
3506
|
+
// thats because we can't serialize the event object due to circular refs in DOM node refs.
|
|
3507
|
+
event: args.event ? Math.random() : void 0
|
|
3508
|
+
});
|
|
3509
|
+
}
|
|
3510
|
+
static getCachedValue(key) {
|
|
3511
|
+
const cachedVal = _EvalCache.cache.get(key);
|
|
3512
|
+
return cachedVal;
|
|
3513
|
+
}
|
|
3514
|
+
static setCachedValue(key, value) {
|
|
3515
|
+
if (_EvalCache.cache.size > 20) {
|
|
3516
|
+
_EvalCache.cache.delete(_EvalCache.cache.keys().next().value);
|
|
3517
|
+
}
|
|
3518
|
+
_EvalCache.cache.set(key, {
|
|
3519
|
+
value
|
|
3520
|
+
});
|
|
3521
|
+
}
|
|
3522
|
+
};
|
|
3499
3523
|
function evaluate({
|
|
3500
3524
|
code,
|
|
3501
3525
|
context,
|
|
@@ -3503,11 +3527,12 @@ function evaluate({
|
|
|
3503
3527
|
rootState,
|
|
3504
3528
|
rootSetState,
|
|
3505
3529
|
event,
|
|
3506
|
-
isExpression = true
|
|
3530
|
+
isExpression = true,
|
|
3531
|
+
enableCache
|
|
3507
3532
|
}) {
|
|
3508
3533
|
if (code === "") {
|
|
3509
3534
|
logger.warn("Skipping evaluation of empty code block.");
|
|
3510
|
-
return;
|
|
3535
|
+
return void 0;
|
|
3511
3536
|
}
|
|
3512
3537
|
const args = {
|
|
3513
3538
|
code: parseCode(code, {
|
|
@@ -3520,8 +3545,20 @@ function evaluate({
|
|
|
3520
3545
|
rootState,
|
|
3521
3546
|
localState
|
|
3522
3547
|
};
|
|
3548
|
+
if (enableCache) {
|
|
3549
|
+
const cacheKey = EvalCache.getCacheKey(args);
|
|
3550
|
+
const cachedValue = EvalCache.getCachedValue(cacheKey);
|
|
3551
|
+
if (cachedValue) {
|
|
3552
|
+
return cachedValue.value;
|
|
3553
|
+
}
|
|
3554
|
+
}
|
|
3523
3555
|
try {
|
|
3524
|
-
|
|
3556
|
+
const newEval = chooseBrowserOrServerEval(args);
|
|
3557
|
+
if (enableCache) {
|
|
3558
|
+
const cacheKey = EvalCache.getCacheKey(args);
|
|
3559
|
+
EvalCache.setCachedValue(cacheKey, newEval);
|
|
3560
|
+
}
|
|
3561
|
+
return newEval;
|
|
3525
3562
|
} catch (e) {
|
|
3526
3563
|
logger.error("Failed code evaluation: " + e.message, {
|
|
3527
3564
|
code
|
|
@@ -3566,7 +3603,8 @@ var evaluateBindings = ({
|
|
|
3566
3603
|
localState,
|
|
3567
3604
|
rootState,
|
|
3568
3605
|
rootSetState,
|
|
3569
|
-
context
|
|
3606
|
+
context,
|
|
3607
|
+
enableCache: true
|
|
3570
3608
|
});
|
|
3571
3609
|
set(copied, binding, value);
|
|
3572
3610
|
}
|
|
@@ -3800,6 +3838,70 @@ function bindScrollInViewAnimation(animation) {
|
|
|
3800
3838
|
});
|
|
3801
3839
|
}
|
|
3802
3840
|
|
|
3841
|
+
// src/functions/camel-to-kebab-case.ts
|
|
3842
|
+
var camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
3843
|
+
|
|
3844
|
+
// src/helpers/css.ts
|
|
3845
|
+
var convertStyleMapToCSSArray = (style) => {
|
|
3846
|
+
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
3847
|
+
if (typeof value === "string") {
|
|
3848
|
+
return `${camelToKebabCase(key)}: ${value};`;
|
|
3849
|
+
} else {
|
|
3850
|
+
return void 0;
|
|
3851
|
+
}
|
|
3852
|
+
});
|
|
3853
|
+
return cssProps.filter(checkIsDefined);
|
|
3854
|
+
};
|
|
3855
|
+
var convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
3856
|
+
var createCssClass = ({
|
|
3857
|
+
mediaQuery,
|
|
3858
|
+
className,
|
|
3859
|
+
styles
|
|
3860
|
+
}) => {
|
|
3861
|
+
const cssClass = `.${className} {
|
|
3862
|
+
${convertStyleMapToCSS(styles)}
|
|
3863
|
+
}`;
|
|
3864
|
+
if (mediaQuery) {
|
|
3865
|
+
return `${mediaQuery} {
|
|
3866
|
+
${cssClass}
|
|
3867
|
+
}`;
|
|
3868
|
+
} else {
|
|
3869
|
+
return cssClass;
|
|
3870
|
+
}
|
|
3871
|
+
};
|
|
3872
|
+
|
|
3873
|
+
// src/functions/transform-style-property.ts
|
|
3874
|
+
function transformStyleProperty({
|
|
3875
|
+
style
|
|
3876
|
+
}) {
|
|
3877
|
+
return style;
|
|
3878
|
+
}
|
|
3879
|
+
|
|
3880
|
+
// src/functions/get-style.ts
|
|
3881
|
+
var getStyle = ({
|
|
3882
|
+
block,
|
|
3883
|
+
context
|
|
3884
|
+
}) => {
|
|
3885
|
+
return mapStyleObjToStrIfNeeded(transformStyleProperty({
|
|
3886
|
+
style: block.style || {},
|
|
3887
|
+
context,
|
|
3888
|
+
block
|
|
3889
|
+
}));
|
|
3890
|
+
};
|
|
3891
|
+
function mapStyleObjToStrIfNeeded(style) {
|
|
3892
|
+
switch (TARGET) {
|
|
3893
|
+
case "svelte":
|
|
3894
|
+
case "vue":
|
|
3895
|
+
case "solid":
|
|
3896
|
+
return convertStyleMapToCSSArray(style).join(" ");
|
|
3897
|
+
case "qwik":
|
|
3898
|
+
case "reactNative":
|
|
3899
|
+
case "react":
|
|
3900
|
+
case "rsc":
|
|
3901
|
+
return style;
|
|
3902
|
+
}
|
|
3903
|
+
}
|
|
3904
|
+
|
|
3803
3905
|
// src/components/block/block.helpers.ts
|
|
3804
3906
|
var getComponent = ({
|
|
3805
3907
|
block,
|
|
@@ -3843,7 +3945,8 @@ var getRepeatItemData = ({
|
|
|
3843
3945
|
localState: context.localState,
|
|
3844
3946
|
rootState: context.rootState,
|
|
3845
3947
|
rootSetState: context.rootSetState,
|
|
3846
|
-
context: context.context
|
|
3948
|
+
context: context.context,
|
|
3949
|
+
enableCache: true
|
|
3847
3950
|
});
|
|
3848
3951
|
if (!Array.isArray(itemsArray)) {
|
|
3849
3952
|
return void 0;
|
|
@@ -3914,38 +4017,6 @@ var getSizesForBreakpoints = ({
|
|
|
3914
4017
|
};
|
|
3915
4018
|
return newSizes;
|
|
3916
4019
|
};
|
|
3917
|
-
|
|
3918
|
-
// src/functions/camel-to-kebab-case.ts
|
|
3919
|
-
var camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
3920
|
-
|
|
3921
|
-
// src/helpers/css.ts
|
|
3922
|
-
var convertStyleMapToCSSArray = (style) => {
|
|
3923
|
-
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
3924
|
-
if (typeof value === "string") {
|
|
3925
|
-
return `${camelToKebabCase(key)}: ${value};`;
|
|
3926
|
-
} else {
|
|
3927
|
-
return void 0;
|
|
3928
|
-
}
|
|
3929
|
-
});
|
|
3930
|
-
return cssProps.filter(checkIsDefined);
|
|
3931
|
-
};
|
|
3932
|
-
var convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
3933
|
-
var createCssClass = ({
|
|
3934
|
-
mediaQuery,
|
|
3935
|
-
className,
|
|
3936
|
-
styles
|
|
3937
|
-
}) => {
|
|
3938
|
-
const cssClass = `.${className} {
|
|
3939
|
-
${convertStyleMapToCSS(styles)}
|
|
3940
|
-
}`;
|
|
3941
|
-
if (mediaQuery) {
|
|
3942
|
-
return `${mediaQuery} {
|
|
3943
|
-
${cssClass}
|
|
3944
|
-
}`;
|
|
3945
|
-
} else {
|
|
3946
|
-
return cssClass;
|
|
3947
|
-
}
|
|
3948
|
-
};
|
|
3949
4020
|
var _tmpl$ = /* @__PURE__ */ template(`<style>`);
|
|
3950
4021
|
function InlinedStyles(props) {
|
|
3951
4022
|
return (() => {
|
|
@@ -3966,7 +4037,7 @@ var inlined_styles_default = InlinedStyles;
|
|
|
3966
4037
|
|
|
3967
4038
|
// src/components/block/components/block-styles.tsx
|
|
3968
4039
|
function BlockStyles(props) {
|
|
3969
|
-
|
|
4040
|
+
const canShowBlock = createMemo(() => {
|
|
3970
4041
|
const processedBlock = getProcessedBlock({
|
|
3971
4042
|
block: props.block,
|
|
3972
4043
|
localState: props.context.localState,
|
|
@@ -3982,8 +4053,8 @@ function BlockStyles(props) {
|
|
|
3982
4053
|
return processedBlock.show;
|
|
3983
4054
|
}
|
|
3984
4055
|
return true;
|
|
3985
|
-
}
|
|
3986
|
-
|
|
4056
|
+
});
|
|
4057
|
+
const css5 = createMemo(() => {
|
|
3987
4058
|
const processedBlock = getProcessedBlock({
|
|
3988
4059
|
block: props.block,
|
|
3989
4060
|
localState: props.context.localState,
|
|
@@ -4017,7 +4088,7 @@ function BlockStyles(props) {
|
|
|
4017
4088
|
mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
|
|
4018
4089
|
}) : "";
|
|
4019
4090
|
return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
|
|
4020
|
-
}
|
|
4091
|
+
});
|
|
4021
4092
|
return createComponent(Show, {
|
|
4022
4093
|
get when() {
|
|
4023
4094
|
return memo(() => !!(TARGET !== "reactNative" && css5()))() && canShowBlock();
|
|
@@ -4047,7 +4118,8 @@ var createEventHandler = (value, options) => (event) => evaluate({
|
|
|
4047
4118
|
rootState: options.rootState,
|
|
4048
4119
|
rootSetState: options.rootSetState,
|
|
4049
4120
|
event,
|
|
4050
|
-
isExpression: false
|
|
4121
|
+
isExpression: false,
|
|
4122
|
+
enableCache: true
|
|
4051
4123
|
});
|
|
4052
4124
|
|
|
4053
4125
|
// src/functions/get-block-actions.ts
|
|
@@ -4075,38 +4147,6 @@ function getBlockActions(options) {
|
|
|
4075
4147
|
return obj;
|
|
4076
4148
|
}
|
|
4077
4149
|
|
|
4078
|
-
// src/functions/transform-style-property.ts
|
|
4079
|
-
function transformStyleProperty({
|
|
4080
|
-
style
|
|
4081
|
-
}) {
|
|
4082
|
-
return style;
|
|
4083
|
-
}
|
|
4084
|
-
|
|
4085
|
-
// src/functions/get-style.ts
|
|
4086
|
-
var getStyle = ({
|
|
4087
|
-
block,
|
|
4088
|
-
context
|
|
4089
|
-
}) => {
|
|
4090
|
-
return mapStyleObjToStrIfNeeded(transformStyleProperty({
|
|
4091
|
-
style: block.style || {},
|
|
4092
|
-
context,
|
|
4093
|
-
block
|
|
4094
|
-
}));
|
|
4095
|
-
};
|
|
4096
|
-
function mapStyleObjToStrIfNeeded(style) {
|
|
4097
|
-
switch (TARGET) {
|
|
4098
|
-
case "svelte":
|
|
4099
|
-
case "vue":
|
|
4100
|
-
case "solid":
|
|
4101
|
-
return convertStyleMapToCSSArray(style).join(" ");
|
|
4102
|
-
case "qwik":
|
|
4103
|
-
case "reactNative":
|
|
4104
|
-
case "react":
|
|
4105
|
-
case "rsc":
|
|
4106
|
-
return style;
|
|
4107
|
-
}
|
|
4108
|
-
}
|
|
4109
|
-
|
|
4110
4150
|
// src/functions/transform-block-properties.ts
|
|
4111
4151
|
function transformBlockProperties({
|
|
4112
4152
|
properties
|
|
@@ -4308,21 +4348,20 @@ var repeated_block_default = RepeatedBlock;
|
|
|
4308
4348
|
|
|
4309
4349
|
// src/components/block/block.tsx
|
|
4310
4350
|
function Block(props) {
|
|
4311
|
-
const
|
|
4312
|
-
function blockComponent() {
|
|
4351
|
+
const blockComponent = createMemo(() => {
|
|
4313
4352
|
return getComponent({
|
|
4314
4353
|
block: props.block,
|
|
4315
4354
|
context: props.context,
|
|
4316
4355
|
registeredComponents: props.registeredComponents
|
|
4317
4356
|
});
|
|
4318
|
-
}
|
|
4319
|
-
|
|
4357
|
+
});
|
|
4358
|
+
const repeatItem = createMemo(() => {
|
|
4320
4359
|
return getRepeatItemData({
|
|
4321
4360
|
block: props.block,
|
|
4322
4361
|
context: props.context
|
|
4323
4362
|
});
|
|
4324
|
-
}
|
|
4325
|
-
|
|
4363
|
+
});
|
|
4364
|
+
const processedBlock = createMemo(() => {
|
|
4326
4365
|
return props.block.repeat?.collection ? props.block : getProcessedBlock({
|
|
4327
4366
|
block: props.block,
|
|
4328
4367
|
localState: props.context.localState,
|
|
@@ -4331,15 +4370,15 @@ function Block(props) {
|
|
|
4331
4370
|
context: props.context.context,
|
|
4332
4371
|
shouldEvaluateBindings: true
|
|
4333
4372
|
});
|
|
4334
|
-
}
|
|
4335
|
-
|
|
4373
|
+
});
|
|
4374
|
+
const Tag = createMemo(() => {
|
|
4336
4375
|
const shouldUseLink = props.block.tagName === "a" || processedBlock().properties?.href || processedBlock().href;
|
|
4337
4376
|
if (shouldUseLink) {
|
|
4338
4377
|
return props.linkComponent || "a";
|
|
4339
4378
|
}
|
|
4340
4379
|
return props.block.tagName || "div";
|
|
4341
|
-
}
|
|
4342
|
-
|
|
4380
|
+
});
|
|
4381
|
+
const canShowBlock = createMemo(() => {
|
|
4343
4382
|
if (props.block.repeat?.collection) {
|
|
4344
4383
|
if (repeatItem()?.length)
|
|
4345
4384
|
return true;
|
|
@@ -4348,12 +4387,12 @@ function Block(props) {
|
|
|
4348
4387
|
const shouldHide = "hide" in processedBlock() ? processedBlock().hide : false;
|
|
4349
4388
|
const shouldShow = "show" in processedBlock() ? processedBlock().show : true;
|
|
4350
4389
|
return shouldShow && !shouldHide;
|
|
4351
|
-
}
|
|
4352
|
-
|
|
4390
|
+
});
|
|
4391
|
+
const childrenWithoutParentComponent = createMemo(() => {
|
|
4353
4392
|
const shouldRenderChildrenOutsideRef = !blockComponent()?.component && !repeatItem();
|
|
4354
4393
|
return shouldRenderChildrenOutsideRef ? processedBlock().children ?? [] : [];
|
|
4355
|
-
}
|
|
4356
|
-
|
|
4394
|
+
});
|
|
4395
|
+
const componentRefProps = createMemo(() => {
|
|
4357
4396
|
return {
|
|
4358
4397
|
blockChildren: processedBlock().children ?? [],
|
|
4359
4398
|
componentRef: blockComponent()?.component,
|
|
@@ -4367,14 +4406,14 @@ function Block(props) {
|
|
|
4367
4406
|
builderComponents: props.registeredComponents
|
|
4368
4407
|
} : {}
|
|
4369
4408
|
},
|
|
4370
|
-
context:
|
|
4409
|
+
context: props.context,
|
|
4371
4410
|
linkComponent: props.linkComponent,
|
|
4372
4411
|
registeredComponents: props.registeredComponents,
|
|
4373
4412
|
builderBlock: processedBlock(),
|
|
4374
4413
|
includeBlockProps: blockComponent()?.noWrap === true,
|
|
4375
4414
|
isInteractive: !blockComponent()?.isRSC
|
|
4376
4415
|
};
|
|
4377
|
-
}
|
|
4416
|
+
});
|
|
4378
4417
|
onMount(() => {
|
|
4379
4418
|
const blockId = processedBlock().id;
|
|
4380
4419
|
const animations = processedBlock().animations;
|
|
@@ -4516,14 +4555,14 @@ function Block(props) {
|
|
|
4516
4555
|
return child.id;
|
|
4517
4556
|
},
|
|
4518
4557
|
block: child,
|
|
4519
|
-
get context() {
|
|
4520
|
-
return childrenContext();
|
|
4521
|
-
},
|
|
4522
4558
|
get registeredComponents() {
|
|
4523
4559
|
return props.registeredComponents;
|
|
4524
4560
|
},
|
|
4525
4561
|
get linkComponent() {
|
|
4526
4562
|
return props.linkComponent;
|
|
4563
|
+
},
|
|
4564
|
+
get context() {
|
|
4565
|
+
return props.context;
|
|
4527
4566
|
}
|
|
4528
4567
|
});
|
|
4529
4568
|
}
|
|
@@ -4539,9 +4578,9 @@ function Block(props) {
|
|
|
4539
4578
|
}
|
|
4540
4579
|
var block_default = Block;
|
|
4541
4580
|
function BlocksWrapper(props) {
|
|
4542
|
-
|
|
4581
|
+
const className = createMemo(() => {
|
|
4543
4582
|
return "builder-blocks" + (!props.blocks?.length ? " no-blocks" : "");
|
|
4544
|
-
}
|
|
4583
|
+
});
|
|
4545
4584
|
function onClick() {
|
|
4546
4585
|
if (isEditing() && !props.blocks?.length) {
|
|
4547
4586
|
window.parent?.postMessage({
|
|
@@ -4681,7 +4720,7 @@ function Columns(props) {
|
|
|
4681
4720
|
}) {
|
|
4682
4721
|
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
4683
4722
|
}
|
|
4684
|
-
|
|
4723
|
+
const columnsCssVars = createMemo(() => {
|
|
4685
4724
|
return {
|
|
4686
4725
|
"--flex-dir": flexDir(),
|
|
4687
4726
|
"--flex-dir-tablet": getTabletStyle({
|
|
@@ -4689,7 +4728,7 @@ function Columns(props) {
|
|
|
4689
4728
|
desktopStyle: "row"
|
|
4690
4729
|
})
|
|
4691
4730
|
};
|
|
4692
|
-
}
|
|
4731
|
+
});
|
|
4693
4732
|
function columnCssVars(index) {
|
|
4694
4733
|
const gutter = index === 0 ? 0 : gutterSize();
|
|
4695
4734
|
const width = getColumnCssWidth(index);
|
|
@@ -4728,7 +4767,7 @@ function Columns(props) {
|
|
|
4728
4767
|
const breakpointSizes = getSizesForBreakpoints(props.builderContext.content?.meta?.breakpoints || {});
|
|
4729
4768
|
return breakpointSizes[size].max;
|
|
4730
4769
|
}
|
|
4731
|
-
|
|
4770
|
+
const columnsStyles = createMemo(() => {
|
|
4732
4771
|
return `
|
|
4733
4772
|
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
4734
4773
|
.${props.builderBlock.id}-breakpoints {
|
|
@@ -4754,7 +4793,7 @@ function Columns(props) {
|
|
|
4754
4793
|
}
|
|
4755
4794
|
},
|
|
4756
4795
|
`;
|
|
4757
|
-
}
|
|
4796
|
+
});
|
|
4758
4797
|
return (() => {
|
|
4759
4798
|
const _el$ = _tmpl$2();
|
|
4760
4799
|
spread(_el$, mergeProps({
|
|
@@ -4892,7 +4931,7 @@ var _tmpl$4 = /* @__PURE__ */ template(`<source type=image/webp>`);
|
|
|
4892
4931
|
var _tmpl$22 = /* @__PURE__ */ template(`<picture><img loading=lazy>`);
|
|
4893
4932
|
var _tmpl$32 = /* @__PURE__ */ template(`<div>`);
|
|
4894
4933
|
function Image(props) {
|
|
4895
|
-
|
|
4934
|
+
const srcSetToUse = createMemo(() => {
|
|
4896
4935
|
const imageToUse = props.image || props.src;
|
|
4897
4936
|
const url = imageToUse;
|
|
4898
4937
|
if (!url || // We can auto add srcset for cdn.builder.io and shopify
|
|
@@ -4909,15 +4948,15 @@ function Image(props) {
|
|
|
4909
4948
|
return getSrcSet(url);
|
|
4910
4949
|
}
|
|
4911
4950
|
return getSrcSet(url);
|
|
4912
|
-
}
|
|
4913
|
-
|
|
4951
|
+
});
|
|
4952
|
+
const webpSrcSet = createMemo(() => {
|
|
4914
4953
|
if (srcSetToUse()?.match(/builder\.io/) && !props.noWebp) {
|
|
4915
4954
|
return srcSetToUse().replace(/\?/g, "?format=webp&");
|
|
4916
4955
|
} else {
|
|
4917
4956
|
return "";
|
|
4918
4957
|
}
|
|
4919
|
-
}
|
|
4920
|
-
|
|
4958
|
+
});
|
|
4959
|
+
const aspectRatioCss = createMemo(() => {
|
|
4921
4960
|
const aspectRatioStyles = {
|
|
4922
4961
|
position: "absolute",
|
|
4923
4962
|
height: "100%",
|
|
@@ -4927,7 +4966,7 @@ function Image(props) {
|
|
|
4927
4966
|
};
|
|
4928
4967
|
const out = props.aspectRatio ? aspectRatioStyles : void 0;
|
|
4929
4968
|
return out;
|
|
4930
|
-
}
|
|
4969
|
+
});
|
|
4931
4970
|
return [(() => {
|
|
4932
4971
|
const _el$ = _tmpl$22(), _el$3 = _el$.firstChild;
|
|
4933
4972
|
insert(_el$, createComponent(Show, {
|
|
@@ -5920,13 +5959,15 @@ function Embed(props) {
|
|
|
5920
5959
|
}
|
|
5921
5960
|
}
|
|
5922
5961
|
let elem;
|
|
5962
|
+
const onUpdateFn_0_elem = createMemo(() => elem);
|
|
5963
|
+
const onUpdateFn_0_ranInitFn__ = createMemo(() => ranInitFn());
|
|
5923
5964
|
function onUpdateFn_0() {
|
|
5924
5965
|
if (elem && !ranInitFn()) {
|
|
5925
5966
|
setRanInitFn(true);
|
|
5926
5967
|
findAndRunScripts();
|
|
5927
5968
|
}
|
|
5928
5969
|
}
|
|
5929
|
-
createEffect(on(() => [
|
|
5970
|
+
createEffect(on(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0));
|
|
5930
5971
|
return (() => {
|
|
5931
5972
|
const _el$ = _tmpl$9();
|
|
5932
5973
|
const _ref$ = elem;
|
|
@@ -6820,7 +6861,7 @@ var _tmpl$15 = /* @__PURE__ */ template(`<source type=video/mp4>`);
|
|
|
6820
6861
|
var _tmpl$25 = /* @__PURE__ */ template(`<div>`);
|
|
6821
6862
|
var _tmpl$33 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
6822
6863
|
function Video(props) {
|
|
6823
|
-
|
|
6864
|
+
const videoProps = createMemo(() => {
|
|
6824
6865
|
return {
|
|
6825
6866
|
...props.autoPlay === true ? {
|
|
6826
6867
|
autoPlay: true
|
|
@@ -6838,12 +6879,12 @@ function Video(props) {
|
|
|
6838
6879
|
playsInline: true
|
|
6839
6880
|
} : {}
|
|
6840
6881
|
};
|
|
6841
|
-
}
|
|
6842
|
-
|
|
6882
|
+
});
|
|
6883
|
+
const spreadProps = createMemo(() => {
|
|
6843
6884
|
return {
|
|
6844
6885
|
...videoProps()
|
|
6845
6886
|
};
|
|
6846
|
-
}
|
|
6887
|
+
});
|
|
6847
6888
|
return (() => {
|
|
6848
6889
|
const _el$ = _tmpl$33(), _el$2 = _el$.firstChild;
|
|
6849
6890
|
_el$.style.setProperty("position", "relative");
|
|
@@ -7558,7 +7599,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
7558
7599
|
}
|
|
7559
7600
|
|
|
7560
7601
|
// src/constants/sdk-version.ts
|
|
7561
|
-
var SDK_VERSION = "0.
|
|
7602
|
+
var SDK_VERSION = "1.0.12";
|
|
7562
7603
|
|
|
7563
7604
|
// src/functions/register.ts
|
|
7564
7605
|
var registry = {};
|
|
@@ -7837,7 +7878,11 @@ function EnableEditor(props) {
|
|
|
7837
7878
|
context: props.context || {},
|
|
7838
7879
|
localState: void 0,
|
|
7839
7880
|
rootState: props.builderContextSignal.rootState,
|
|
7840
|
-
rootSetState: props.builderContextSignal.rootSetState
|
|
7881
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
7882
|
+
/**
|
|
7883
|
+
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
7884
|
+
*/
|
|
7885
|
+
enableCache: false
|
|
7841
7886
|
});
|
|
7842
7887
|
}
|
|
7843
7888
|
}
|
|
@@ -7860,13 +7905,14 @@ function EnableEditor(props) {
|
|
|
7860
7905
|
}
|
|
7861
7906
|
}
|
|
7862
7907
|
function evalExpression(expression) {
|
|
7863
|
-
return expression.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
|
|
7908
|
+
return expression.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
|
|
7864
7909
|
code: group,
|
|
7865
7910
|
context: props.context || {},
|
|
7866
7911
|
localState: void 0,
|
|
7867
7912
|
rootState: props.builderContextSignal.rootState,
|
|
7868
|
-
rootSetState: props.builderContextSignal.rootSetState
|
|
7869
|
-
|
|
7913
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
7914
|
+
enableCache: true
|
|
7915
|
+
})));
|
|
7870
7916
|
}
|
|
7871
7917
|
function handleRequest({
|
|
7872
7918
|
url,
|
|
@@ -7971,33 +8017,40 @@ function EnableEditor(props) {
|
|
|
7971
8017
|
runHttpRequests();
|
|
7972
8018
|
emitStateUpdate();
|
|
7973
8019
|
});
|
|
8020
|
+
const onUpdateFn_0_props_content = createMemo(() => props.content);
|
|
7974
8021
|
function onUpdateFn_0() {
|
|
7975
8022
|
if (props.content) {
|
|
7976
8023
|
mergeNewContent(props.content);
|
|
7977
8024
|
}
|
|
7978
8025
|
}
|
|
7979
|
-
createEffect(on(() => [
|
|
8026
|
+
createEffect(on(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
8027
|
+
const onUpdateFn_1_shouldSendResetCookie__ = createMemo(() => shouldSendResetCookie());
|
|
7980
8028
|
function onUpdateFn_1() {
|
|
7981
8029
|
}
|
|
7982
|
-
createEffect(on(() => [
|
|
8030
|
+
createEffect(on(() => [onUpdateFn_1_shouldSendResetCookie__()], onUpdateFn_1));
|
|
8031
|
+
const onUpdateFn_2_props_builderContextSignal_content__data__jsCode = createMemo(() => props.builderContextSignal.content?.data?.jsCode);
|
|
7983
8032
|
function onUpdateFn_2() {
|
|
7984
8033
|
evaluateJsCode();
|
|
7985
8034
|
}
|
|
7986
|
-
createEffect(on(() => [
|
|
8035
|
+
createEffect(on(() => [onUpdateFn_2_props_builderContextSignal_content__data__jsCode()], onUpdateFn_2));
|
|
8036
|
+
const onUpdateFn_3_props_builderContextSignal_content__data__httpRequests = createMemo(() => props.builderContextSignal.content?.data?.httpRequests);
|
|
7987
8037
|
function onUpdateFn_3() {
|
|
7988
8038
|
runHttpRequests();
|
|
7989
8039
|
}
|
|
7990
|
-
createEffect(on(() => [
|
|
8040
|
+
createEffect(on(() => [onUpdateFn_3_props_builderContextSignal_content__data__httpRequests()], onUpdateFn_3));
|
|
8041
|
+
const onUpdateFn_4_props_builderContextSignal_rootState = createMemo(() => props.builderContextSignal.rootState);
|
|
7991
8042
|
function onUpdateFn_4() {
|
|
7992
8043
|
emitStateUpdate();
|
|
7993
8044
|
}
|
|
7994
|
-
createEffect(on(() => [
|
|
8045
|
+
createEffect(on(() => [onUpdateFn_4_props_builderContextSignal_rootState()], onUpdateFn_4));
|
|
8046
|
+
const onUpdateFn_5_props_data = createMemo(() => props.data);
|
|
7995
8047
|
function onUpdateFn_5() {
|
|
7996
8048
|
if (props.data) {
|
|
7997
8049
|
mergeNewRootState(props.data);
|
|
7998
8050
|
}
|
|
7999
8051
|
}
|
|
8000
|
-
createEffect(on(() => [
|
|
8052
|
+
createEffect(on(() => [onUpdateFn_5_props_data()], onUpdateFn_5));
|
|
8053
|
+
const onUpdateFn_6_props_locale = createMemo(() => props.locale);
|
|
8001
8054
|
function onUpdateFn_6() {
|
|
8002
8055
|
if (props.locale) {
|
|
8003
8056
|
mergeNewRootState({
|
|
@@ -8005,7 +8058,7 @@ function EnableEditor(props) {
|
|
|
8005
8058
|
});
|
|
8006
8059
|
}
|
|
8007
8060
|
}
|
|
8008
|
-
createEffect(on(() => [
|
|
8061
|
+
createEffect(on(() => [onUpdateFn_6_props_locale()], onUpdateFn_6));
|
|
8009
8062
|
return createComponent(builder_context_default.Provider, {
|
|
8010
8063
|
get value() {
|
|
8011
8064
|
return props.builderContextSignal;
|
|
@@ -8337,16 +8390,16 @@ function ContentVariants(props) {
|
|
|
8337
8390
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
8338
8391
|
content: props.content
|
|
8339
8392
|
}));
|
|
8340
|
-
|
|
8393
|
+
const updateCookieAndStylesScriptStr = createMemo(() => {
|
|
8341
8394
|
return getUpdateCookieAndStylesScript(getVariants(props.content).map((value) => ({
|
|
8342
8395
|
id: value.testVariationId,
|
|
8343
8396
|
testRatio: value.testRatio
|
|
8344
8397
|
})), props.content?.id || "");
|
|
8345
|
-
}
|
|
8346
|
-
|
|
8398
|
+
});
|
|
8399
|
+
const hideVariantsStyleString = createMemo(() => {
|
|
8347
8400
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
8348
|
-
}
|
|
8349
|
-
|
|
8401
|
+
});
|
|
8402
|
+
const defaultContent = createMemo(() => {
|
|
8350
8403
|
return shouldRenderVariants() ? {
|
|
8351
8404
|
...props.content,
|
|
8352
8405
|
testVariationId: props.content?.id
|
|
@@ -8354,7 +8407,7 @@ function ContentVariants(props) {
|
|
|
8354
8407
|
item: props.content,
|
|
8355
8408
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
8356
8409
|
});
|
|
8357
|
-
}
|
|
8410
|
+
});
|
|
8358
8411
|
onMount(() => {
|
|
8359
8412
|
setShouldRenderVariants(false);
|
|
8360
8413
|
});
|
|
@@ -8534,9 +8587,9 @@ var fetchSymbolContent = async ({
|
|
|
8534
8587
|
var _tmpl$17 = /* @__PURE__ */ template(`<div>`);
|
|
8535
8588
|
function Symbol2(props) {
|
|
8536
8589
|
const [contentToUse, setContentToUse] = createSignal(props.symbol?.content);
|
|
8537
|
-
|
|
8590
|
+
const className = createMemo(() => {
|
|
8538
8591
|
return [...[props.attributes[getClassPropName()]], "builder-symbol", props.symbol?.inline ? "builder-inline-symbol" : void 0, props.symbol?.dynamic || props.dynamic ? "builder-dynamic-symbol" : void 0].filter(Boolean).join(" ");
|
|
8539
|
-
}
|
|
8592
|
+
});
|
|
8540
8593
|
function setContent() {
|
|
8541
8594
|
if (contentToUse())
|
|
8542
8595
|
return;
|
|
@@ -8550,12 +8603,12 @@ function Symbol2(props) {
|
|
|
8550
8603
|
});
|
|
8551
8604
|
}
|
|
8552
8605
|
onMount(() => {
|
|
8553
|
-
setContent();
|
|
8554
8606
|
});
|
|
8607
|
+
const onUpdateFn_0_props_symbol = createMemo(() => props.symbol);
|
|
8555
8608
|
function onUpdateFn_0() {
|
|
8556
8609
|
setContent();
|
|
8557
8610
|
}
|
|
8558
|
-
createEffect(on(() => [
|
|
8611
|
+
createEffect(on(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
|
|
8559
8612
|
return (() => {
|
|
8560
8613
|
const _el$ = _tmpl$17();
|
|
8561
8614
|
spread(_el$, mergeProps({
|