@builder.io/sdk-solid 0.12.1 → 0.12.3
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 +102 -69
- package/lib/browser/dev.jsx +107 -83
- package/lib/browser/index.js +102 -69
- package/lib/browser/index.jsx +107 -83
- package/lib/edge/dev.js +102 -69
- package/lib/edge/dev.jsx +107 -83
- package/lib/edge/index.js +102 -69
- package/lib/edge/index.jsx +107 -83
- package/lib/node/dev.js +102 -69
- package/lib/node/dev.jsx +107 -83
- package/lib/node/index.js +102 -69
- package/lib/node/index.jsx +107 -83
- package/package.json +1 -1
package/lib/edge/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponent, spread, mergeProps, insert, effect, setAttribute, className, style, template,
|
|
1
|
+
import { createComponent, spread, mergeProps, insert, effect, setAttribute, className, style, template, Dynamic, memo, use } from 'solid-js/web';
|
|
2
2
|
import { createContext, Show, useContext, For, createSignal, onMount, createEffect, on } from 'solid-js';
|
|
3
3
|
import { css } from 'solid-styled-components';
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
10
10
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
11
11
|
});
|
|
12
12
|
var _tmpl$ = /* @__PURE__ */ template(`<a>`);
|
|
13
|
-
var _tmpl$2 = /* @__PURE__ */ template(`<button>`);
|
|
13
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<button role=button>`);
|
|
14
14
|
function Button(props) {
|
|
15
15
|
return createComponent(Show, {
|
|
16
16
|
get fallback() {
|
|
@@ -18,9 +18,7 @@ function Button(props) {
|
|
|
18
18
|
const _el$2 = _tmpl$2();
|
|
19
19
|
spread(_el$2, mergeProps({
|
|
20
20
|
get ["class"]() {
|
|
21
|
-
return props.attributes.class
|
|
22
|
-
all: "unset"
|
|
23
|
-
});
|
|
21
|
+
return `builder-button ${props.attributes.class}`;
|
|
24
22
|
}
|
|
25
23
|
}, {}, () => props.attributes, {
|
|
26
24
|
get style() {
|
|
@@ -3486,10 +3484,6 @@ function getProcessedBlock({
|
|
|
3486
3484
|
}
|
|
3487
3485
|
|
|
3488
3486
|
// src/components/block/block.helpers.ts
|
|
3489
|
-
var EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
|
|
3490
|
-
var isEmptyHtmlElement = (tagName) => {
|
|
3491
|
-
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
|
|
3492
|
-
};
|
|
3493
3487
|
var getComponent = ({
|
|
3494
3488
|
block,
|
|
3495
3489
|
context,
|
|
@@ -3675,7 +3669,7 @@ function BlockStyles(props) {
|
|
|
3675
3669
|
}
|
|
3676
3670
|
return true;
|
|
3677
3671
|
}
|
|
3678
|
-
function
|
|
3672
|
+
function css4() {
|
|
3679
3673
|
const processedBlock = getProcessedBlock({
|
|
3680
3674
|
block: props.block,
|
|
3681
3675
|
localState: props.context.localState,
|
|
@@ -3712,12 +3706,12 @@ function BlockStyles(props) {
|
|
|
3712
3706
|
}
|
|
3713
3707
|
return createComponent(Show, {
|
|
3714
3708
|
get when() {
|
|
3715
|
-
return memo(() => !!(TARGET !== "reactNative" &&
|
|
3709
|
+
return memo(() => !!(TARGET !== "reactNative" && css4()))() && canShowBlock();
|
|
3716
3710
|
},
|
|
3717
3711
|
get children() {
|
|
3718
3712
|
return createComponent(inlined_styles_default, {
|
|
3719
3713
|
get styles() {
|
|
3720
|
-
return
|
|
3714
|
+
return css4();
|
|
3721
3715
|
}
|
|
3722
3716
|
});
|
|
3723
3717
|
}
|
|
@@ -3811,48 +3805,80 @@ function getStyleAttribute(style) {
|
|
|
3811
3805
|
}
|
|
3812
3806
|
}
|
|
3813
3807
|
|
|
3814
|
-
// src/components/
|
|
3815
|
-
|
|
3808
|
+
// src/components/dynamic-renderer/dynamic-renderer.helpers.ts
|
|
3809
|
+
var EMPTY_HTML_ELEMENTS = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]);
|
|
3810
|
+
var isEmptyElement = (tagName) => {
|
|
3811
|
+
return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.has(tagName.toLowerCase());
|
|
3812
|
+
};
|
|
3813
|
+
|
|
3814
|
+
// src/components/dynamic-renderer/dynamic-renderer.tsx
|
|
3815
|
+
function DynamicRenderer(props) {
|
|
3816
3816
|
return createComponent(Show, {
|
|
3817
3817
|
get fallback() {
|
|
3818
|
-
return createComponent(Dynamic, mergeProps(() =>
|
|
3819
|
-
block: props.block,
|
|
3820
|
-
context: props.context
|
|
3821
|
-
}), () => getBlockActions({
|
|
3822
|
-
block: props.block,
|
|
3823
|
-
rootState: props.context.rootState,
|
|
3824
|
-
rootSetState: props.context.rootSetState,
|
|
3825
|
-
localState: props.context.localState,
|
|
3826
|
-
context: props.context.context,
|
|
3827
|
-
stripPrefix: true
|
|
3828
|
-
}), {
|
|
3818
|
+
return createComponent(Dynamic, mergeProps(() => props.attributes, () => props.actionAttributes, {
|
|
3829
3819
|
get component() {
|
|
3830
|
-
return props.
|
|
3820
|
+
return props.TagName;
|
|
3831
3821
|
}
|
|
3832
3822
|
}));
|
|
3833
3823
|
},
|
|
3834
3824
|
get when() {
|
|
3835
|
-
return props.
|
|
3825
|
+
return !isEmptyElement(props.TagName);
|
|
3836
3826
|
},
|
|
3837
3827
|
get children() {
|
|
3838
|
-
return createComponent(
|
|
3828
|
+
return createComponent(Show, {
|
|
3829
|
+
get fallback() {
|
|
3830
|
+
return createComponent(Dynamic, mergeProps(() => props.attributes, () => props.actionAttributes, {
|
|
3831
|
+
get component() {
|
|
3832
|
+
return props.TagName;
|
|
3833
|
+
},
|
|
3834
|
+
get children() {
|
|
3835
|
+
return props.children;
|
|
3836
|
+
}
|
|
3837
|
+
}));
|
|
3838
|
+
},
|
|
3839
|
+
get when() {
|
|
3840
|
+
return typeof props.TagName === "string";
|
|
3841
|
+
},
|
|
3842
|
+
get children() {
|
|
3843
|
+
return createComponent(Dynamic, mergeProps(() => props.attributes, () => props.actionAttributes, {
|
|
3844
|
+
get component() {
|
|
3845
|
+
return props.TagName;
|
|
3846
|
+
},
|
|
3847
|
+
get children() {
|
|
3848
|
+
return props.children;
|
|
3849
|
+
}
|
|
3850
|
+
}));
|
|
3851
|
+
}
|
|
3852
|
+
});
|
|
3853
|
+
}
|
|
3854
|
+
});
|
|
3855
|
+
}
|
|
3856
|
+
var dynamic_renderer_default = DynamicRenderer;
|
|
3857
|
+
|
|
3858
|
+
// src/components/block/components/block-wrapper.tsx
|
|
3859
|
+
function BlockWrapper(props) {
|
|
3860
|
+
return createComponent(dynamic_renderer_default, {
|
|
3861
|
+
get TagName() {
|
|
3862
|
+
return props.Wrapper;
|
|
3863
|
+
},
|
|
3864
|
+
get attributes() {
|
|
3865
|
+
return getBlockProperties({
|
|
3839
3866
|
block: props.block,
|
|
3840
3867
|
context: props.context
|
|
3841
|
-
})
|
|
3868
|
+
});
|
|
3869
|
+
},
|
|
3870
|
+
get actionAttributes() {
|
|
3871
|
+
return getBlockActions({
|
|
3842
3872
|
block: props.block,
|
|
3843
3873
|
rootState: props.context.rootState,
|
|
3844
3874
|
rootSetState: props.context.rootSetState,
|
|
3845
3875
|
localState: props.context.localState,
|
|
3846
3876
|
context: props.context.context,
|
|
3847
3877
|
stripPrefix: true
|
|
3848
|
-
})
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
get children() {
|
|
3853
|
-
return props.children;
|
|
3854
|
-
}
|
|
3855
|
-
}));
|
|
3878
|
+
});
|
|
3879
|
+
},
|
|
3880
|
+
get children() {
|
|
3881
|
+
return props.children;
|
|
3856
3882
|
}
|
|
3857
3883
|
});
|
|
3858
3884
|
}
|
|
@@ -4093,29 +4119,8 @@ function Block(props) {
|
|
|
4093
4119
|
return !blockComponent()?.noWrap;
|
|
4094
4120
|
},
|
|
4095
4121
|
get children() {
|
|
4096
|
-
return
|
|
4097
|
-
get
|
|
4098
|
-
return isEmptyHtmlElement(Tag());
|
|
4099
|
-
},
|
|
4100
|
-
get children() {
|
|
4101
|
-
return createComponent(block_wrapper_default, {
|
|
4102
|
-
get Wrapper() {
|
|
4103
|
-
return Tag();
|
|
4104
|
-
},
|
|
4105
|
-
get block() {
|
|
4106
|
-
return processedBlock();
|
|
4107
|
-
},
|
|
4108
|
-
get context() {
|
|
4109
|
-
return props.context;
|
|
4110
|
-
},
|
|
4111
|
-
hasChildren: false
|
|
4112
|
-
});
|
|
4113
|
-
}
|
|
4114
|
-
}), createComponent(Show, {
|
|
4115
|
-
get when() {
|
|
4116
|
-
return memo(() => !!!isEmptyHtmlElement(Tag()))() && repeatItem();
|
|
4117
|
-
},
|
|
4118
|
-
get children() {
|
|
4122
|
+
return createComponent(Show, {
|
|
4123
|
+
get fallback() {
|
|
4119
4124
|
return createComponent(For, {
|
|
4120
4125
|
get each() {
|
|
4121
4126
|
return repeatItem();
|
|
@@ -4136,10 +4141,9 @@ function Block(props) {
|
|
|
4136
4141
|
});
|
|
4137
4142
|
}
|
|
4138
4143
|
});
|
|
4139
|
-
}
|
|
4140
|
-
}), createComponent(Show, {
|
|
4144
|
+
},
|
|
4141
4145
|
get when() {
|
|
4142
|
-
return
|
|
4146
|
+
return !repeatItem();
|
|
4143
4147
|
},
|
|
4144
4148
|
get children() {
|
|
4145
4149
|
return createComponent(block_wrapper_default, {
|
|
@@ -4152,7 +4156,6 @@ function Block(props) {
|
|
|
4152
4156
|
get context() {
|
|
4153
4157
|
return props.context;
|
|
4154
4158
|
},
|
|
4155
|
-
hasChildren: true,
|
|
4156
4159
|
get children() {
|
|
4157
4160
|
return [createComponent(component_ref_default, {
|
|
4158
4161
|
get componentRef() {
|
|
@@ -4202,7 +4205,7 @@ function Block(props) {
|
|
|
4202
4205
|
}
|
|
4203
4206
|
});
|
|
4204
4207
|
}
|
|
4205
|
-
})
|
|
4208
|
+
});
|
|
4206
4209
|
}
|
|
4207
4210
|
})];
|
|
4208
4211
|
}
|
|
@@ -6197,6 +6200,13 @@ async function fetchEntries(options) {
|
|
|
6197
6200
|
}
|
|
6198
6201
|
var getAllContent = fetchEntries;
|
|
6199
6202
|
|
|
6203
|
+
// src/functions/is-from-trusted-host.ts
|
|
6204
|
+
var DEFAULT_TRUSTED_HOSTS = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
|
|
6205
|
+
function isFromTrustedHost(trustedHosts, e) {
|
|
6206
|
+
const url = new URL(e.origin), hostname = url.hostname;
|
|
6207
|
+
return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
|
|
6208
|
+
}
|
|
6209
|
+
|
|
6200
6210
|
// src/functions/is-previewing.ts
|
|
6201
6211
|
function isPreviewing() {
|
|
6202
6212
|
if (!isBrowser()) {
|
|
@@ -6448,7 +6458,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
6448
6458
|
};
|
|
6449
6459
|
|
|
6450
6460
|
// src/constants/sdk-version.ts
|
|
6451
|
-
var SDK_VERSION = "0.12.
|
|
6461
|
+
var SDK_VERSION = "0.12.3";
|
|
6452
6462
|
|
|
6453
6463
|
// src/functions/register.ts
|
|
6454
6464
|
var registry = {};
|
|
@@ -6526,9 +6536,13 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
6526
6536
|
options
|
|
6527
6537
|
}
|
|
6528
6538
|
}, "*");
|
|
6529
|
-
window.addEventListener("message", ({
|
|
6530
|
-
|
|
6531
|
-
|
|
6539
|
+
window.addEventListener("message", (event) => {
|
|
6540
|
+
if (!isFromTrustedHost(options.trustedHosts, event)) {
|
|
6541
|
+
return;
|
|
6542
|
+
}
|
|
6543
|
+
const {
|
|
6544
|
+
data
|
|
6545
|
+
} = event;
|
|
6532
6546
|
if (!data?.type) {
|
|
6533
6547
|
return;
|
|
6534
6548
|
}
|
|
@@ -6624,6 +6638,9 @@ function EnableEditor(props) {
|
|
|
6624
6638
|
}));
|
|
6625
6639
|
}
|
|
6626
6640
|
function processMessage(event) {
|
|
6641
|
+
if (!isFromTrustedHost(props.trustedHosts, event)) {
|
|
6642
|
+
return;
|
|
6643
|
+
}
|
|
6627
6644
|
const {
|
|
6628
6645
|
data
|
|
6629
6646
|
} = event;
|
|
@@ -6755,6 +6772,9 @@ function EnableEditor(props) {
|
|
|
6755
6772
|
} : {},
|
|
6756
6773
|
...props.enrich ? {
|
|
6757
6774
|
enrich: props.enrich
|
|
6775
|
+
} : {},
|
|
6776
|
+
...props.trustedHosts ? {
|
|
6777
|
+
trustedHosts: props.trustedHosts
|
|
6758
6778
|
} : {}
|
|
6759
6779
|
});
|
|
6760
6780
|
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
@@ -6951,6 +6971,10 @@ ${getFontCss({
|
|
|
6951
6971
|
customFonts: props.customFonts
|
|
6952
6972
|
})}
|
|
6953
6973
|
|
|
6974
|
+
.builder-button {
|
|
6975
|
+
all: unset;
|
|
6976
|
+
}
|
|
6977
|
+
|
|
6954
6978
|
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
6955
6979
|
margin: 0;
|
|
6956
6980
|
}
|
|
@@ -7122,6 +7146,9 @@ function ContentComponent(props) {
|
|
|
7122
7146
|
},
|
|
7123
7147
|
get contentWrapperProps() {
|
|
7124
7148
|
return props.contentWrapperProps;
|
|
7149
|
+
},
|
|
7150
|
+
get trustedHosts() {
|
|
7151
|
+
return props.trustedHosts;
|
|
7125
7152
|
}
|
|
7126
7153
|
}, {
|
|
7127
7154
|
setBuilderContextSignal
|
|
@@ -7281,6 +7308,9 @@ function ContentVariants(props) {
|
|
|
7281
7308
|
},
|
|
7282
7309
|
get contentWrapperProps() {
|
|
7283
7310
|
return props.contentWrapperProps;
|
|
7311
|
+
},
|
|
7312
|
+
get trustedHosts() {
|
|
7313
|
+
return props.trustedHosts;
|
|
7284
7314
|
}
|
|
7285
7315
|
});
|
|
7286
7316
|
}
|
|
@@ -7335,6 +7365,9 @@ function ContentVariants(props) {
|
|
|
7335
7365
|
},
|
|
7336
7366
|
get contentWrapperProps() {
|
|
7337
7367
|
return props.contentWrapperProps;
|
|
7368
|
+
},
|
|
7369
|
+
get trustedHosts() {
|
|
7370
|
+
return props.trustedHosts;
|
|
7338
7371
|
}
|
|
7339
7372
|
}))];
|
|
7340
7373
|
}
|