@builder.io/sdk-solid 2.0.9 → 2.0.13
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 +148 -75
- package/lib/browser/dev.jsx +137 -80
- package/lib/browser/index.js +148 -75
- package/lib/browser/index.jsx +137 -80
- package/lib/edge/dev.js +148 -75
- package/lib/edge/dev.jsx +137 -80
- package/lib/edge/index.js +148 -75
- package/lib/edge/index.jsx +137 -80
- package/lib/node/dev.js +150 -77
- package/lib/node/dev.jsx +139 -82
- package/lib/node/index.js +150 -77
- package/lib/node/index.jsx +139 -82
- package/package.json +3 -3
package/lib/browser/dev.js
CHANGED
|
@@ -126,6 +126,15 @@ function getBlockComponentOptions(block) {
|
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
// src/helpers/omit.ts
|
|
130
|
+
function omit(obj, ...values) {
|
|
131
|
+
const newObject = Object.assign({}, obj);
|
|
132
|
+
for (const key of values) {
|
|
133
|
+
delete newObject[key];
|
|
134
|
+
}
|
|
135
|
+
return newObject;
|
|
136
|
+
}
|
|
137
|
+
|
|
129
138
|
// src/helpers/logger.ts
|
|
130
139
|
var MSG_PREFIX = "[Builder.io]: ";
|
|
131
140
|
var logger = {
|
|
@@ -334,6 +343,7 @@ var shouldForceBrowserRuntimeInNode = () => {
|
|
|
334
343
|
var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode() ? runInBrowser(args) : runInBrowser(args);
|
|
335
344
|
|
|
336
345
|
// src/functions/evaluate/evaluate.ts
|
|
346
|
+
var DISABLE_CACHE = true;
|
|
337
347
|
var EvalCache = class _EvalCache {
|
|
338
348
|
static cacheLimit = 20;
|
|
339
349
|
static cache = /* @__PURE__ */ new Map();
|
|
@@ -382,7 +392,7 @@ function evaluate({
|
|
|
382
392
|
rootState,
|
|
383
393
|
localState
|
|
384
394
|
};
|
|
385
|
-
if (enableCache) {
|
|
395
|
+
if (enableCache && !DISABLE_CACHE) {
|
|
386
396
|
const cacheKey = EvalCache.getCacheKey(args);
|
|
387
397
|
const cachedValue = EvalCache.getCachedValue(cacheKey);
|
|
388
398
|
if (cachedValue) {
|
|
@@ -423,6 +433,53 @@ function transformBlock(block) {
|
|
|
423
433
|
}
|
|
424
434
|
|
|
425
435
|
// src/functions/get-processed-block.ts
|
|
436
|
+
function deepCloneWithConditions(obj) {
|
|
437
|
+
if (obj === null || typeof obj !== "object") {
|
|
438
|
+
return obj;
|
|
439
|
+
}
|
|
440
|
+
if (Array.isArray(obj)) {
|
|
441
|
+
return obj.map((item) => deepCloneWithConditions(item));
|
|
442
|
+
}
|
|
443
|
+
if (obj["@type"] === "@builder.io/sdk:Element") {
|
|
444
|
+
return obj;
|
|
445
|
+
}
|
|
446
|
+
const clonedObj = {};
|
|
447
|
+
for (const key in obj) {
|
|
448
|
+
if (key !== "meta" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
449
|
+
clonedObj[key] = deepCloneWithConditions(obj[key]);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
return clonedObj;
|
|
453
|
+
}
|
|
454
|
+
var IS_SDK_WITHOUT_CACHED_PROCESSED_BLOCK = ["svelte", "vue", "angular", "qwik", "solid"].includes(TARGET);
|
|
455
|
+
var getCopy = (block) => {
|
|
456
|
+
if (IS_SDK_WITHOUT_CACHED_PROCESSED_BLOCK) {
|
|
457
|
+
const copy = fastClone(block);
|
|
458
|
+
const copied = {
|
|
459
|
+
...copy,
|
|
460
|
+
properties: {
|
|
461
|
+
...copy.properties
|
|
462
|
+
},
|
|
463
|
+
actions: {
|
|
464
|
+
...copy.actions
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
return copied;
|
|
468
|
+
} else {
|
|
469
|
+
const copy = deepCloneWithConditions(omit(block, "children", "meta"));
|
|
470
|
+
return {
|
|
471
|
+
...copy,
|
|
472
|
+
properties: {
|
|
473
|
+
...copy.properties
|
|
474
|
+
},
|
|
475
|
+
actions: {
|
|
476
|
+
...copy.actions
|
|
477
|
+
},
|
|
478
|
+
children: block.children,
|
|
479
|
+
meta: block.meta
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
};
|
|
426
483
|
var evaluateBindings = ({
|
|
427
484
|
block,
|
|
428
485
|
context,
|
|
@@ -433,16 +490,7 @@ var evaluateBindings = ({
|
|
|
433
490
|
if (!block.bindings) {
|
|
434
491
|
return block;
|
|
435
492
|
}
|
|
436
|
-
const
|
|
437
|
-
const copied = {
|
|
438
|
-
...copy,
|
|
439
|
-
properties: {
|
|
440
|
-
...copy.properties
|
|
441
|
-
},
|
|
442
|
-
actions: {
|
|
443
|
-
...copy.actions
|
|
444
|
-
}
|
|
445
|
-
};
|
|
493
|
+
const copied = getCopy(block);
|
|
446
494
|
for (const binding in block.bindings) {
|
|
447
495
|
const expression = block.bindings[binding];
|
|
448
496
|
const value = evaluate({
|
|
@@ -725,17 +773,9 @@ function mapStyleObjToStrIfNeeded(style) {
|
|
|
725
773
|
// src/components/block/block.helpers.ts
|
|
726
774
|
var getComponent = ({
|
|
727
775
|
block,
|
|
728
|
-
context,
|
|
729
776
|
registeredComponents
|
|
730
777
|
}) => {
|
|
731
|
-
const componentName =
|
|
732
|
-
block,
|
|
733
|
-
localState: context.localState,
|
|
734
|
-
rootState: context.rootState,
|
|
735
|
-
rootSetState: context.rootSetState,
|
|
736
|
-
context: context.context,
|
|
737
|
-
shouldEvaluateBindings: false
|
|
738
|
-
}).component?.name;
|
|
778
|
+
const componentName = block.component?.name;
|
|
739
779
|
if (!componentName) {
|
|
740
780
|
return null;
|
|
741
781
|
}
|
|
@@ -888,14 +928,7 @@ var inlined_styles_default = InlinedStyles;
|
|
|
888
928
|
// src/components/block/components/block-styles.tsx
|
|
889
929
|
function BlockStyles(props) {
|
|
890
930
|
const canShowBlock = createMemo(() => {
|
|
891
|
-
const processedBlock =
|
|
892
|
-
block: props.block,
|
|
893
|
-
localState: props.context.localState,
|
|
894
|
-
rootState: props.context.rootState,
|
|
895
|
-
rootSetState: props.context.rootSetState,
|
|
896
|
-
context: props.context.context,
|
|
897
|
-
shouldEvaluateBindings: true
|
|
898
|
-
});
|
|
931
|
+
const processedBlock = props.block;
|
|
899
932
|
if (checkIsDefined(processedBlock.hide)) {
|
|
900
933
|
return !processedBlock.hide;
|
|
901
934
|
}
|
|
@@ -905,14 +938,7 @@ function BlockStyles(props) {
|
|
|
905
938
|
return true;
|
|
906
939
|
});
|
|
907
940
|
const css = createMemo(() => {
|
|
908
|
-
const processedBlock =
|
|
909
|
-
block: props.block,
|
|
910
|
-
localState: props.context.localState,
|
|
911
|
-
rootState: props.context.rootState,
|
|
912
|
-
rootSetState: props.context.rootSetState,
|
|
913
|
-
context: props.context.context,
|
|
914
|
-
shouldEvaluateBindings: true
|
|
915
|
-
});
|
|
941
|
+
const processedBlock = props.block;
|
|
916
942
|
const styles = processedBlock.responsiveStyles;
|
|
917
943
|
const content = props.context.content;
|
|
918
944
|
const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(content?.meta?.breakpoints || {});
|
|
@@ -1218,12 +1244,9 @@ var repeated_block_default = RepeatedBlock;
|
|
|
1218
1244
|
|
|
1219
1245
|
// src/components/block/block.tsx
|
|
1220
1246
|
function Block(props) {
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
context: props.context,
|
|
1225
|
-
registeredComponents: props.registeredComponents
|
|
1226
|
-
});
|
|
1247
|
+
createSignal({
|
|
1248
|
+
value: null,
|
|
1249
|
+
update: false
|
|
1227
1250
|
});
|
|
1228
1251
|
const repeatItem = createMemo(() => {
|
|
1229
1252
|
return getRepeatItemData({
|
|
@@ -1232,7 +1255,7 @@ function Block(props) {
|
|
|
1232
1255
|
});
|
|
1233
1256
|
});
|
|
1234
1257
|
const processedBlock = createMemo(() => {
|
|
1235
|
-
|
|
1258
|
+
const blockToUse = props.block.repeat?.collection ? props.block : getProcessedBlock({
|
|
1236
1259
|
block: props.block,
|
|
1237
1260
|
localState: props.context.localState,
|
|
1238
1261
|
rootState: props.context.rootState,
|
|
@@ -1240,6 +1263,13 @@ function Block(props) {
|
|
|
1240
1263
|
context: props.context.context,
|
|
1241
1264
|
shouldEvaluateBindings: true
|
|
1242
1265
|
});
|
|
1266
|
+
return blockToUse;
|
|
1267
|
+
});
|
|
1268
|
+
const blockComponent = createMemo(() => {
|
|
1269
|
+
return getComponent({
|
|
1270
|
+
block: processedBlock(),
|
|
1271
|
+
registeredComponents: props.registeredComponents
|
|
1272
|
+
});
|
|
1243
1273
|
});
|
|
1244
1274
|
const Tag = createMemo(() => {
|
|
1245
1275
|
const shouldUseLink = props.block.tagName === "a" || processedBlock().properties?.href || processedBlock().href;
|
|
@@ -1298,40 +1328,72 @@ function Block(props) {
|
|
|
1298
1328
|
get children() {
|
|
1299
1329
|
return [createComponent(block_styles_default, {
|
|
1300
1330
|
get block() {
|
|
1301
|
-
return
|
|
1331
|
+
return processedBlock();
|
|
1302
1332
|
},
|
|
1303
1333
|
get context() {
|
|
1304
1334
|
return props.context;
|
|
1305
1335
|
}
|
|
1306
1336
|
}), createComponent(Show, {
|
|
1307
1337
|
get fallback() {
|
|
1308
|
-
return createComponent(
|
|
1309
|
-
get
|
|
1310
|
-
return
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1338
|
+
return createComponent(Show, {
|
|
1339
|
+
get fallback() {
|
|
1340
|
+
return createComponent(For, {
|
|
1341
|
+
get each() {
|
|
1342
|
+
return repeatItem();
|
|
1343
|
+
},
|
|
1344
|
+
children: (data, _index) => {
|
|
1345
|
+
const index = _index();
|
|
1346
|
+
return createComponent(repeated_block_default, {
|
|
1347
|
+
key: index,
|
|
1348
|
+
get repeatContext() {
|
|
1349
|
+
return data.context;
|
|
1350
|
+
},
|
|
1351
|
+
get block() {
|
|
1352
|
+
return data.block;
|
|
1353
|
+
},
|
|
1354
|
+
get registeredComponents() {
|
|
1355
|
+
return props.registeredComponents;
|
|
1356
|
+
},
|
|
1357
|
+
get linkComponent() {
|
|
1358
|
+
return props.linkComponent;
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
});
|
|
1329
1363
|
},
|
|
1330
|
-
get
|
|
1331
|
-
return
|
|
1364
|
+
get when() {
|
|
1365
|
+
return !repeatItem();
|
|
1332
1366
|
},
|
|
1333
|
-
get
|
|
1334
|
-
return
|
|
1367
|
+
get children() {
|
|
1368
|
+
return createComponent(component_ref_default, {
|
|
1369
|
+
get componentRef() {
|
|
1370
|
+
return componentRefProps().componentRef;
|
|
1371
|
+
},
|
|
1372
|
+
get componentOptions() {
|
|
1373
|
+
return componentRefProps().componentOptions;
|
|
1374
|
+
},
|
|
1375
|
+
get blockChildren() {
|
|
1376
|
+
return componentRefProps().blockChildren;
|
|
1377
|
+
},
|
|
1378
|
+
get context() {
|
|
1379
|
+
return componentRefProps().context;
|
|
1380
|
+
},
|
|
1381
|
+
get registeredComponents() {
|
|
1382
|
+
return componentRefProps().registeredComponents;
|
|
1383
|
+
},
|
|
1384
|
+
get linkComponent() {
|
|
1385
|
+
return componentRefProps().linkComponent;
|
|
1386
|
+
},
|
|
1387
|
+
get builderBlock() {
|
|
1388
|
+
return componentRefProps().builderBlock;
|
|
1389
|
+
},
|
|
1390
|
+
get includeBlockProps() {
|
|
1391
|
+
return componentRefProps().includeBlockProps;
|
|
1392
|
+
},
|
|
1393
|
+
get isInteractive() {
|
|
1394
|
+
return componentRefProps().isInteractive;
|
|
1395
|
+
}
|
|
1396
|
+
});
|
|
1335
1397
|
}
|
|
1336
1398
|
});
|
|
1337
1399
|
},
|
|
@@ -1441,7 +1503,7 @@ function Block(props) {
|
|
|
1441
1503
|
});
|
|
1442
1504
|
}
|
|
1443
1505
|
var block_default = Block;
|
|
1444
|
-
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-
|
|
1506
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-4da8c6f4 {
|
|
1445
1507
|
display: flex;
|
|
1446
1508
|
flex-direction: column;
|
|
1447
1509
|
align-items: stretch;
|
|
@@ -1472,9 +1534,16 @@ function BlocksWrapper(props) {
|
|
|
1472
1534
|
}, "*");
|
|
1473
1535
|
}
|
|
1474
1536
|
}
|
|
1537
|
+
let blocksWrapperRef;
|
|
1538
|
+
onMount(() => {
|
|
1539
|
+
});
|
|
1475
1540
|
return [createComponent(Dynamic, mergeProps({
|
|
1476
1541
|
get ["class"]() {
|
|
1477
|
-
return className() + " dynamic-
|
|
1542
|
+
return className() + " dynamic-4da8c6f4";
|
|
1543
|
+
},
|
|
1544
|
+
ref(r$) {
|
|
1545
|
+
const _ref$ = blocksWrapperRef;
|
|
1546
|
+
typeof _ref$ === "function" ? _ref$(r$) : blocksWrapperRef = r$;
|
|
1478
1547
|
},
|
|
1479
1548
|
get ["builder-path"]() {
|
|
1480
1549
|
return props.path;
|
|
@@ -2938,7 +3007,8 @@ var componentInfo7 = {
|
|
|
2938
3007
|
defaultValue: "children"
|
|
2939
3008
|
}],
|
|
2940
3009
|
shouldReceiveBuilderProps: {
|
|
2941
|
-
builderContext: true
|
|
3010
|
+
builderContext: true,
|
|
3011
|
+
builderComponents: true
|
|
2942
3012
|
}
|
|
2943
3013
|
};
|
|
2944
3014
|
var _tmpl$8 = /* @__PURE__ */ template(`<div>`);
|
|
@@ -2959,6 +3029,9 @@ function Slot(props) {
|
|
|
2959
3029
|
get context() {
|
|
2960
3030
|
return props.builderContext;
|
|
2961
3031
|
},
|
|
3032
|
+
get registeredComponents() {
|
|
3033
|
+
return props.builderComponents;
|
|
3034
|
+
},
|
|
2962
3035
|
get blocks() {
|
|
2963
3036
|
return props.builderContext.rootState?.[props.name];
|
|
2964
3037
|
}
|
|
@@ -4776,7 +4849,7 @@ var generateContentUrl = (options) => {
|
|
|
4776
4849
|
locale,
|
|
4777
4850
|
apiVersion = DEFAULT_API_VERSION,
|
|
4778
4851
|
fields,
|
|
4779
|
-
omit,
|
|
4852
|
+
omit: omit2,
|
|
4780
4853
|
offset,
|
|
4781
4854
|
cacheSeconds,
|
|
4782
4855
|
staleCacheSeconds,
|
|
@@ -4799,7 +4872,7 @@ var generateContentUrl = (options) => {
|
|
|
4799
4872
|
url.searchParams.set("locale", locale);
|
|
4800
4873
|
if (enrich)
|
|
4801
4874
|
url.searchParams.set("enrich", String(enrich));
|
|
4802
|
-
url.searchParams.set("omit",
|
|
4875
|
+
url.searchParams.set("omit", omit2 || "meta.componentsUsed");
|
|
4803
4876
|
if (fields) {
|
|
4804
4877
|
url.searchParams.set("fields", fields);
|
|
4805
4878
|
}
|
|
@@ -5172,7 +5245,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
5172
5245
|
}
|
|
5173
5246
|
|
|
5174
5247
|
// src/constants/sdk-version.ts
|
|
5175
|
-
var SDK_VERSION = "2.0.
|
|
5248
|
+
var SDK_VERSION = "2.0.13";
|
|
5176
5249
|
|
|
5177
5250
|
// src/functions/register.ts
|
|
5178
5251
|
var registry = {};
|