@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/dev.jsx
CHANGED
|
@@ -3480,10 +3480,6 @@ function getProcessedBlock({
|
|
|
3480
3480
|
}
|
|
3481
3481
|
|
|
3482
3482
|
// src/components/block/block.helpers.ts
|
|
3483
|
-
var EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
|
|
3484
|
-
var isEmptyHtmlElement = (tagName) => {
|
|
3485
|
-
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
|
|
3486
|
-
};
|
|
3487
3483
|
var getComponent = ({
|
|
3488
3484
|
block,
|
|
3489
3485
|
context,
|
|
@@ -3708,10 +3704,6 @@ function BlockStyles(props) {
|
|
|
3708
3704
|
}
|
|
3709
3705
|
var Block_styles_default = BlockStyles;
|
|
3710
3706
|
|
|
3711
|
-
// src/components/block/components/block-wrapper.tsx
|
|
3712
|
-
import { Show as Show3 } from "solid-js";
|
|
3713
|
-
import { Dynamic } from "solid-js/web";
|
|
3714
|
-
|
|
3715
3707
|
// src/functions/event-handler-name.ts
|
|
3716
3708
|
function capitalizeFirstLetter(string) {
|
|
3717
3709
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
@@ -3798,31 +3790,49 @@ function getStyleAttribute(style) {
|
|
|
3798
3790
|
}
|
|
3799
3791
|
}
|
|
3800
3792
|
|
|
3801
|
-
// src/components/
|
|
3802
|
-
|
|
3793
|
+
// src/components/dynamic-renderer/dynamic-renderer.tsx
|
|
3794
|
+
import { Show as Show3 } from "solid-js";
|
|
3795
|
+
import { Dynamic } from "solid-js/web";
|
|
3796
|
+
|
|
3797
|
+
// src/components/dynamic-renderer/dynamic-renderer.helpers.ts
|
|
3798
|
+
var EMPTY_HTML_ELEMENTS = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]);
|
|
3799
|
+
var isEmptyElement = (tagName) => {
|
|
3800
|
+
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.has(tagName.toLowerCase());
|
|
3801
|
+
};
|
|
3802
|
+
|
|
3803
|
+
// src/components/dynamic-renderer/dynamic-renderer.tsx
|
|
3804
|
+
function DynamicRenderer(props) {
|
|
3803
3805
|
return <Show3
|
|
3804
3806
|
fallback={<Dynamic
|
|
3805
|
-
{...
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
})}
|
|
3809
|
-
{...getBlockActions({
|
|
3810
|
-
block: props.block,
|
|
3811
|
-
rootState: props.context.rootState,
|
|
3812
|
-
rootSetState: props.context.rootSetState,
|
|
3813
|
-
localState: props.context.localState,
|
|
3814
|
-
context: props.context.context,
|
|
3815
|
-
stripPrefix: true
|
|
3816
|
-
})}
|
|
3817
|
-
component={props.Wrapper}
|
|
3807
|
+
{...props.attributes}
|
|
3808
|
+
{...props.actionAttributes}
|
|
3809
|
+
component={props.TagName}
|
|
3818
3810
|
/>}
|
|
3819
|
-
when={props.
|
|
3811
|
+
when={!isEmptyElement(props.TagName)}
|
|
3812
|
+
><Show3
|
|
3813
|
+
fallback={<Dynamic
|
|
3814
|
+
{...props.attributes}
|
|
3815
|
+
{...props.actionAttributes}
|
|
3816
|
+
component={props.TagName}
|
|
3817
|
+
>{props.children}</Dynamic>}
|
|
3818
|
+
when={typeof props.TagName === "string"}
|
|
3820
3819
|
><Dynamic
|
|
3821
|
-
{...
|
|
3820
|
+
{...props.attributes}
|
|
3821
|
+
{...props.actionAttributes}
|
|
3822
|
+
component={props.TagName}
|
|
3823
|
+
>{props.children}</Dynamic></Show3></Show3>;
|
|
3824
|
+
}
|
|
3825
|
+
var Dynamic_renderer_default = DynamicRenderer;
|
|
3826
|
+
|
|
3827
|
+
// src/components/block/components/block-wrapper.tsx
|
|
3828
|
+
function BlockWrapper(props) {
|
|
3829
|
+
return <Dynamic_renderer_default
|
|
3830
|
+
TagName={props.Wrapper}
|
|
3831
|
+
attributes={getBlockProperties({
|
|
3822
3832
|
block: props.block,
|
|
3823
3833
|
context: props.context
|
|
3824
3834
|
})}
|
|
3825
|
-
{
|
|
3835
|
+
actionAttributes={getBlockActions({
|
|
3826
3836
|
block: props.block,
|
|
3827
3837
|
rootState: props.context.rootState,
|
|
3828
3838
|
rootSetState: props.context.rootSetState,
|
|
@@ -3830,8 +3840,7 @@ function BlockWrapper(props) {
|
|
|
3830
3840
|
context: props.context.context,
|
|
3831
3841
|
stripPrefix: true
|
|
3832
3842
|
})}
|
|
3833
|
-
|
|
3834
|
-
>{props.children}</Dynamic></Show3>;
|
|
3843
|
+
>{props.children}</Dynamic_renderer_default>;
|
|
3835
3844
|
}
|
|
3836
3845
|
var Block_wrapper_default = BlockWrapper;
|
|
3837
3846
|
|
|
@@ -4010,14 +4019,8 @@ function Block(props) {
|
|
|
4010
4019
|
isInteractive={componentRefProps().isInteractive}
|
|
4011
4020
|
/>}
|
|
4012
4021
|
when={!blockComponent()?.noWrap}
|
|
4013
|
-
|
|
4014
|
-
<
|
|
4015
|
-
Wrapper={Tag()}
|
|
4016
|
-
block={processedBlock()}
|
|
4017
|
-
context={props.context}
|
|
4018
|
-
hasChildren={false}
|
|
4019
|
-
/></Show5>
|
|
4020
|
-
<Show5 when={!isEmptyHtmlElement(Tag()) && repeatItem()}><For2 each={repeatItem()}>{(data, _index) => {
|
|
4022
|
+
><Show5
|
|
4023
|
+
fallback={<For2 each={repeatItem()}>{(data, _index) => {
|
|
4021
4024
|
const index = _index();
|
|
4022
4025
|
return <Repeated_block_default
|
|
4023
4026
|
key={index}
|
|
@@ -4025,34 +4028,33 @@ function Block(props) {
|
|
|
4025
4028
|
block={data.block}
|
|
4026
4029
|
registeredComponents={props.registeredComponents}
|
|
4027
4030
|
/>;
|
|
4028
|
-
}}</For2
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
</Show5>
|
|
4031
|
+
}}</For2>}
|
|
4032
|
+
when={!repeatItem()}
|
|
4033
|
+
><Block_wrapper_default
|
|
4034
|
+
Wrapper={Tag()}
|
|
4035
|
+
block={processedBlock()}
|
|
4036
|
+
context={props.context}
|
|
4037
|
+
>
|
|
4038
|
+
<Component_ref_default
|
|
4039
|
+
componentRef={componentRefProps().componentRef}
|
|
4040
|
+
componentOptions={componentRefProps().componentOptions}
|
|
4041
|
+
blockChildren={componentRefProps().blockChildren}
|
|
4042
|
+
context={componentRefProps().context}
|
|
4043
|
+
registeredComponents={componentRefProps().registeredComponents}
|
|
4044
|
+
builderBlock={componentRefProps().builderBlock}
|
|
4045
|
+
includeBlockProps={componentRefProps().includeBlockProps}
|
|
4046
|
+
isInteractive={componentRefProps().isInteractive}
|
|
4047
|
+
/>
|
|
4048
|
+
<For2 each={childrenWithoutParentComponent()}>{(child, _index) => {
|
|
4049
|
+
const index = _index();
|
|
4050
|
+
return <Block
|
|
4051
|
+
key={child.id}
|
|
4052
|
+
block={child}
|
|
4053
|
+
context={childrenContext()}
|
|
4054
|
+
registeredComponents={props.registeredComponents}
|
|
4055
|
+
/>;
|
|
4056
|
+
}}</For2>
|
|
4057
|
+
</Block_wrapper_default></Show5></Show5>
|
|
4056
4058
|
</Show5>;
|
|
4057
4059
|
}
|
|
4058
4060
|
var Block_default = Block;
|
|
@@ -5253,8 +5255,42 @@ var componentInfo8 = {
|
|
|
5253
5255
|
}]
|
|
5254
5256
|
};
|
|
5255
5257
|
|
|
5256
|
-
// src/blocks/
|
|
5258
|
+
// src/blocks/slot/component-info.ts
|
|
5257
5259
|
var componentInfo9 = {
|
|
5260
|
+
name: "Slot",
|
|
5261
|
+
isRSC: true,
|
|
5262
|
+
description: "Allow child blocks to be inserted into this content when used as a Symbol",
|
|
5263
|
+
docsLink: "https://www.builder.io/c/docs/symbols-with-blocks",
|
|
5264
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",
|
|
5265
|
+
// Maybe wrap this for canHaveChildren so bind children to this hm
|
|
5266
|
+
inputs: [{
|
|
5267
|
+
name: "name",
|
|
5268
|
+
type: "string",
|
|
5269
|
+
required: true,
|
|
5270
|
+
defaultValue: "children"
|
|
5271
|
+
}]
|
|
5272
|
+
};
|
|
5273
|
+
|
|
5274
|
+
// src/blocks/slot/slot.tsx
|
|
5275
|
+
function Slot(props) {
|
|
5276
|
+
return <div
|
|
5277
|
+
style={{
|
|
5278
|
+
"pointer-events": "auto"
|
|
5279
|
+
}}
|
|
5280
|
+
{...!props.builderContext.context?.symbolId && {
|
|
5281
|
+
"builder-slot": props.name
|
|
5282
|
+
}}
|
|
5283
|
+
><Blocks_default
|
|
5284
|
+
parent={props.builderContext.context?.symbolId}
|
|
5285
|
+
path={`symbol.data.${props.name}`}
|
|
5286
|
+
context={props.builderContext}
|
|
5287
|
+
blocks={props.builderContext.rootState?.[props.name]}
|
|
5288
|
+
/></div>;
|
|
5289
|
+
}
|
|
5290
|
+
var slot_default = Slot;
|
|
5291
|
+
|
|
5292
|
+
// src/blocks/symbol/component-info.ts
|
|
5293
|
+
var componentInfo10 = {
|
|
5258
5294
|
name: "Symbol",
|
|
5259
5295
|
noWrap: true,
|
|
5260
5296
|
static: true,
|
|
@@ -5290,7 +5326,7 @@ var componentInfo9 = {
|
|
|
5290
5326
|
};
|
|
5291
5327
|
|
|
5292
5328
|
// src/blocks/text/component-info.ts
|
|
5293
|
-
var
|
|
5329
|
+
var componentInfo11 = {
|
|
5294
5330
|
name: "Text",
|
|
5295
5331
|
static: true,
|
|
5296
5332
|
isRSC: true,
|
|
@@ -5323,7 +5359,7 @@ function Text(props) {
|
|
|
5323
5359
|
var text_default = Text;
|
|
5324
5360
|
|
|
5325
5361
|
// src/blocks/video/component-info.ts
|
|
5326
|
-
var
|
|
5362
|
+
var componentInfo12 = {
|
|
5327
5363
|
name: "Video",
|
|
5328
5364
|
canHaveChildren: true,
|
|
5329
5365
|
defaultStyles: {
|
|
@@ -5520,13 +5556,16 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
5520
5556
|
...componentInfo8
|
|
5521
5557
|
}, {
|
|
5522
5558
|
component: symbol_default,
|
|
5523
|
-
...
|
|
5559
|
+
...componentInfo10
|
|
5524
5560
|
}, {
|
|
5525
5561
|
component: text_default,
|
|
5526
|
-
...
|
|
5562
|
+
...componentInfo11
|
|
5527
5563
|
}, {
|
|
5528
5564
|
component: video_default,
|
|
5529
|
-
...
|
|
5565
|
+
...componentInfo12
|
|
5566
|
+
}, {
|
|
5567
|
+
component: slot_default,
|
|
5568
|
+
...componentInfo9
|
|
5530
5569
|
}];
|
|
5531
5570
|
|
|
5532
5571
|
// src/functions/register-component.ts
|
|
@@ -5842,6 +5881,13 @@ async function fetchEntries(options) {
|
|
|
5842
5881
|
}
|
|
5843
5882
|
var getAllContent = fetchEntries;
|
|
5844
5883
|
|
|
5884
|
+
// src/functions/is-from-trusted-host.ts
|
|
5885
|
+
var DEFAULT_TRUSTED_HOSTS = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
|
|
5886
|
+
function isFromTrustedHost(trustedHosts, e) {
|
|
5887
|
+
const url = new URL(e.origin), hostname = url.hostname;
|
|
5888
|
+
return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
|
|
5889
|
+
}
|
|
5890
|
+
|
|
5845
5891
|
// src/functions/is-previewing.ts
|
|
5846
5892
|
function isPreviewing() {
|
|
5847
5893
|
if (!isBrowser()) {
|
|
@@ -6093,7 +6139,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
6093
6139
|
};
|
|
6094
6140
|
|
|
6095
6141
|
// src/constants/sdk-version.ts
|
|
6096
|
-
var SDK_VERSION = "0.12.
|
|
6142
|
+
var SDK_VERSION = "0.12.2";
|
|
6097
6143
|
|
|
6098
6144
|
// src/functions/register.ts
|
|
6099
6145
|
var registry = {};
|
|
@@ -6171,9 +6217,13 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
6171
6217
|
options
|
|
6172
6218
|
}
|
|
6173
6219
|
}, "*");
|
|
6174
|
-
window.addEventListener("message", ({
|
|
6175
|
-
|
|
6176
|
-
|
|
6220
|
+
window.addEventListener("message", (event) => {
|
|
6221
|
+
if (!isFromTrustedHost(options.trustedHosts, event)) {
|
|
6222
|
+
return;
|
|
6223
|
+
}
|
|
6224
|
+
const {
|
|
6225
|
+
data
|
|
6226
|
+
} = event;
|
|
6177
6227
|
if (!data?.type) {
|
|
6178
6228
|
return;
|
|
6179
6229
|
}
|
|
@@ -6271,6 +6321,9 @@ function EnableEditor(props) {
|
|
|
6271
6321
|
}));
|
|
6272
6322
|
}
|
|
6273
6323
|
function processMessage(event) {
|
|
6324
|
+
if (!isFromTrustedHost(props.trustedHosts, event)) {
|
|
6325
|
+
return;
|
|
6326
|
+
}
|
|
6274
6327
|
const { data } = event;
|
|
6275
6328
|
if (data) {
|
|
6276
6329
|
switch (data.type) {
|
|
@@ -6402,6 +6455,9 @@ function EnableEditor(props) {
|
|
|
6402
6455
|
} : {},
|
|
6403
6456
|
...props.enrich ? {
|
|
6404
6457
|
enrich: props.enrich
|
|
6458
|
+
} : {},
|
|
6459
|
+
...props.trustedHosts ? {
|
|
6460
|
+
trustedHosts: props.trustedHosts
|
|
6405
6461
|
} : {}
|
|
6406
6462
|
});
|
|
6407
6463
|
Object.values(
|
|
@@ -6740,6 +6796,7 @@ function ContentComponent(props) {
|
|
|
6740
6796
|
builderContextSignal={builderContextSignal()}
|
|
6741
6797
|
contentWrapper={props.contentWrapper}
|
|
6742
6798
|
contentWrapperProps={props.contentWrapperProps}
|
|
6799
|
+
trustedHosts={props.trustedHosts}
|
|
6743
6800
|
{...{
|
|
6744
6801
|
setBuilderContextSignal
|
|
6745
6802
|
}}
|
|
@@ -6822,6 +6879,7 @@ function ContentVariants(props) {
|
|
|
6822
6879
|
blocksWrapperProps={props.blocksWrapperProps}
|
|
6823
6880
|
contentWrapper={props.contentWrapper}
|
|
6824
6881
|
contentWrapperProps={props.contentWrapperProps}
|
|
6882
|
+
trustedHosts={props.trustedHosts}
|
|
6825
6883
|
/>;
|
|
6826
6884
|
}}</For5>
|
|
6827
6885
|
</Show12>
|
|
@@ -6844,6 +6902,7 @@ function ContentVariants(props) {
|
|
|
6844
6902
|
blocksWrapperProps={props.blocksWrapperProps}
|
|
6845
6903
|
contentWrapper={props.contentWrapper}
|
|
6846
6904
|
contentWrapperProps={props.contentWrapperProps}
|
|
6905
|
+
trustedHosts={props.trustedHosts}
|
|
6847
6906
|
/>
|
|
6848
6907
|
</>;
|
|
6849
6908
|
}
|
|
@@ -6907,7 +6966,10 @@ function Symbol2(props) {
|
|
|
6907
6966
|
__isNestedRender={true}
|
|
6908
6967
|
apiVersion={props.builderContext.apiVersion}
|
|
6909
6968
|
apiKey={props.builderContext.apiKey}
|
|
6910
|
-
context={
|
|
6969
|
+
context={{
|
|
6970
|
+
...props.builderContext.context,
|
|
6971
|
+
symbolId: props.builderBlock?.id
|
|
6972
|
+
}}
|
|
6911
6973
|
customComponents={Object.values(props.builderComponents)}
|
|
6912
6974
|
data={{
|
|
6913
6975
|
...props.symbol?.data,
|