@builder.io/sdk-solid 0.12.0 → 0.12.2
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 +4 -0
- package/lib/browser/dev.js +156 -77
- package/lib/browser/dev.jsx +137 -75
- package/lib/browser/index.js +156 -77
- package/lib/browser/index.jsx +137 -75
- package/lib/edge/dev.js +156 -77
- package/lib/edge/dev.jsx +137 -75
- package/lib/edge/index.js +156 -77
- package/lib/edge/index.jsx +137 -75
- package/lib/node/dev.js +156 -77
- package/lib/node/dev.jsx +137 -75
- package/lib/node/index.js +156 -77
- package/lib/node/index.jsx +137 -75
- package/package.json +1 -1
package/lib/edge/index.jsx
CHANGED
|
@@ -3478,10 +3478,6 @@ function getProcessedBlock({
|
|
|
3478
3478
|
}
|
|
3479
3479
|
|
|
3480
3480
|
// src/components/block/block.helpers.ts
|
|
3481
|
-
var EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
|
|
3482
|
-
var isEmptyHtmlElement = (tagName) => {
|
|
3483
|
-
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
|
|
3484
|
-
};
|
|
3485
3481
|
var getComponent = ({
|
|
3486
3482
|
block,
|
|
3487
3483
|
context,
|
|
@@ -3703,10 +3699,6 @@ function BlockStyles(props) {
|
|
|
3703
3699
|
}
|
|
3704
3700
|
var Block_styles_default = BlockStyles;
|
|
3705
3701
|
|
|
3706
|
-
// src/components/block/components/block-wrapper.tsx
|
|
3707
|
-
import { Show as Show3 } from "solid-js";
|
|
3708
|
-
import { Dynamic } from "solid-js/web";
|
|
3709
|
-
|
|
3710
3702
|
// src/functions/event-handler-name.ts
|
|
3711
3703
|
function capitalizeFirstLetter(string) {
|
|
3712
3704
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
@@ -3793,31 +3785,49 @@ function getStyleAttribute(style) {
|
|
|
3793
3785
|
}
|
|
3794
3786
|
}
|
|
3795
3787
|
|
|
3796
|
-
// src/components/
|
|
3797
|
-
|
|
3788
|
+
// src/components/dynamic-renderer/dynamic-renderer.tsx
|
|
3789
|
+
import { Show as Show3 } from "solid-js";
|
|
3790
|
+
import { Dynamic } from "solid-js/web";
|
|
3791
|
+
|
|
3792
|
+
// src/components/dynamic-renderer/dynamic-renderer.helpers.ts
|
|
3793
|
+
var EMPTY_HTML_ELEMENTS = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]);
|
|
3794
|
+
var isEmptyElement = (tagName) => {
|
|
3795
|
+
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.has(tagName.toLowerCase());
|
|
3796
|
+
};
|
|
3797
|
+
|
|
3798
|
+
// src/components/dynamic-renderer/dynamic-renderer.tsx
|
|
3799
|
+
function DynamicRenderer(props) {
|
|
3798
3800
|
return <Show3
|
|
3799
3801
|
fallback={<Dynamic
|
|
3800
|
-
{...
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
})}
|
|
3804
|
-
{...getBlockActions({
|
|
3805
|
-
block: props.block,
|
|
3806
|
-
rootState: props.context.rootState,
|
|
3807
|
-
rootSetState: props.context.rootSetState,
|
|
3808
|
-
localState: props.context.localState,
|
|
3809
|
-
context: props.context.context,
|
|
3810
|
-
stripPrefix: true
|
|
3811
|
-
})}
|
|
3812
|
-
component={props.Wrapper}
|
|
3802
|
+
{...props.attributes}
|
|
3803
|
+
{...props.actionAttributes}
|
|
3804
|
+
component={props.TagName}
|
|
3813
3805
|
/>}
|
|
3814
|
-
when={props.
|
|
3806
|
+
when={!isEmptyElement(props.TagName)}
|
|
3807
|
+
><Show3
|
|
3808
|
+
fallback={<Dynamic
|
|
3809
|
+
{...props.attributes}
|
|
3810
|
+
{...props.actionAttributes}
|
|
3811
|
+
component={props.TagName}
|
|
3812
|
+
>{props.children}</Dynamic>}
|
|
3813
|
+
when={typeof props.TagName === "string"}
|
|
3815
3814
|
><Dynamic
|
|
3816
|
-
{...
|
|
3815
|
+
{...props.attributes}
|
|
3816
|
+
{...props.actionAttributes}
|
|
3817
|
+
component={props.TagName}
|
|
3818
|
+
>{props.children}</Dynamic></Show3></Show3>;
|
|
3819
|
+
}
|
|
3820
|
+
var Dynamic_renderer_default = DynamicRenderer;
|
|
3821
|
+
|
|
3822
|
+
// src/components/block/components/block-wrapper.tsx
|
|
3823
|
+
function BlockWrapper(props) {
|
|
3824
|
+
return <Dynamic_renderer_default
|
|
3825
|
+
TagName={props.Wrapper}
|
|
3826
|
+
attributes={getBlockProperties({
|
|
3817
3827
|
block: props.block,
|
|
3818
3828
|
context: props.context
|
|
3819
3829
|
})}
|
|
3820
|
-
{
|
|
3830
|
+
actionAttributes={getBlockActions({
|
|
3821
3831
|
block: props.block,
|
|
3822
3832
|
rootState: props.context.rootState,
|
|
3823
3833
|
rootSetState: props.context.rootSetState,
|
|
@@ -3825,8 +3835,7 @@ function BlockWrapper(props) {
|
|
|
3825
3835
|
context: props.context.context,
|
|
3826
3836
|
stripPrefix: true
|
|
3827
3837
|
})}
|
|
3828
|
-
|
|
3829
|
-
>{props.children}</Dynamic></Show3>;
|
|
3838
|
+
>{props.children}</Dynamic_renderer_default>;
|
|
3830
3839
|
}
|
|
3831
3840
|
var Block_wrapper_default = BlockWrapper;
|
|
3832
3841
|
|
|
@@ -4005,14 +4014,8 @@ function Block(props) {
|
|
|
4005
4014
|
isInteractive={componentRefProps().isInteractive}
|
|
4006
4015
|
/>}
|
|
4007
4016
|
when={!blockComponent()?.noWrap}
|
|
4008
|
-
|
|
4009
|
-
<
|
|
4010
|
-
Wrapper={Tag()}
|
|
4011
|
-
block={processedBlock()}
|
|
4012
|
-
context={props.context}
|
|
4013
|
-
hasChildren={false}
|
|
4014
|
-
/></Show5>
|
|
4015
|
-
<Show5 when={!isEmptyHtmlElement(Tag()) && repeatItem()}><For2 each={repeatItem()}>{(data, _index) => {
|
|
4017
|
+
><Show5
|
|
4018
|
+
fallback={<For2 each={repeatItem()}>{(data, _index) => {
|
|
4016
4019
|
const index = _index();
|
|
4017
4020
|
return <Repeated_block_default
|
|
4018
4021
|
key={index}
|
|
@@ -4020,34 +4023,33 @@ function Block(props) {
|
|
|
4020
4023
|
block={data.block}
|
|
4021
4024
|
registeredComponents={props.registeredComponents}
|
|
4022
4025
|
/>;
|
|
4023
|
-
}}</For2
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
</Show5>
|
|
4026
|
+
}}</For2>}
|
|
4027
|
+
when={!repeatItem()}
|
|
4028
|
+
><Block_wrapper_default
|
|
4029
|
+
Wrapper={Tag()}
|
|
4030
|
+
block={processedBlock()}
|
|
4031
|
+
context={props.context}
|
|
4032
|
+
>
|
|
4033
|
+
<Component_ref_default
|
|
4034
|
+
componentRef={componentRefProps().componentRef}
|
|
4035
|
+
componentOptions={componentRefProps().componentOptions}
|
|
4036
|
+
blockChildren={componentRefProps().blockChildren}
|
|
4037
|
+
context={componentRefProps().context}
|
|
4038
|
+
registeredComponents={componentRefProps().registeredComponents}
|
|
4039
|
+
builderBlock={componentRefProps().builderBlock}
|
|
4040
|
+
includeBlockProps={componentRefProps().includeBlockProps}
|
|
4041
|
+
isInteractive={componentRefProps().isInteractive}
|
|
4042
|
+
/>
|
|
4043
|
+
<For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
|
|
4044
|
+
const index = _index();
|
|
4045
|
+
return <Block
|
|
4046
|
+
key={child.id}
|
|
4047
|
+
block={child}
|
|
4048
|
+
context={childrenContext()}
|
|
4049
|
+
registeredComponents={props.registeredComponents}
|
|
4050
|
+
/>;
|
|
4051
|
+
}}</For2>
|
|
4052
|
+
</Block_wrapper_default></Show5></Show5>
|
|
4051
4053
|
</Show5>;
|
|
4052
4054
|
}
|
|
4053
4055
|
var Block_default = Block;
|
|
@@ -5244,8 +5246,42 @@ var componentInfo8 = {
|
|
|
5244
5246
|
}]
|
|
5245
5247
|
};
|
|
5246
5248
|
|
|
5247
|
-
// src/blocks/
|
|
5249
|
+
// src/blocks/slot/component-info.ts
|
|
5248
5250
|
var componentInfo9 = {
|
|
5251
|
+
name: "Slot",
|
|
5252
|
+
isRSC: true,
|
|
5253
|
+
description: "Allow child blocks to be inserted into this content when used as a Symbol",
|
|
5254
|
+
docsLink: "https://www.builder.io/c/docs/symbols-with-blocks",
|
|
5255
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",
|
|
5256
|
+
// Maybe wrap this for canHaveChildren so bind children to this hm
|
|
5257
|
+
inputs: [{
|
|
5258
|
+
name: "name",
|
|
5259
|
+
type: "string",
|
|
5260
|
+
required: true,
|
|
5261
|
+
defaultValue: "children"
|
|
5262
|
+
}]
|
|
5263
|
+
};
|
|
5264
|
+
|
|
5265
|
+
// src/blocks/slot/slot.tsx
|
|
5266
|
+
function Slot(props) {
|
|
5267
|
+
return <div
|
|
5268
|
+
style={{
|
|
5269
|
+
"pointer-events": "auto"
|
|
5270
|
+
}}
|
|
5271
|
+
{...!props.builderContext.context?.symbolId && {
|
|
5272
|
+
"builder-slot": props.name
|
|
5273
|
+
}}
|
|
5274
|
+
><Blocks_default
|
|
5275
|
+
parent={props.builderContext.context?.symbolId}
|
|
5276
|
+
path={`symbol.data.${props.name}`}
|
|
5277
|
+
context={props.builderContext}
|
|
5278
|
+
blocks={props.builderContext.rootState?.[props.name]}
|
|
5279
|
+
/></div>;
|
|
5280
|
+
}
|
|
5281
|
+
var slot_default = Slot;
|
|
5282
|
+
|
|
5283
|
+
// src/blocks/symbol/component-info.ts
|
|
5284
|
+
var componentInfo10 = {
|
|
5249
5285
|
name: "Symbol",
|
|
5250
5286
|
noWrap: true,
|
|
5251
5287
|
static: true,
|
|
@@ -5281,7 +5317,7 @@ var componentInfo9 = {
|
|
|
5281
5317
|
};
|
|
5282
5318
|
|
|
5283
5319
|
// src/blocks/text/component-info.ts
|
|
5284
|
-
var
|
|
5320
|
+
var componentInfo11 = {
|
|
5285
5321
|
name: "Text",
|
|
5286
5322
|
static: true,
|
|
5287
5323
|
isRSC: true,
|
|
@@ -5314,7 +5350,7 @@ function Text(props) {
|
|
|
5314
5350
|
var text_default = Text;
|
|
5315
5351
|
|
|
5316
5352
|
// src/blocks/video/component-info.ts
|
|
5317
|
-
var
|
|
5353
|
+
var componentInfo12 = {
|
|
5318
5354
|
name: "Video",
|
|
5319
5355
|
canHaveChildren: true,
|
|
5320
5356
|
defaultStyles: {
|
|
@@ -5511,13 +5547,16 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
5511
5547
|
...componentInfo8
|
|
5512
5548
|
}, {
|
|
5513
5549
|
component: symbol_default,
|
|
5514
|
-
...
|
|
5550
|
+
...componentInfo10
|
|
5515
5551
|
}, {
|
|
5516
5552
|
component: text_default,
|
|
5517
|
-
...
|
|
5553
|
+
...componentInfo11
|
|
5518
5554
|
}, {
|
|
5519
5555
|
component: video_default,
|
|
5520
|
-
...
|
|
5556
|
+
...componentInfo12
|
|
5557
|
+
}, {
|
|
5558
|
+
component: slot_default,
|
|
5559
|
+
...componentInfo9
|
|
5521
5560
|
}];
|
|
5522
5561
|
|
|
5523
5562
|
// src/functions/register-component.ts
|
|
@@ -5831,6 +5870,13 @@ async function fetchEntries(options) {
|
|
|
5831
5870
|
}
|
|
5832
5871
|
var getAllContent = fetchEntries;
|
|
5833
5872
|
|
|
5873
|
+
// src/functions/is-from-trusted-host.ts
|
|
5874
|
+
var DEFAULT_TRUSTED_HOSTS = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
|
|
5875
|
+
function isFromTrustedHost(trustedHosts, e) {
|
|
5876
|
+
const url = new URL(e.origin), hostname = url.hostname;
|
|
5877
|
+
return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
|
|
5878
|
+
}
|
|
5879
|
+
|
|
5834
5880
|
// src/functions/is-previewing.ts
|
|
5835
5881
|
function isPreviewing() {
|
|
5836
5882
|
if (!isBrowser()) {
|
|
@@ -6079,7 +6125,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
6079
6125
|
};
|
|
6080
6126
|
|
|
6081
6127
|
// src/constants/sdk-version.ts
|
|
6082
|
-
var SDK_VERSION = "0.12.
|
|
6128
|
+
var SDK_VERSION = "0.12.2";
|
|
6083
6129
|
|
|
6084
6130
|
// src/functions/register.ts
|
|
6085
6131
|
var registry = {};
|
|
@@ -6156,9 +6202,13 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
6156
6202
|
options
|
|
6157
6203
|
}
|
|
6158
6204
|
}, "*");
|
|
6159
|
-
window.addEventListener("message", ({
|
|
6160
|
-
|
|
6161
|
-
|
|
6205
|
+
window.addEventListener("message", (event) => {
|
|
6206
|
+
if (!isFromTrustedHost(options.trustedHosts, event)) {
|
|
6207
|
+
return;
|
|
6208
|
+
}
|
|
6209
|
+
const {
|
|
6210
|
+
data
|
|
6211
|
+
} = event;
|
|
6162
6212
|
if (!data?.type) {
|
|
6163
6213
|
return;
|
|
6164
6214
|
}
|
|
@@ -6256,6 +6306,9 @@ function EnableEditor(props) {
|
|
|
6256
6306
|
}));
|
|
6257
6307
|
}
|
|
6258
6308
|
function processMessage(event) {
|
|
6309
|
+
if (!isFromTrustedHost(props.trustedHosts, event)) {
|
|
6310
|
+
return;
|
|
6311
|
+
}
|
|
6259
6312
|
const { data } = event;
|
|
6260
6313
|
if (data) {
|
|
6261
6314
|
switch (data.type) {
|
|
@@ -6386,6 +6439,9 @@ function EnableEditor(props) {
|
|
|
6386
6439
|
} : {},
|
|
6387
6440
|
...props.enrich ? {
|
|
6388
6441
|
enrich: props.enrich
|
|
6442
|
+
} : {},
|
|
6443
|
+
...props.trustedHosts ? {
|
|
6444
|
+
trustedHosts: props.trustedHosts
|
|
6389
6445
|
} : {}
|
|
6390
6446
|
});
|
|
6391
6447
|
Object.values(
|
|
@@ -6724,6 +6780,7 @@ function ContentComponent(props) {
|
|
|
6724
6780
|
builderContextSignal={builderContextSignal()}
|
|
6725
6781
|
contentWrapper={props.contentWrapper}
|
|
6726
6782
|
contentWrapperProps={props.contentWrapperProps}
|
|
6783
|
+
trustedHosts={props.trustedHosts}
|
|
6727
6784
|
{...{
|
|
6728
6785
|
setBuilderContextSignal
|
|
6729
6786
|
}}
|
|
@@ -6806,6 +6863,7 @@ function ContentVariants(props) {
|
|
|
6806
6863
|
blocksWrapperProps={props.blocksWrapperProps}
|
|
6807
6864
|
contentWrapper={props.contentWrapper}
|
|
6808
6865
|
contentWrapperProps={props.contentWrapperProps}
|
|
6866
|
+
trustedHosts={props.trustedHosts}
|
|
6809
6867
|
/>;
|
|
6810
6868
|
}}</For5>
|
|
6811
6869
|
</Show12>
|
|
@@ -6828,6 +6886,7 @@ function ContentVariants(props) {
|
|
|
6828
6886
|
blocksWrapperProps={props.blocksWrapperProps}
|
|
6829
6887
|
contentWrapper={props.contentWrapper}
|
|
6830
6888
|
contentWrapperProps={props.contentWrapperProps}
|
|
6889
|
+
trustedHosts={props.trustedHosts}
|
|
6831
6890
|
/>
|
|
6832
6891
|
</>;
|
|
6833
6892
|
}
|
|
@@ -6891,7 +6950,10 @@ function Symbol2(props) {
|
|
|
6891
6950
|
__isNestedRender={true}
|
|
6892
6951
|
apiVersion={props.builderContext.apiVersion}
|
|
6893
6952
|
apiKey={props.builderContext.apiKey}
|
|
6894
|
-
context={
|
|
6953
|
+
context={{
|
|
6954
|
+
...props.builderContext.context,
|
|
6955
|
+
symbolId: props.builderBlock?.id
|
|
6956
|
+
}}
|
|
6895
6957
|
customComponents={Object.values(props.builderComponents)}
|
|
6896
6958
|
data={{
|
|
6897
6959
|
...props.symbol?.data,
|