@builder.io/sdk-solid 2.0.9 → 2.0.15
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 +1 -1
- 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 +2 -4
package/lib/edge/index.js
CHANGED
|
@@ -132,6 +132,15 @@ function getBlockComponentOptions(block) {
|
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
// src/helpers/omit.ts
|
|
136
|
+
function omit(obj, ...values) {
|
|
137
|
+
const newObject = Object.assign({}, obj);
|
|
138
|
+
for (const key of values) {
|
|
139
|
+
delete newObject[key];
|
|
140
|
+
}
|
|
141
|
+
return newObject;
|
|
142
|
+
}
|
|
143
|
+
|
|
135
144
|
// src/helpers/logger.ts
|
|
136
145
|
var logger = {
|
|
137
146
|
log: (...message) => void 0,
|
|
@@ -3488,6 +3497,7 @@ var shouldForceBrowserRuntimeInNode = () => {
|
|
|
3488
3497
|
var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode() ? runInBrowser(args) : runInEdge(args);
|
|
3489
3498
|
|
|
3490
3499
|
// src/functions/evaluate/evaluate.ts
|
|
3500
|
+
var DISABLE_CACHE = true;
|
|
3491
3501
|
var EvalCache = class _EvalCache {
|
|
3492
3502
|
static cacheLimit = 20;
|
|
3493
3503
|
static cache = /* @__PURE__ */ new Map();
|
|
@@ -3536,7 +3546,7 @@ function evaluate({
|
|
|
3536
3546
|
rootState,
|
|
3537
3547
|
localState
|
|
3538
3548
|
};
|
|
3539
|
-
if (enableCache) {
|
|
3549
|
+
if (enableCache && !DISABLE_CACHE) {
|
|
3540
3550
|
const cacheKey = EvalCache.getCacheKey(args);
|
|
3541
3551
|
const cachedValue = EvalCache.getCachedValue(cacheKey);
|
|
3542
3552
|
if (cachedValue) {
|
|
@@ -3567,6 +3577,53 @@ function transformBlock(block) {
|
|
|
3567
3577
|
}
|
|
3568
3578
|
|
|
3569
3579
|
// src/functions/get-processed-block.ts
|
|
3580
|
+
function deepCloneWithConditions(obj) {
|
|
3581
|
+
if (obj === null || typeof obj !== "object") {
|
|
3582
|
+
return obj;
|
|
3583
|
+
}
|
|
3584
|
+
if (Array.isArray(obj)) {
|
|
3585
|
+
return obj.map((item) => deepCloneWithConditions(item));
|
|
3586
|
+
}
|
|
3587
|
+
if (obj["@type"] === "@builder.io/sdk:Element") {
|
|
3588
|
+
return obj;
|
|
3589
|
+
}
|
|
3590
|
+
const clonedObj = {};
|
|
3591
|
+
for (const key in obj) {
|
|
3592
|
+
if (key !== "meta" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
3593
|
+
clonedObj[key] = deepCloneWithConditions(obj[key]);
|
|
3594
|
+
}
|
|
3595
|
+
}
|
|
3596
|
+
return clonedObj;
|
|
3597
|
+
}
|
|
3598
|
+
var IS_SDK_WITHOUT_CACHED_PROCESSED_BLOCK = ["svelte", "vue", "angular", "qwik", "solid"].includes(TARGET);
|
|
3599
|
+
var getCopy = (block) => {
|
|
3600
|
+
if (IS_SDK_WITHOUT_CACHED_PROCESSED_BLOCK) {
|
|
3601
|
+
const copy = fastClone(block);
|
|
3602
|
+
const copied = {
|
|
3603
|
+
...copy,
|
|
3604
|
+
properties: {
|
|
3605
|
+
...copy.properties
|
|
3606
|
+
},
|
|
3607
|
+
actions: {
|
|
3608
|
+
...copy.actions
|
|
3609
|
+
}
|
|
3610
|
+
};
|
|
3611
|
+
return copied;
|
|
3612
|
+
} else {
|
|
3613
|
+
const copy = deepCloneWithConditions(omit(block, "children", "meta"));
|
|
3614
|
+
return {
|
|
3615
|
+
...copy,
|
|
3616
|
+
properties: {
|
|
3617
|
+
...copy.properties
|
|
3618
|
+
},
|
|
3619
|
+
actions: {
|
|
3620
|
+
...copy.actions
|
|
3621
|
+
},
|
|
3622
|
+
children: block.children,
|
|
3623
|
+
meta: block.meta
|
|
3624
|
+
};
|
|
3625
|
+
}
|
|
3626
|
+
};
|
|
3570
3627
|
var evaluateBindings = ({
|
|
3571
3628
|
block,
|
|
3572
3629
|
context,
|
|
@@ -3577,16 +3634,7 @@ var evaluateBindings = ({
|
|
|
3577
3634
|
if (!block.bindings) {
|
|
3578
3635
|
return block;
|
|
3579
3636
|
}
|
|
3580
|
-
const
|
|
3581
|
-
const copied = {
|
|
3582
|
-
...copy,
|
|
3583
|
-
properties: {
|
|
3584
|
-
...copy.properties
|
|
3585
|
-
},
|
|
3586
|
-
actions: {
|
|
3587
|
-
...copy.actions
|
|
3588
|
-
}
|
|
3589
|
-
};
|
|
3637
|
+
const copied = getCopy(block);
|
|
3590
3638
|
for (const binding in block.bindings) {
|
|
3591
3639
|
const expression = block.bindings[binding];
|
|
3592
3640
|
const value = evaluate({
|
|
@@ -3868,17 +3916,9 @@ function mapStyleObjToStrIfNeeded(style) {
|
|
|
3868
3916
|
// src/components/block/block.helpers.ts
|
|
3869
3917
|
var getComponent = ({
|
|
3870
3918
|
block,
|
|
3871
|
-
context,
|
|
3872
3919
|
registeredComponents
|
|
3873
3920
|
}) => {
|
|
3874
|
-
const componentName =
|
|
3875
|
-
block,
|
|
3876
|
-
localState: context.localState,
|
|
3877
|
-
rootState: context.rootState,
|
|
3878
|
-
rootSetState: context.rootSetState,
|
|
3879
|
-
context: context.context,
|
|
3880
|
-
shouldEvaluateBindings: false
|
|
3881
|
-
}).component?.name;
|
|
3921
|
+
const componentName = block.component?.name;
|
|
3882
3922
|
if (!componentName) {
|
|
3883
3923
|
return null;
|
|
3884
3924
|
}
|
|
@@ -4028,14 +4068,7 @@ var inlined_styles_default = InlinedStyles;
|
|
|
4028
4068
|
// src/components/block/components/block-styles.tsx
|
|
4029
4069
|
function BlockStyles(props) {
|
|
4030
4070
|
const canShowBlock = createMemo(() => {
|
|
4031
|
-
const processedBlock =
|
|
4032
|
-
block: props.block,
|
|
4033
|
-
localState: props.context.localState,
|
|
4034
|
-
rootState: props.context.rootState,
|
|
4035
|
-
rootSetState: props.context.rootSetState,
|
|
4036
|
-
context: props.context.context,
|
|
4037
|
-
shouldEvaluateBindings: true
|
|
4038
|
-
});
|
|
4071
|
+
const processedBlock = props.block;
|
|
4039
4072
|
if (checkIsDefined(processedBlock.hide)) {
|
|
4040
4073
|
return !processedBlock.hide;
|
|
4041
4074
|
}
|
|
@@ -4045,14 +4078,7 @@ function BlockStyles(props) {
|
|
|
4045
4078
|
return true;
|
|
4046
4079
|
});
|
|
4047
4080
|
const css = createMemo(() => {
|
|
4048
|
-
const processedBlock =
|
|
4049
|
-
block: props.block,
|
|
4050
|
-
localState: props.context.localState,
|
|
4051
|
-
rootState: props.context.rootState,
|
|
4052
|
-
rootSetState: props.context.rootSetState,
|
|
4053
|
-
context: props.context.context,
|
|
4054
|
-
shouldEvaluateBindings: true
|
|
4055
|
-
});
|
|
4081
|
+
const processedBlock = props.block;
|
|
4056
4082
|
const styles = processedBlock.responsiveStyles;
|
|
4057
4083
|
const content = props.context.content;
|
|
4058
4084
|
const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(content?.meta?.breakpoints || {});
|
|
@@ -4358,12 +4384,9 @@ var repeated_block_default = RepeatedBlock;
|
|
|
4358
4384
|
|
|
4359
4385
|
// src/components/block/block.tsx
|
|
4360
4386
|
function Block(props) {
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
context: props.context,
|
|
4365
|
-
registeredComponents: props.registeredComponents
|
|
4366
|
-
});
|
|
4387
|
+
createSignal({
|
|
4388
|
+
value: null,
|
|
4389
|
+
update: false
|
|
4367
4390
|
});
|
|
4368
4391
|
const repeatItem = createMemo(() => {
|
|
4369
4392
|
return getRepeatItemData({
|
|
@@ -4372,7 +4395,7 @@ function Block(props) {
|
|
|
4372
4395
|
});
|
|
4373
4396
|
});
|
|
4374
4397
|
const processedBlock = createMemo(() => {
|
|
4375
|
-
|
|
4398
|
+
const blockToUse = props.block.repeat?.collection ? props.block : getProcessedBlock({
|
|
4376
4399
|
block: props.block,
|
|
4377
4400
|
localState: props.context.localState,
|
|
4378
4401
|
rootState: props.context.rootState,
|
|
@@ -4380,6 +4403,13 @@ function Block(props) {
|
|
|
4380
4403
|
context: props.context.context,
|
|
4381
4404
|
shouldEvaluateBindings: true
|
|
4382
4405
|
});
|
|
4406
|
+
return blockToUse;
|
|
4407
|
+
});
|
|
4408
|
+
const blockComponent = createMemo(() => {
|
|
4409
|
+
return getComponent({
|
|
4410
|
+
block: processedBlock(),
|
|
4411
|
+
registeredComponents: props.registeredComponents
|
|
4412
|
+
});
|
|
4383
4413
|
});
|
|
4384
4414
|
const Tag = createMemo(() => {
|
|
4385
4415
|
const shouldUseLink = props.block.tagName === "a" || processedBlock().properties?.href || processedBlock().href;
|
|
@@ -4438,40 +4468,72 @@ function Block(props) {
|
|
|
4438
4468
|
get children() {
|
|
4439
4469
|
return [createComponent(block_styles_default, {
|
|
4440
4470
|
get block() {
|
|
4441
|
-
return
|
|
4471
|
+
return processedBlock();
|
|
4442
4472
|
},
|
|
4443
4473
|
get context() {
|
|
4444
4474
|
return props.context;
|
|
4445
4475
|
}
|
|
4446
4476
|
}), createComponent(Show, {
|
|
4447
4477
|
get fallback() {
|
|
4448
|
-
return createComponent(
|
|
4449
|
-
get
|
|
4450
|
-
return
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4478
|
+
return createComponent(Show, {
|
|
4479
|
+
get fallback() {
|
|
4480
|
+
return createComponent(For, {
|
|
4481
|
+
get each() {
|
|
4482
|
+
return repeatItem();
|
|
4483
|
+
},
|
|
4484
|
+
children: (data, _index) => {
|
|
4485
|
+
const index = _index();
|
|
4486
|
+
return createComponent(repeated_block_default, {
|
|
4487
|
+
key: index,
|
|
4488
|
+
get repeatContext() {
|
|
4489
|
+
return data.context;
|
|
4490
|
+
},
|
|
4491
|
+
get block() {
|
|
4492
|
+
return data.block;
|
|
4493
|
+
},
|
|
4494
|
+
get registeredComponents() {
|
|
4495
|
+
return props.registeredComponents;
|
|
4496
|
+
},
|
|
4497
|
+
get linkComponent() {
|
|
4498
|
+
return props.linkComponent;
|
|
4499
|
+
}
|
|
4500
|
+
});
|
|
4501
|
+
}
|
|
4502
|
+
});
|
|
4469
4503
|
},
|
|
4470
|
-
get
|
|
4471
|
-
return
|
|
4504
|
+
get when() {
|
|
4505
|
+
return !repeatItem();
|
|
4472
4506
|
},
|
|
4473
|
-
get
|
|
4474
|
-
return
|
|
4507
|
+
get children() {
|
|
4508
|
+
return createComponent(component_ref_default, {
|
|
4509
|
+
get componentRef() {
|
|
4510
|
+
return componentRefProps().componentRef;
|
|
4511
|
+
},
|
|
4512
|
+
get componentOptions() {
|
|
4513
|
+
return componentRefProps().componentOptions;
|
|
4514
|
+
},
|
|
4515
|
+
get blockChildren() {
|
|
4516
|
+
return componentRefProps().blockChildren;
|
|
4517
|
+
},
|
|
4518
|
+
get context() {
|
|
4519
|
+
return componentRefProps().context;
|
|
4520
|
+
},
|
|
4521
|
+
get registeredComponents() {
|
|
4522
|
+
return componentRefProps().registeredComponents;
|
|
4523
|
+
},
|
|
4524
|
+
get linkComponent() {
|
|
4525
|
+
return componentRefProps().linkComponent;
|
|
4526
|
+
},
|
|
4527
|
+
get builderBlock() {
|
|
4528
|
+
return componentRefProps().builderBlock;
|
|
4529
|
+
},
|
|
4530
|
+
get includeBlockProps() {
|
|
4531
|
+
return componentRefProps().includeBlockProps;
|
|
4532
|
+
},
|
|
4533
|
+
get isInteractive() {
|
|
4534
|
+
return componentRefProps().isInteractive;
|
|
4535
|
+
}
|
|
4536
|
+
});
|
|
4475
4537
|
}
|
|
4476
4538
|
});
|
|
4477
4539
|
},
|
|
@@ -4581,7 +4643,7 @@ function Block(props) {
|
|
|
4581
4643
|
});
|
|
4582
4644
|
}
|
|
4583
4645
|
var block_default = Block;
|
|
4584
|
-
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-
|
|
4646
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-4da8c6f4 {
|
|
4585
4647
|
display: flex;
|
|
4586
4648
|
flex-direction: column;
|
|
4587
4649
|
align-items: stretch;
|
|
@@ -4612,9 +4674,16 @@ function BlocksWrapper(props) {
|
|
|
4612
4674
|
}, "*");
|
|
4613
4675
|
}
|
|
4614
4676
|
}
|
|
4677
|
+
let blocksWrapperRef;
|
|
4678
|
+
onMount(() => {
|
|
4679
|
+
});
|
|
4615
4680
|
return [createComponent(Dynamic, mergeProps({
|
|
4616
4681
|
get ["class"]() {
|
|
4617
|
-
return className() + " dynamic-
|
|
4682
|
+
return className() + " dynamic-4da8c6f4";
|
|
4683
|
+
},
|
|
4684
|
+
ref(r$) {
|
|
4685
|
+
const _ref$ = blocksWrapperRef;
|
|
4686
|
+
typeof _ref$ === "function" ? _ref$(r$) : blocksWrapperRef = r$;
|
|
4618
4687
|
},
|
|
4619
4688
|
get ["builder-path"]() {
|
|
4620
4689
|
return props.path;
|
|
@@ -6076,7 +6145,8 @@ var componentInfo7 = {
|
|
|
6076
6145
|
defaultValue: "children"
|
|
6077
6146
|
}],
|
|
6078
6147
|
shouldReceiveBuilderProps: {
|
|
6079
|
-
builderContext: true
|
|
6148
|
+
builderContext: true,
|
|
6149
|
+
builderComponents: true
|
|
6080
6150
|
}
|
|
6081
6151
|
};
|
|
6082
6152
|
var _tmpl$8 = /* @__PURE__ */ template(`<div>`);
|
|
@@ -6097,6 +6167,9 @@ function Slot(props) {
|
|
|
6097
6167
|
get context() {
|
|
6098
6168
|
return props.builderContext;
|
|
6099
6169
|
},
|
|
6170
|
+
get registeredComponents() {
|
|
6171
|
+
return props.builderComponents;
|
|
6172
|
+
},
|
|
6100
6173
|
get blocks() {
|
|
6101
6174
|
return props.builderContext.rootState?.[props.name];
|
|
6102
6175
|
}
|
|
@@ -7910,7 +7983,7 @@ var generateContentUrl = (options) => {
|
|
|
7910
7983
|
locale,
|
|
7911
7984
|
apiVersion = DEFAULT_API_VERSION,
|
|
7912
7985
|
fields,
|
|
7913
|
-
omit,
|
|
7986
|
+
omit: omit2,
|
|
7914
7987
|
offset,
|
|
7915
7988
|
cacheSeconds,
|
|
7916
7989
|
staleCacheSeconds,
|
|
@@ -7933,7 +8006,7 @@ var generateContentUrl = (options) => {
|
|
|
7933
8006
|
url.searchParams.set("locale", locale);
|
|
7934
8007
|
if (enrich)
|
|
7935
8008
|
url.searchParams.set("enrich", String(enrich));
|
|
7936
|
-
url.searchParams.set("omit",
|
|
8009
|
+
url.searchParams.set("omit", omit2 || "meta.componentsUsed");
|
|
7937
8010
|
if (fields) {
|
|
7938
8011
|
url.searchParams.set("fields", fields);
|
|
7939
8012
|
}
|
|
@@ -8303,7 +8376,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
8303
8376
|
}
|
|
8304
8377
|
|
|
8305
8378
|
// src/constants/sdk-version.ts
|
|
8306
|
-
var SDK_VERSION = "2.0.
|
|
8379
|
+
var SDK_VERSION = "2.0.15";
|
|
8307
8380
|
|
|
8308
8381
|
// src/functions/register.ts
|
|
8309
8382
|
var registry = {};
|