@builder.io/sdk-qwik 0.14.5 → 0.14.7
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/index.qwik.cjs +111 -72
- package/lib/browser/index.qwik.mjs +111 -72
- package/lib/edge/index.qwik.cjs +111 -72
- package/lib/edge/index.qwik.mjs +111 -72
- package/lib/node/index.qwik.cjs +111 -72
- package/lib/node/index.qwik.mjs +111 -72
- package/package.json +1 -1
- package/types/src/components/block/block.helpers.d.ts +4 -0
- package/types/src/constants/sdk-version.d.ts +1 -1
- package/types/src/functions/evaluate/evaluate.d.ts +3 -1
- package/types/src/functions/evaluate/helpers.d.ts +1 -0
|
@@ -211,7 +211,7 @@ function flattenState({ rootState, localState, rootSetState }) {
|
|
|
211
211
|
if (localState && prop in localState)
|
|
212
212
|
return localState[prop];
|
|
213
213
|
const val = target[prop];
|
|
214
|
-
if (typeof val === "object")
|
|
214
|
+
if (typeof val === "object" && val !== null)
|
|
215
215
|
return flattenState({
|
|
216
216
|
rootState: val,
|
|
217
217
|
localState: void 0,
|
|
@@ -253,10 +253,34 @@ const shouldForceBrowserRuntimeInNode = () => {
|
|
|
253
253
|
return false;
|
|
254
254
|
};
|
|
255
255
|
const chooseBrowserOrServerEval = (args) => build.isBrowser || shouldForceBrowserRuntimeInNode() ? runInBrowser(args) : runInBrowser(args);
|
|
256
|
-
|
|
256
|
+
const _EvalCache = class _EvalCache2 {
|
|
257
|
+
static getCacheKey(args) {
|
|
258
|
+
return JSON.stringify({
|
|
259
|
+
...args,
|
|
260
|
+
// replace the event with a random number to break cache
|
|
261
|
+
// thats because we can't serialize the event object due to circular refs in DOM node refs.
|
|
262
|
+
event: args.event ? Math.random() : void 0
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
static getCachedValue(key) {
|
|
266
|
+
const cachedVal = _EvalCache2.cache.get(key);
|
|
267
|
+
return cachedVal;
|
|
268
|
+
}
|
|
269
|
+
static setCachedValue(key, value) {
|
|
270
|
+
if (_EvalCache2.cache.size > 20)
|
|
271
|
+
_EvalCache2.cache.delete(_EvalCache2.cache.keys().next().value);
|
|
272
|
+
_EvalCache2.cache.set(key, {
|
|
273
|
+
value
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
_EvalCache.cacheLimit = 20;
|
|
278
|
+
_EvalCache.cache = /* @__PURE__ */ new Map();
|
|
279
|
+
let EvalCache = _EvalCache;
|
|
280
|
+
function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true, enableCache }) {
|
|
257
281
|
if (code === "") {
|
|
258
282
|
logger.warn("Skipping evaluation of empty code block.");
|
|
259
|
-
return;
|
|
283
|
+
return void 0;
|
|
260
284
|
}
|
|
261
285
|
const args = {
|
|
262
286
|
code: parseCode(code, {
|
|
@@ -269,8 +293,19 @@ function evaluate({ code, context, localState, rootState, rootSetState, event, i
|
|
|
269
293
|
rootState,
|
|
270
294
|
localState
|
|
271
295
|
};
|
|
296
|
+
if (enableCache) {
|
|
297
|
+
const cacheKey = EvalCache.getCacheKey(args);
|
|
298
|
+
const cachedValue = EvalCache.getCachedValue(cacheKey);
|
|
299
|
+
if (cachedValue)
|
|
300
|
+
return cachedValue.value;
|
|
301
|
+
}
|
|
272
302
|
try {
|
|
273
|
-
|
|
303
|
+
const newEval = chooseBrowserOrServerEval(args);
|
|
304
|
+
if (enableCache) {
|
|
305
|
+
const cacheKey = EvalCache.getCacheKey(args);
|
|
306
|
+
EvalCache.setCachedValue(cacheKey, newEval);
|
|
307
|
+
}
|
|
308
|
+
return newEval;
|
|
274
309
|
} catch (e) {
|
|
275
310
|
logger.error("Failed code evaluation: " + e.message, {
|
|
276
311
|
code
|
|
@@ -309,7 +344,8 @@ const evaluateBindings = ({ block, context, localState, rootState, rootSetState
|
|
|
309
344
|
localState,
|
|
310
345
|
rootState,
|
|
311
346
|
rootSetState,
|
|
312
|
-
context
|
|
347
|
+
context,
|
|
348
|
+
enableCache: true
|
|
313
349
|
});
|
|
314
350
|
set(copied, binding, value);
|
|
315
351
|
}
|
|
@@ -523,6 +559,51 @@ function bindScrollInViewAnimation(animation) {
|
|
|
523
559
|
immediateOnScroll();
|
|
524
560
|
});
|
|
525
561
|
}
|
|
562
|
+
const camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
563
|
+
const convertStyleMapToCSSArray = (style) => {
|
|
564
|
+
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
565
|
+
if (typeof value === "string")
|
|
566
|
+
return `${camelToKebabCase(key)}: ${value};`;
|
|
567
|
+
else
|
|
568
|
+
return void 0;
|
|
569
|
+
});
|
|
570
|
+
return cssProps.filter(checkIsDefined);
|
|
571
|
+
};
|
|
572
|
+
const convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
573
|
+
const createCssClass = ({ mediaQuery, className, styles }) => {
|
|
574
|
+
const cssClass = `.${className} {
|
|
575
|
+
${convertStyleMapToCSS(styles)}
|
|
576
|
+
}`;
|
|
577
|
+
if (mediaQuery)
|
|
578
|
+
return `${mediaQuery} {
|
|
579
|
+
${cssClass}
|
|
580
|
+
}`;
|
|
581
|
+
else
|
|
582
|
+
return cssClass;
|
|
583
|
+
};
|
|
584
|
+
function transformStyleProperty({ style }) {
|
|
585
|
+
return style;
|
|
586
|
+
}
|
|
587
|
+
const getStyle = ({ block, context }) => {
|
|
588
|
+
return mapStyleObjToStrIfNeeded(transformStyleProperty({
|
|
589
|
+
style: block.style || {},
|
|
590
|
+
context,
|
|
591
|
+
block
|
|
592
|
+
}));
|
|
593
|
+
};
|
|
594
|
+
function mapStyleObjToStrIfNeeded(style) {
|
|
595
|
+
switch (TARGET) {
|
|
596
|
+
case "svelte":
|
|
597
|
+
case "vue":
|
|
598
|
+
case "solid":
|
|
599
|
+
return convertStyleMapToCSSArray(style).join(" ");
|
|
600
|
+
case "qwik":
|
|
601
|
+
case "reactNative":
|
|
602
|
+
case "react":
|
|
603
|
+
case "rsc":
|
|
604
|
+
return style;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
526
607
|
const getComponent = ({ block, context, registeredComponents }) => {
|
|
527
608
|
var _a;
|
|
528
609
|
const componentName = (_a = getProcessedBlock({
|
|
@@ -553,7 +634,8 @@ const getRepeatItemData = ({ block, context }) => {
|
|
|
553
634
|
localState: context.localState,
|
|
554
635
|
rootState: context.rootState,
|
|
555
636
|
rootSetState: context.rootSetState,
|
|
556
|
-
context: context.context
|
|
637
|
+
context: context.context,
|
|
638
|
+
enableCache: true
|
|
557
639
|
});
|
|
558
640
|
if (!Array.isArray(itemsArray))
|
|
559
641
|
return void 0;
|
|
@@ -617,28 +699,6 @@ const getSizesForBreakpoints = ({ small, medium }) => {
|
|
|
617
699
|
};
|
|
618
700
|
return newSizes;
|
|
619
701
|
};
|
|
620
|
-
const camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
621
|
-
const convertStyleMapToCSSArray = (style) => {
|
|
622
|
-
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
623
|
-
if (typeof value === "string")
|
|
624
|
-
return `${camelToKebabCase(key)}: ${value};`;
|
|
625
|
-
else
|
|
626
|
-
return void 0;
|
|
627
|
-
});
|
|
628
|
-
return cssProps.filter(checkIsDefined);
|
|
629
|
-
};
|
|
630
|
-
const convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
631
|
-
const createCssClass = ({ mediaQuery, className, styles }) => {
|
|
632
|
-
const cssClass = `.${className} {
|
|
633
|
-
${convertStyleMapToCSS(styles)}
|
|
634
|
-
}`;
|
|
635
|
-
if (mediaQuery)
|
|
636
|
-
return `${mediaQuery} {
|
|
637
|
-
${cssClass}
|
|
638
|
-
}`;
|
|
639
|
-
else
|
|
640
|
-
return cssClass;
|
|
641
|
-
};
|
|
642
702
|
const InlinedStyles = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
|
|
643
703
|
return /* @__PURE__ */ qwik._jsxQ("style", null, {
|
|
644
704
|
dangerouslySetInnerHTML: qwik._fnSignal((p0) => p0.styles, [
|
|
@@ -737,7 +797,8 @@ function createEventHandler(value, options) {
|
|
|
737
797
|
localState: options2.localState,
|
|
738
798
|
rootState: options2.rootState,
|
|
739
799
|
rootSetState: options2.rootSetState,
|
|
740
|
-
event
|
|
800
|
+
event,
|
|
801
|
+
enableCache: true
|
|
741
802
|
});
|
|
742
803
|
}, "createEventHandler_7wCAiJVliNE", [
|
|
743
804
|
options,
|
|
@@ -765,29 +826,6 @@ function getBlockActions(options) {
|
|
|
765
826
|
}
|
|
766
827
|
return obj;
|
|
767
828
|
}
|
|
768
|
-
function transformStyleProperty({ style }) {
|
|
769
|
-
return style;
|
|
770
|
-
}
|
|
771
|
-
const getStyle = ({ block, context }) => {
|
|
772
|
-
return mapStyleObjToStrIfNeeded(transformStyleProperty({
|
|
773
|
-
style: block.style || {},
|
|
774
|
-
context,
|
|
775
|
-
block
|
|
776
|
-
}));
|
|
777
|
-
};
|
|
778
|
-
function mapStyleObjToStrIfNeeded(style) {
|
|
779
|
-
switch (TARGET) {
|
|
780
|
-
case "svelte":
|
|
781
|
-
case "vue":
|
|
782
|
-
case "solid":
|
|
783
|
-
return convertStyleMapToCSSArray(style).join(" ");
|
|
784
|
-
case "qwik":
|
|
785
|
-
case "reactNative":
|
|
786
|
-
case "react":
|
|
787
|
-
case "rsc":
|
|
788
|
-
return style;
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
829
|
function transformBlockProperties({ properties }) {
|
|
792
830
|
return properties;
|
|
793
831
|
}
|
|
@@ -967,9 +1005,6 @@ const RepeatedBlock = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inl
|
|
|
967
1005
|
const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
|
|
968
1006
|
var _a;
|
|
969
1007
|
qwik._jsxBranch();
|
|
970
|
-
const state = qwik.useStore({
|
|
971
|
-
childrenContext: props.context
|
|
972
|
-
});
|
|
973
1008
|
const blockComponent = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
974
1009
|
const [props2] = qwik.useLexicalScope();
|
|
975
1010
|
return getComponent({
|
|
@@ -1042,7 +1077,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
1042
1077
|
]));
|
|
1043
1078
|
const componentRefProps = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
1044
1079
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1045
|
-
const [blockComponent2, processedBlock2, props2
|
|
1080
|
+
const [blockComponent2, processedBlock2, props2] = qwik.useLexicalScope();
|
|
1046
1081
|
return {
|
|
1047
1082
|
blockChildren: processedBlock2.value.children ?? [],
|
|
1048
1083
|
componentRef: (_a2 = blockComponent2.value) == null ? void 0 : _a2.component,
|
|
@@ -1056,7 +1091,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
1056
1091
|
builderComponents: props2.registeredComponents
|
|
1057
1092
|
} : {}
|
|
1058
1093
|
},
|
|
1059
|
-
context:
|
|
1094
|
+
context: props2.context,
|
|
1060
1095
|
linkComponent: props2.linkComponent,
|
|
1061
1096
|
registeredComponents: props2.registeredComponents,
|
|
1062
1097
|
builderBlock: processedBlock2.value,
|
|
@@ -1066,8 +1101,7 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
1066
1101
|
}, "Block_component_componentRefProps_useComputed_Ikbl8VO04ho", [
|
|
1067
1102
|
blockComponent,
|
|
1068
1103
|
processedBlock,
|
|
1069
|
-
props
|
|
1070
|
-
state
|
|
1104
|
+
props
|
|
1071
1105
|
]));
|
|
1072
1106
|
qwik.useVisibleTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
1073
1107
|
const [processedBlock2] = qwik.useLexicalScope();
|
|
@@ -1175,19 +1209,19 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
1175
1209
|
(childrenWithoutParentComponent.value || []).map((child) => {
|
|
1176
1210
|
return /* @__PURE__ */ qwik._jsxC(Block, {
|
|
1177
1211
|
block: child,
|
|
1178
|
-
get context() {
|
|
1179
|
-
return state.childrenContext;
|
|
1180
|
-
},
|
|
1181
1212
|
get registeredComponents() {
|
|
1182
1213
|
return props.registeredComponents;
|
|
1183
1214
|
},
|
|
1184
1215
|
get linkComponent() {
|
|
1185
1216
|
return props.linkComponent;
|
|
1186
1217
|
},
|
|
1218
|
+
get context() {
|
|
1219
|
+
return props.context;
|
|
1220
|
+
},
|
|
1187
1221
|
[qwik._IMMUTABLE]: {
|
|
1188
|
-
context: qwik._fnSignal((p0) => p0.
|
|
1189
|
-
|
|
1190
|
-
], "p0.
|
|
1222
|
+
context: qwik._fnSignal((p0) => p0.context, [
|
|
1223
|
+
props
|
|
1224
|
+
], "p0.context"),
|
|
1191
1225
|
linkComponent: qwik._fnSignal((p0) => p0.linkComponent, [
|
|
1192
1226
|
props
|
|
1193
1227
|
], "p0.linkComponent"),
|
|
@@ -1781,9 +1815,9 @@ const Image = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
1781
1815
|
props
|
|
1782
1816
|
], '"builder-image"+(p0.className?" "+p0.className:"")+" img-Image"'),
|
|
1783
1817
|
loading: "lazy",
|
|
1784
|
-
role: qwik._fnSignal((p0) => p0.altText ? "presentation"
|
|
1818
|
+
role: qwik._fnSignal((p0) => p0.altText ? void 0 : "presentation", [
|
|
1785
1819
|
props
|
|
1786
|
-
], 'p0.altText?"presentation"
|
|
1820
|
+
], 'p0.altText?undefined:"presentation"'),
|
|
1787
1821
|
sizes: qwik._fnSignal((p0) => p0.sizes, [
|
|
1788
1822
|
props
|
|
1789
1823
|
], "p0.sizes"),
|
|
@@ -4360,7 +4394,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4360
4394
|
const url = new URL(e.origin), hostname = url.hostname;
|
|
4361
4395
|
return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
|
|
4362
4396
|
}
|
|
4363
|
-
const SDK_VERSION = "0.14.
|
|
4397
|
+
const SDK_VERSION = "0.14.7";
|
|
4364
4398
|
const registry = {};
|
|
4365
4399
|
function register(type, info) {
|
|
4366
4400
|
let typeList = registry[type];
|
|
@@ -4609,7 +4643,11 @@ const evaluateJsCode = function evaluateJsCode2(props, state, elementRef) {
|
|
|
4609
4643
|
context: props.context || {},
|
|
4610
4644
|
localState: void 0,
|
|
4611
4645
|
rootState: props.builderContextSignal.rootState,
|
|
4612
|
-
rootSetState: props.builderContextSignal.rootSetState
|
|
4646
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
4647
|
+
/**
|
|
4648
|
+
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
4649
|
+
*/
|
|
4650
|
+
enableCache: false
|
|
4613
4651
|
});
|
|
4614
4652
|
};
|
|
4615
4653
|
const onClick = function onClick22(props, state, elementRef, event) {
|
|
@@ -4631,13 +4669,14 @@ const onClick = function onClick22(props, state, elementRef, event) {
|
|
|
4631
4669
|
state.clicked = true;
|
|
4632
4670
|
};
|
|
4633
4671
|
const evalExpression = function evalExpression2(props, state, elementRef, expression) {
|
|
4634
|
-
return expression.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
|
|
4672
|
+
return expression.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
|
|
4635
4673
|
code: group,
|
|
4636
4674
|
context: props.context || {},
|
|
4637
4675
|
localState: void 0,
|
|
4638
4676
|
rootState: props.builderContextSignal.rootState,
|
|
4639
|
-
rootSetState: props.builderContextSignal.rootSetState
|
|
4640
|
-
|
|
4677
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
4678
|
+
enableCache: true
|
|
4679
|
+
})));
|
|
4641
4680
|
};
|
|
4642
4681
|
const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
|
|
4643
4682
|
fetch$1(url).then((response) => response.json()).then((json) => {
|
|
@@ -209,7 +209,7 @@ function flattenState({ rootState, localState, rootSetState }) {
|
|
|
209
209
|
if (localState && prop in localState)
|
|
210
210
|
return localState[prop];
|
|
211
211
|
const val = target[prop];
|
|
212
|
-
if (typeof val === "object")
|
|
212
|
+
if (typeof val === "object" && val !== null)
|
|
213
213
|
return flattenState({
|
|
214
214
|
rootState: val,
|
|
215
215
|
localState: void 0,
|
|
@@ -251,10 +251,34 @@ const shouldForceBrowserRuntimeInNode = () => {
|
|
|
251
251
|
return false;
|
|
252
252
|
};
|
|
253
253
|
const chooseBrowserOrServerEval = (args) => isBrowser$1 || shouldForceBrowserRuntimeInNode() ? runInBrowser(args) : runInBrowser(args);
|
|
254
|
-
|
|
254
|
+
const _EvalCache = class _EvalCache2 {
|
|
255
|
+
static getCacheKey(args) {
|
|
256
|
+
return JSON.stringify({
|
|
257
|
+
...args,
|
|
258
|
+
// replace the event with a random number to break cache
|
|
259
|
+
// thats because we can't serialize the event object due to circular refs in DOM node refs.
|
|
260
|
+
event: args.event ? Math.random() : void 0
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
static getCachedValue(key) {
|
|
264
|
+
const cachedVal = _EvalCache2.cache.get(key);
|
|
265
|
+
return cachedVal;
|
|
266
|
+
}
|
|
267
|
+
static setCachedValue(key, value) {
|
|
268
|
+
if (_EvalCache2.cache.size > 20)
|
|
269
|
+
_EvalCache2.cache.delete(_EvalCache2.cache.keys().next().value);
|
|
270
|
+
_EvalCache2.cache.set(key, {
|
|
271
|
+
value
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
_EvalCache.cacheLimit = 20;
|
|
276
|
+
_EvalCache.cache = /* @__PURE__ */ new Map();
|
|
277
|
+
let EvalCache = _EvalCache;
|
|
278
|
+
function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true, enableCache }) {
|
|
255
279
|
if (code === "") {
|
|
256
280
|
logger.warn("Skipping evaluation of empty code block.");
|
|
257
|
-
return;
|
|
281
|
+
return void 0;
|
|
258
282
|
}
|
|
259
283
|
const args = {
|
|
260
284
|
code: parseCode(code, {
|
|
@@ -267,8 +291,19 @@ function evaluate({ code, context, localState, rootState, rootSetState, event, i
|
|
|
267
291
|
rootState,
|
|
268
292
|
localState
|
|
269
293
|
};
|
|
294
|
+
if (enableCache) {
|
|
295
|
+
const cacheKey = EvalCache.getCacheKey(args);
|
|
296
|
+
const cachedValue = EvalCache.getCachedValue(cacheKey);
|
|
297
|
+
if (cachedValue)
|
|
298
|
+
return cachedValue.value;
|
|
299
|
+
}
|
|
270
300
|
try {
|
|
271
|
-
|
|
301
|
+
const newEval = chooseBrowserOrServerEval(args);
|
|
302
|
+
if (enableCache) {
|
|
303
|
+
const cacheKey = EvalCache.getCacheKey(args);
|
|
304
|
+
EvalCache.setCachedValue(cacheKey, newEval);
|
|
305
|
+
}
|
|
306
|
+
return newEval;
|
|
272
307
|
} catch (e) {
|
|
273
308
|
logger.error("Failed code evaluation: " + e.message, {
|
|
274
309
|
code
|
|
@@ -307,7 +342,8 @@ const evaluateBindings = ({ block, context, localState, rootState, rootSetState
|
|
|
307
342
|
localState,
|
|
308
343
|
rootState,
|
|
309
344
|
rootSetState,
|
|
310
|
-
context
|
|
345
|
+
context,
|
|
346
|
+
enableCache: true
|
|
311
347
|
});
|
|
312
348
|
set(copied, binding, value);
|
|
313
349
|
}
|
|
@@ -521,6 +557,51 @@ function bindScrollInViewAnimation(animation) {
|
|
|
521
557
|
immediateOnScroll();
|
|
522
558
|
});
|
|
523
559
|
}
|
|
560
|
+
const camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
561
|
+
const convertStyleMapToCSSArray = (style) => {
|
|
562
|
+
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
563
|
+
if (typeof value === "string")
|
|
564
|
+
return `${camelToKebabCase(key)}: ${value};`;
|
|
565
|
+
else
|
|
566
|
+
return void 0;
|
|
567
|
+
});
|
|
568
|
+
return cssProps.filter(checkIsDefined);
|
|
569
|
+
};
|
|
570
|
+
const convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
571
|
+
const createCssClass = ({ mediaQuery, className, styles }) => {
|
|
572
|
+
const cssClass = `.${className} {
|
|
573
|
+
${convertStyleMapToCSS(styles)}
|
|
574
|
+
}`;
|
|
575
|
+
if (mediaQuery)
|
|
576
|
+
return `${mediaQuery} {
|
|
577
|
+
${cssClass}
|
|
578
|
+
}`;
|
|
579
|
+
else
|
|
580
|
+
return cssClass;
|
|
581
|
+
};
|
|
582
|
+
function transformStyleProperty({ style }) {
|
|
583
|
+
return style;
|
|
584
|
+
}
|
|
585
|
+
const getStyle = ({ block, context }) => {
|
|
586
|
+
return mapStyleObjToStrIfNeeded(transformStyleProperty({
|
|
587
|
+
style: block.style || {},
|
|
588
|
+
context,
|
|
589
|
+
block
|
|
590
|
+
}));
|
|
591
|
+
};
|
|
592
|
+
function mapStyleObjToStrIfNeeded(style) {
|
|
593
|
+
switch (TARGET) {
|
|
594
|
+
case "svelte":
|
|
595
|
+
case "vue":
|
|
596
|
+
case "solid":
|
|
597
|
+
return convertStyleMapToCSSArray(style).join(" ");
|
|
598
|
+
case "qwik":
|
|
599
|
+
case "reactNative":
|
|
600
|
+
case "react":
|
|
601
|
+
case "rsc":
|
|
602
|
+
return style;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
524
605
|
const getComponent = ({ block, context, registeredComponents }) => {
|
|
525
606
|
var _a;
|
|
526
607
|
const componentName = (_a = getProcessedBlock({
|
|
@@ -551,7 +632,8 @@ const getRepeatItemData = ({ block, context }) => {
|
|
|
551
632
|
localState: context.localState,
|
|
552
633
|
rootState: context.rootState,
|
|
553
634
|
rootSetState: context.rootSetState,
|
|
554
|
-
context: context.context
|
|
635
|
+
context: context.context,
|
|
636
|
+
enableCache: true
|
|
555
637
|
});
|
|
556
638
|
if (!Array.isArray(itemsArray))
|
|
557
639
|
return void 0;
|
|
@@ -615,28 +697,6 @@ const getSizesForBreakpoints = ({ small, medium }) => {
|
|
|
615
697
|
};
|
|
616
698
|
return newSizes;
|
|
617
699
|
};
|
|
618
|
-
const camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
619
|
-
const convertStyleMapToCSSArray = (style) => {
|
|
620
|
-
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
621
|
-
if (typeof value === "string")
|
|
622
|
-
return `${camelToKebabCase(key)}: ${value};`;
|
|
623
|
-
else
|
|
624
|
-
return void 0;
|
|
625
|
-
});
|
|
626
|
-
return cssProps.filter(checkIsDefined);
|
|
627
|
-
};
|
|
628
|
-
const convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
629
|
-
const createCssClass = ({ mediaQuery, className, styles }) => {
|
|
630
|
-
const cssClass = `.${className} {
|
|
631
|
-
${convertStyleMapToCSS(styles)}
|
|
632
|
-
}`;
|
|
633
|
-
if (mediaQuery)
|
|
634
|
-
return `${mediaQuery} {
|
|
635
|
-
${cssClass}
|
|
636
|
-
}`;
|
|
637
|
-
else
|
|
638
|
-
return cssClass;
|
|
639
|
-
};
|
|
640
700
|
const InlinedStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
641
701
|
return /* @__PURE__ */ _jsxQ("style", null, {
|
|
642
702
|
dangerouslySetInnerHTML: _fnSignal((p0) => p0.styles, [
|
|
@@ -735,7 +795,8 @@ function createEventHandler(value, options) {
|
|
|
735
795
|
localState: options2.localState,
|
|
736
796
|
rootState: options2.rootState,
|
|
737
797
|
rootSetState: options2.rootSetState,
|
|
738
|
-
event
|
|
798
|
+
event,
|
|
799
|
+
enableCache: true
|
|
739
800
|
});
|
|
740
801
|
}, "createEventHandler_7wCAiJVliNE", [
|
|
741
802
|
options,
|
|
@@ -763,29 +824,6 @@ function getBlockActions(options) {
|
|
|
763
824
|
}
|
|
764
825
|
return obj;
|
|
765
826
|
}
|
|
766
|
-
function transformStyleProperty({ style }) {
|
|
767
|
-
return style;
|
|
768
|
-
}
|
|
769
|
-
const getStyle = ({ block, context }) => {
|
|
770
|
-
return mapStyleObjToStrIfNeeded(transformStyleProperty({
|
|
771
|
-
style: block.style || {},
|
|
772
|
-
context,
|
|
773
|
-
block
|
|
774
|
-
}));
|
|
775
|
-
};
|
|
776
|
-
function mapStyleObjToStrIfNeeded(style) {
|
|
777
|
-
switch (TARGET) {
|
|
778
|
-
case "svelte":
|
|
779
|
-
case "vue":
|
|
780
|
-
case "solid":
|
|
781
|
-
return convertStyleMapToCSSArray(style).join(" ");
|
|
782
|
-
case "qwik":
|
|
783
|
-
case "reactNative":
|
|
784
|
-
case "react":
|
|
785
|
-
case "rsc":
|
|
786
|
-
return style;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
827
|
function transformBlockProperties({ properties }) {
|
|
790
828
|
return properties;
|
|
791
829
|
}
|
|
@@ -965,9 +1003,6 @@ const RepeatedBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
965
1003
|
const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
966
1004
|
var _a;
|
|
967
1005
|
_jsxBranch();
|
|
968
|
-
const state = useStore({
|
|
969
|
-
childrenContext: props.context
|
|
970
|
-
});
|
|
971
1006
|
const blockComponent = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
972
1007
|
const [props2] = useLexicalScope();
|
|
973
1008
|
return getComponent({
|
|
@@ -1040,7 +1075,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
1040
1075
|
]));
|
|
1041
1076
|
const componentRefProps = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
1042
1077
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1043
|
-
const [blockComponent2, processedBlock2, props2
|
|
1078
|
+
const [blockComponent2, processedBlock2, props2] = useLexicalScope();
|
|
1044
1079
|
return {
|
|
1045
1080
|
blockChildren: processedBlock2.value.children ?? [],
|
|
1046
1081
|
componentRef: (_a2 = blockComponent2.value) == null ? void 0 : _a2.component,
|
|
@@ -1054,7 +1089,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
1054
1089
|
builderComponents: props2.registeredComponents
|
|
1055
1090
|
} : {}
|
|
1056
1091
|
},
|
|
1057
|
-
context:
|
|
1092
|
+
context: props2.context,
|
|
1058
1093
|
linkComponent: props2.linkComponent,
|
|
1059
1094
|
registeredComponents: props2.registeredComponents,
|
|
1060
1095
|
builderBlock: processedBlock2.value,
|
|
@@ -1064,8 +1099,7 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
1064
1099
|
}, "Block_component_componentRefProps_useComputed_Ikbl8VO04ho", [
|
|
1065
1100
|
blockComponent,
|
|
1066
1101
|
processedBlock,
|
|
1067
|
-
props
|
|
1068
|
-
state
|
|
1102
|
+
props
|
|
1069
1103
|
]));
|
|
1070
1104
|
useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
1071
1105
|
const [processedBlock2] = useLexicalScope();
|
|
@@ -1173,19 +1207,19 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
1173
1207
|
(childrenWithoutParentComponent.value || []).map((child) => {
|
|
1174
1208
|
return /* @__PURE__ */ _jsxC(Block, {
|
|
1175
1209
|
block: child,
|
|
1176
|
-
get context() {
|
|
1177
|
-
return state.childrenContext;
|
|
1178
|
-
},
|
|
1179
1210
|
get registeredComponents() {
|
|
1180
1211
|
return props.registeredComponents;
|
|
1181
1212
|
},
|
|
1182
1213
|
get linkComponent() {
|
|
1183
1214
|
return props.linkComponent;
|
|
1184
1215
|
},
|
|
1216
|
+
get context() {
|
|
1217
|
+
return props.context;
|
|
1218
|
+
},
|
|
1185
1219
|
[_IMMUTABLE]: {
|
|
1186
|
-
context: _fnSignal((p0) => p0.
|
|
1187
|
-
|
|
1188
|
-
], "p0.
|
|
1220
|
+
context: _fnSignal((p0) => p0.context, [
|
|
1221
|
+
props
|
|
1222
|
+
], "p0.context"),
|
|
1189
1223
|
linkComponent: _fnSignal((p0) => p0.linkComponent, [
|
|
1190
1224
|
props
|
|
1191
1225
|
], "p0.linkComponent"),
|
|
@@ -1779,9 +1813,9 @@ const Image = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
1779
1813
|
props
|
|
1780
1814
|
], '"builder-image"+(p0.className?" "+p0.className:"")+" img-Image"'),
|
|
1781
1815
|
loading: "lazy",
|
|
1782
|
-
role: _fnSignal((p0) => p0.altText ? "presentation"
|
|
1816
|
+
role: _fnSignal((p0) => p0.altText ? void 0 : "presentation", [
|
|
1783
1817
|
props
|
|
1784
|
-
], 'p0.altText?"presentation"
|
|
1818
|
+
], 'p0.altText?undefined:"presentation"'),
|
|
1785
1819
|
sizes: _fnSignal((p0) => p0.sizes, [
|
|
1786
1820
|
props
|
|
1787
1821
|
], "p0.sizes"),
|
|
@@ -4358,7 +4392,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4358
4392
|
const url = new URL(e.origin), hostname = url.hostname;
|
|
4359
4393
|
return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
|
|
4360
4394
|
}
|
|
4361
|
-
const SDK_VERSION = "0.14.
|
|
4395
|
+
const SDK_VERSION = "0.14.7";
|
|
4362
4396
|
const registry = {};
|
|
4363
4397
|
function register(type, info) {
|
|
4364
4398
|
let typeList = registry[type];
|
|
@@ -4607,7 +4641,11 @@ const evaluateJsCode = function evaluateJsCode2(props, state, elementRef) {
|
|
|
4607
4641
|
context: props.context || {},
|
|
4608
4642
|
localState: void 0,
|
|
4609
4643
|
rootState: props.builderContextSignal.rootState,
|
|
4610
|
-
rootSetState: props.builderContextSignal.rootSetState
|
|
4644
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
4645
|
+
/**
|
|
4646
|
+
* We don't want to cache the result of the JS code, since it's arbitrary side effect code.
|
|
4647
|
+
*/
|
|
4648
|
+
enableCache: false
|
|
4611
4649
|
});
|
|
4612
4650
|
};
|
|
4613
4651
|
const onClick = function onClick22(props, state, elementRef, event) {
|
|
@@ -4629,13 +4667,14 @@ const onClick = function onClick22(props, state, elementRef, event) {
|
|
|
4629
4667
|
state.clicked = true;
|
|
4630
4668
|
};
|
|
4631
4669
|
const evalExpression = function evalExpression2(props, state, elementRef, expression) {
|
|
4632
|
-
return expression.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
|
|
4670
|
+
return expression.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
|
|
4633
4671
|
code: group,
|
|
4634
4672
|
context: props.context || {},
|
|
4635
4673
|
localState: void 0,
|
|
4636
4674
|
rootState: props.builderContextSignal.rootState,
|
|
4637
|
-
rootSetState: props.builderContextSignal.rootSetState
|
|
4638
|
-
|
|
4675
|
+
rootSetState: props.builderContextSignal.rootSetState,
|
|
4676
|
+
enableCache: true
|
|
4677
|
+
})));
|
|
4639
4678
|
};
|
|
4640
4679
|
const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
|
|
4641
4680
|
fetch$1(url).then((response) => response.json()).then((json) => {
|