@builder.io/sdk-svelte 1.0.12 → 1.0.14
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/blocks/symbol/symbol.svelte +1 -1
- package/lib/browser/components/content/components/enable-editor.svelte +13 -23
- package/lib/browser/components/content/components/enable-editor.svelte.d.ts +1 -1
- package/lib/browser/components/content/components/styles.helpers.d.ts +1 -0
- package/lib/browser/components/content/components/styles.helpers.js +21 -0
- package/lib/browser/components/content/components/styles.svelte +3 -18
- package/lib/browser/components/content/components/styles.svelte.d.ts +2 -0
- package/lib/browser/components/content/content.svelte +2 -0
- package/lib/browser/components/content/content.svelte.d.ts +1 -0
- package/lib/browser/components/content/contentProps.types.d.ts +6 -1
- package/lib/browser/components/content-variants/content-variants.svelte +4 -2
- package/lib/browser/components/content-variants/content-variants.svelte.d.ts +2 -2
- package/lib/browser/constants/sdk-version.d.ts +1 -1
- package/lib/browser/constants/sdk-version.js +1 -1
- package/lib/edge/blocks/symbol/symbol.svelte +1 -1
- package/lib/edge/components/content/components/enable-editor.svelte +13 -23
- package/lib/edge/components/content/components/enable-editor.svelte.d.ts +1 -1
- package/lib/edge/components/content/components/styles.helpers.d.ts +1 -0
- package/lib/edge/components/content/components/styles.helpers.js +21 -0
- package/lib/edge/components/content/components/styles.svelte +3 -18
- package/lib/edge/components/content/components/styles.svelte.d.ts +2 -0
- package/lib/edge/components/content/content.svelte +2 -0
- package/lib/edge/components/content/content.svelte.d.ts +1 -0
- package/lib/edge/components/content/contentProps.types.d.ts +6 -1
- package/lib/edge/components/content-variants/content-variants.svelte +4 -2
- package/lib/edge/components/content-variants/content-variants.svelte.d.ts +2 -2
- package/lib/edge/constants/sdk-version.d.ts +1 -1
- package/lib/edge/constants/sdk-version.js +1 -1
- package/lib/node/blocks/symbol/symbol.svelte +1 -1
- package/lib/node/components/content/components/enable-editor.svelte +13 -23
- package/lib/node/components/content/components/enable-editor.svelte.d.ts +1 -1
- package/lib/node/components/content/components/styles.helpers.d.ts +1 -0
- package/lib/node/components/content/components/styles.helpers.js +21 -0
- package/lib/node/components/content/components/styles.svelte +3 -18
- package/lib/node/components/content/components/styles.svelte.d.ts +2 -0
- package/lib/node/components/content/content.svelte +2 -0
- package/lib/node/components/content/content.svelte.d.ts +1 -0
- package/lib/node/components/content/contentProps.types.d.ts +6 -1
- package/lib/node/components/content-variants/content-variants.svelte +4 -2
- package/lib/node/components/content-variants/content-variants.svelte.d.ts +2 -2
- package/lib/node/constants/sdk-version.d.ts +1 -1
- package/lib/node/constants/sdk-version.js +1 -1
- package/package.json +1 -1
- package/src/blocks/symbol/symbol.svelte +1 -1
- package/src/components/content/components/enable-editor.svelte +15 -26
- package/src/components/content/components/styles.helpers.ts +21 -0
- package/src/components/content/components/styles.svelte +4 -18
- package/src/components/content/content.svelte +2 -0
- package/src/components/content/contentProps.types.ts +6 -1
- package/src/components/content-variants/content-variants.svelte +5 -3
- package/src/constants/sdk-version.ts +1 -1
|
@@ -76,7 +76,6 @@ function processMessage(event) {
|
|
|
76
76
|
breakpoints,
|
|
77
77
|
},
|
|
78
78
|
});
|
|
79
|
-
forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
|
|
80
79
|
}
|
|
81
80
|
},
|
|
82
81
|
animation: (animation) => {
|
|
@@ -84,7 +83,6 @@ function processMessage(event) {
|
|
|
84
83
|
},
|
|
85
84
|
contentUpdate: (newContent) => {
|
|
86
85
|
mergeNewContent(newContent);
|
|
87
|
-
forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
|
|
88
86
|
},
|
|
89
87
|
},
|
|
90
88
|
})(event);
|
|
@@ -174,7 +172,6 @@ function emitStateUpdate() {
|
|
|
174
172
|
}
|
|
175
173
|
}
|
|
176
174
|
function elementRef_onIniteditingbldr(event) {
|
|
177
|
-
forceReRenderCount = forceReRenderCount + 1;
|
|
178
175
|
window.addEventListener("message", processMessage);
|
|
179
176
|
registerInsertMenu();
|
|
180
177
|
setupBrowserForEditing({
|
|
@@ -229,10 +226,6 @@ function elementRef_onInitpreviewingbldr(event) {
|
|
|
229
226
|
}
|
|
230
227
|
}
|
|
231
228
|
let elementRef;
|
|
232
|
-
let forceReRenderCount = 0;
|
|
233
|
-
let firstRender = true;
|
|
234
|
-
let lastUpdated = 0;
|
|
235
|
-
let shouldSendResetCookie = false;
|
|
236
229
|
let ContentWrapper = contentWrapper || "div";
|
|
237
230
|
let httpReqsData = {};
|
|
238
231
|
let clicked = false;
|
|
@@ -278,40 +271,38 @@ function onUpdateFn_0(..._args) {
|
|
|
278
271
|
}
|
|
279
272
|
}
|
|
280
273
|
$: onUpdateFn_0(...[content]);
|
|
281
|
-
function onUpdateFn_1(..._args) {
|
|
282
|
-
$: onUpdateFn_1(...[shouldSendResetCookie]);
|
|
283
|
-
function onUpdateFn_2(..._args) {
|
|
274
|
+
function onUpdateFn_1(..._args) {
|
|
284
275
|
evaluateJsCode();
|
|
285
276
|
}
|
|
286
|
-
$:
|
|
277
|
+
$: onUpdateFn_1_builderContextSignal_content__data__jsCode =
|
|
287
278
|
$builderContextSignal.content?.data?.jsCode;
|
|
288
|
-
$:
|
|
289
|
-
function
|
|
279
|
+
$: onUpdateFn_1(...[onUpdateFn_1_builderContextSignal_content__data__jsCode]);
|
|
280
|
+
function onUpdateFn_2(..._args) {
|
|
290
281
|
runHttpRequests();
|
|
291
282
|
}
|
|
292
|
-
$:
|
|
283
|
+
$: onUpdateFn_2_builderContextSignal_content__data__httpRequests =
|
|
293
284
|
$builderContextSignal.content?.data?.httpRequests;
|
|
294
|
-
$:
|
|
295
|
-
function
|
|
285
|
+
$: onUpdateFn_2(...[onUpdateFn_2_builderContextSignal_content__data__httpRequests]);
|
|
286
|
+
function onUpdateFn_3(..._args) {
|
|
296
287
|
emitStateUpdate();
|
|
297
288
|
}
|
|
298
|
-
$:
|
|
289
|
+
$: onUpdateFn_3_builderContextSignal_rootState =
|
|
299
290
|
$builderContextSignal.rootState;
|
|
300
|
-
$:
|
|
301
|
-
function
|
|
291
|
+
$: onUpdateFn_3(...[onUpdateFn_3_builderContextSignal_rootState]);
|
|
292
|
+
function onUpdateFn_4(..._args) {
|
|
302
293
|
if (data) {
|
|
303
294
|
mergeNewRootState(data);
|
|
304
295
|
}
|
|
305
296
|
}
|
|
306
|
-
$:
|
|
307
|
-
function
|
|
297
|
+
$: onUpdateFn_4(...[data]);
|
|
298
|
+
function onUpdateFn_5(..._args) {
|
|
308
299
|
if (locale) {
|
|
309
300
|
mergeNewRootState({
|
|
310
301
|
locale: locale,
|
|
311
302
|
});
|
|
312
303
|
}
|
|
313
304
|
}
|
|
314
|
-
$:
|
|
305
|
+
$: onUpdateFn_5(...[locale]);
|
|
315
306
|
setContext(builderContext.key, builderContextSignal);
|
|
316
307
|
onDestroy(() => {
|
|
317
308
|
if (isBrowser()) {
|
|
@@ -325,7 +316,6 @@ onDestroy(() => {
|
|
|
325
316
|
<svelte:element
|
|
326
317
|
this={ContentWrapper}
|
|
327
318
|
{...{}}
|
|
328
|
-
key={forceReRenderCount}
|
|
329
319
|
bind:this={elementRef}
|
|
330
320
|
on:click={(event) => {
|
|
331
321
|
onClick(event);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
type BuilderEditorProps = Omit<ContentProps, "customComponents" | "apiVersion" | "isSsrAbTest" | "blocksWrapper" | "blocksWrapperProps"> & {
|
|
2
|
+
type BuilderEditorProps = Omit<ContentProps, "customComponents" | "apiVersion" | "isSsrAbTest" | "blocksWrapper" | "blocksWrapperProps" | "isNestedRender"> & {
|
|
3
3
|
builderContextSignal: Writable<BuilderContextInterface>;
|
|
4
4
|
setBuilderContextSignal?: (signal: any) => any;
|
|
5
5
|
children?: any;
|
|
@@ -13,3 +13,4 @@ export declare const getCss: ({ cssCode, contentId }: {
|
|
|
13
13
|
cssCode?: string | undefined;
|
|
14
14
|
contentId?: string | undefined;
|
|
15
15
|
}) => string;
|
|
16
|
+
export declare const getDefaultStyles: (isNested: boolean | undefined) => "" | "\n.builder-button {\n all: unset;\n}\n\n.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {\n margin: 0;\n}\n.builder-text > p, .builder-text > .builder-paragraph {\n color: inherit;\n line-height: inherit;\n letter-spacing: inherit;\n font-weight: inherit;\n font-size: inherit;\n text-align: inherit;\n font-family: inherit;\n}\n";
|
|
@@ -56,3 +56,24 @@ export const getCss = ({ cssCode, contentId }) => {
|
|
|
56
56
|
// TODO: handle if '&' is within a string like `content: "&"`
|
|
57
57
|
return cssCode?.replace(/&/g, `div[builder-content-id="${contentId}"]`) || '';
|
|
58
58
|
};
|
|
59
|
+
const DEFAULT_STYLES = `
|
|
60
|
+
.builder-button {
|
|
61
|
+
all: unset;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
65
|
+
margin: 0;
|
|
66
|
+
}
|
|
67
|
+
.builder-text > p, .builder-text > .builder-paragraph {
|
|
68
|
+
color: inherit;
|
|
69
|
+
line-height: inherit;
|
|
70
|
+
letter-spacing: inherit;
|
|
71
|
+
font-weight: inherit;
|
|
72
|
+
font-size: inherit;
|
|
73
|
+
text-align: inherit;
|
|
74
|
+
font-family: inherit;
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
export const getDefaultStyles = (isNested) => {
|
|
78
|
+
return !isNested ? DEFAULT_STYLES : '';
|
|
79
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
3
|
<script>import InlinedStyles from "../../inlined-styles.svelte";
|
|
4
|
-
import { getCss, getFontCss } from "./styles.helpers.js";
|
|
4
|
+
import { getCss, getDefaultStyles, getFontCss } from "./styles.helpers.js";
|
|
5
5
|
export let cssCode = undefined;
|
|
6
6
|
export let contentId = undefined;
|
|
7
7
|
export let customFonts = undefined;
|
|
8
|
+
export let isNestedRender = undefined;
|
|
8
9
|
let injectedStyles = `
|
|
9
10
|
${getCss({
|
|
10
11
|
cssCode: cssCode,
|
|
@@ -13,23 +14,7 @@ ${getCss({
|
|
|
13
14
|
${getFontCss({
|
|
14
15
|
customFonts: customFonts,
|
|
15
16
|
})}
|
|
16
|
-
|
|
17
|
-
.builder-button {
|
|
18
|
-
all: unset;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
22
|
-
margin: 0;
|
|
23
|
-
}
|
|
24
|
-
.builder-text > p, .builder-text > .builder-paragraph {
|
|
25
|
-
color: inherit;
|
|
26
|
-
line-height: inherit;
|
|
27
|
-
letter-spacing: inherit;
|
|
28
|
-
font-weight: inherit;
|
|
29
|
-
font-size: inherit;
|
|
30
|
-
text-align: inherit;
|
|
31
|
-
font-family: inherit;
|
|
32
|
-
}
|
|
17
|
+
${getDefaultStyles(isNestedRender)}
|
|
33
18
|
`.trim();
|
|
34
19
|
</script>
|
|
35
20
|
|
|
@@ -3,6 +3,7 @@ interface Props {
|
|
|
3
3
|
cssCode?: string;
|
|
4
4
|
customFonts?: CustomFont[];
|
|
5
5
|
contentId?: string;
|
|
6
|
+
isNestedRender?: boolean;
|
|
6
7
|
}
|
|
7
8
|
import type { CustomFont } from "./styles.helpers.js";
|
|
8
9
|
declare const __propDef: {
|
|
@@ -10,6 +11,7 @@ declare const __propDef: {
|
|
|
10
11
|
cssCode?: Props["cssCode"];
|
|
11
12
|
contentId?: Props["contentId"];
|
|
12
13
|
customFonts?: Props["customFonts"];
|
|
14
|
+
isNestedRender?: Props["isNestedRender"];
|
|
13
15
|
};
|
|
14
16
|
events: {
|
|
15
17
|
[evt: string]: CustomEvent<any>;
|
|
@@ -29,6 +29,7 @@ export let contentWrapperProps = undefined;
|
|
|
29
29
|
export let linkComponent = undefined;
|
|
30
30
|
export let trustedHosts = undefined;
|
|
31
31
|
export let isSsrAbTest;
|
|
32
|
+
export let isNestedRender = undefined;
|
|
32
33
|
function contentSetState(newRootState) {
|
|
33
34
|
$builderContextSignal.rootState = newRootState;
|
|
34
35
|
}
|
|
@@ -101,6 +102,7 @@ setContext(ComponentsContext.key, {
|
|
|
101
102
|
{/if}
|
|
102
103
|
{#if TARGET !== "reactNative"}
|
|
103
104
|
<ContentStyles
|
|
105
|
+
{isNestedRender}
|
|
104
106
|
contentId={$builderContextSignal.content?.id}
|
|
105
107
|
cssCode={$builderContextSignal.content?.data?.cssCode}
|
|
106
108
|
customFonts={$builderContextSignal.content?.data?.customFonts}
|
|
@@ -20,6 +20,7 @@ declare const __propDef: {
|
|
|
20
20
|
linkComponent?: ContentProps["linkComponent"];
|
|
21
21
|
trustedHosts?: ContentProps["trustedHosts"];
|
|
22
22
|
isSsrAbTest: ContentProps["isSsrAbTest"];
|
|
23
|
+
isNestedRender?: ContentProps["isNestedRender"];
|
|
23
24
|
};
|
|
24
25
|
events: {
|
|
25
26
|
[evt: string]: CustomEvent<any>;
|
|
@@ -8,5 +8,10 @@ interface InternalRenderProps {
|
|
|
8
8
|
* This is in a separate file so that we can override it (most notably in Vue,
|
|
9
9
|
* where prop types cannot be wrapped by generics like `EnforcePartials`).
|
|
10
10
|
*/
|
|
11
|
-
export type ContentProps = InternalRenderProps & EnforcePartials<ContentVariantsPrps
|
|
11
|
+
export type ContentProps = InternalRenderProps & EnforcePartials<ContentVariantsPrps> & {
|
|
12
|
+
/**
|
|
13
|
+
* For internal use only. Do not provide this prop.
|
|
14
|
+
*/
|
|
15
|
+
isNestedRender?: boolean;
|
|
16
|
+
};
|
|
12
17
|
export {};
|
|
@@ -10,7 +10,7 @@ import InlinedStyles from "../inlined-styles.svelte";
|
|
|
10
10
|
import { checkShouldRenderVariants, getScriptString, getUpdateCookieAndStylesScript, getVariants, } from "./helpers.js";
|
|
11
11
|
export let canTrack = undefined;
|
|
12
12
|
export let content = undefined;
|
|
13
|
-
export let
|
|
13
|
+
export let isNestedRender = undefined;
|
|
14
14
|
export let model = undefined;
|
|
15
15
|
export let data = undefined;
|
|
16
16
|
export let context = undefined;
|
|
@@ -59,7 +59,7 @@ onMount(() => {
|
|
|
59
59
|
});
|
|
60
60
|
</script>
|
|
61
61
|
|
|
62
|
-
{#if !
|
|
62
|
+
{#if !isNestedRender && TARGET !== "reactNative"}
|
|
63
63
|
<InlinedScript scriptStr={getScriptString()} />
|
|
64
64
|
{/if}
|
|
65
65
|
|
|
@@ -72,6 +72,7 @@ onMount(() => {
|
|
|
72
72
|
|
|
73
73
|
{#each getVariants(content) as variant (variant.testVariationId)}
|
|
74
74
|
<ContentComponent
|
|
75
|
+
{isNestedRender}
|
|
75
76
|
content={variant}
|
|
76
77
|
showContent={false}
|
|
77
78
|
{model}
|
|
@@ -94,6 +95,7 @@ onMount(() => {
|
|
|
94
95
|
{/each}
|
|
95
96
|
{/if}
|
|
96
97
|
<ContentComponent
|
|
98
|
+
{isNestedRender}
|
|
97
99
|
{...{}}
|
|
98
100
|
content={defaultContent()}
|
|
99
101
|
showContent={true}
|
|
@@ -3,14 +3,14 @@ type VariantsProviderProps = ContentVariantsPrps & {
|
|
|
3
3
|
/**
|
|
4
4
|
* For internal use only. Do not provide this prop.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
isNestedRender?: boolean;
|
|
7
7
|
};
|
|
8
8
|
import type { ContentVariantsPrps } from "./content-variants.types.js";
|
|
9
9
|
declare const __propDef: {
|
|
10
10
|
props: {
|
|
11
11
|
canTrack?: VariantsProviderProps["canTrack"];
|
|
12
12
|
content?: VariantsProviderProps["content"];
|
|
13
|
-
|
|
13
|
+
isNestedRender?: VariantsProviderProps["isNestedRender"];
|
|
14
14
|
model?: VariantsProviderProps["model"];
|
|
15
15
|
data?: VariantsProviderProps["data"];
|
|
16
16
|
context?: VariantsProviderProps["context"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.0.
|
|
1
|
+
export declare const SDK_VERSION = "1.0.14";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "1.0.
|
|
1
|
+
export const SDK_VERSION = "1.0.14";
|
|
@@ -76,7 +76,6 @@ function processMessage(event) {
|
|
|
76
76
|
breakpoints,
|
|
77
77
|
},
|
|
78
78
|
});
|
|
79
|
-
forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
|
|
80
79
|
}
|
|
81
80
|
},
|
|
82
81
|
animation: (animation) => {
|
|
@@ -84,7 +83,6 @@ function processMessage(event) {
|
|
|
84
83
|
},
|
|
85
84
|
contentUpdate: (newContent) => {
|
|
86
85
|
mergeNewContent(newContent);
|
|
87
|
-
forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
|
|
88
86
|
},
|
|
89
87
|
},
|
|
90
88
|
})(event);
|
|
@@ -174,7 +172,6 @@ function emitStateUpdate() {
|
|
|
174
172
|
}
|
|
175
173
|
}
|
|
176
174
|
function elementRef_onIniteditingbldr(event) {
|
|
177
|
-
forceReRenderCount = forceReRenderCount + 1;
|
|
178
175
|
window.addEventListener("message", processMessage);
|
|
179
176
|
registerInsertMenu();
|
|
180
177
|
setupBrowserForEditing({
|
|
@@ -229,10 +226,6 @@ function elementRef_onInitpreviewingbldr(event) {
|
|
|
229
226
|
}
|
|
230
227
|
}
|
|
231
228
|
let elementRef;
|
|
232
|
-
let forceReRenderCount = 0;
|
|
233
|
-
let firstRender = true;
|
|
234
|
-
let lastUpdated = 0;
|
|
235
|
-
let shouldSendResetCookie = false;
|
|
236
229
|
let ContentWrapper = contentWrapper || "div";
|
|
237
230
|
let httpReqsData = {};
|
|
238
231
|
let clicked = false;
|
|
@@ -278,40 +271,38 @@ function onUpdateFn_0(..._args) {
|
|
|
278
271
|
}
|
|
279
272
|
}
|
|
280
273
|
$: onUpdateFn_0(...[content]);
|
|
281
|
-
function onUpdateFn_1(..._args) {
|
|
282
|
-
$: onUpdateFn_1(...[shouldSendResetCookie]);
|
|
283
|
-
function onUpdateFn_2(..._args) {
|
|
274
|
+
function onUpdateFn_1(..._args) {
|
|
284
275
|
evaluateJsCode();
|
|
285
276
|
}
|
|
286
|
-
$:
|
|
277
|
+
$: onUpdateFn_1_builderContextSignal_content__data__jsCode =
|
|
287
278
|
$builderContextSignal.content?.data?.jsCode;
|
|
288
|
-
$:
|
|
289
|
-
function
|
|
279
|
+
$: onUpdateFn_1(...[onUpdateFn_1_builderContextSignal_content__data__jsCode]);
|
|
280
|
+
function onUpdateFn_2(..._args) {
|
|
290
281
|
runHttpRequests();
|
|
291
282
|
}
|
|
292
|
-
$:
|
|
283
|
+
$: onUpdateFn_2_builderContextSignal_content__data__httpRequests =
|
|
293
284
|
$builderContextSignal.content?.data?.httpRequests;
|
|
294
|
-
$:
|
|
295
|
-
function
|
|
285
|
+
$: onUpdateFn_2(...[onUpdateFn_2_builderContextSignal_content__data__httpRequests]);
|
|
286
|
+
function onUpdateFn_3(..._args) {
|
|
296
287
|
emitStateUpdate();
|
|
297
288
|
}
|
|
298
|
-
$:
|
|
289
|
+
$: onUpdateFn_3_builderContextSignal_rootState =
|
|
299
290
|
$builderContextSignal.rootState;
|
|
300
|
-
$:
|
|
301
|
-
function
|
|
291
|
+
$: onUpdateFn_3(...[onUpdateFn_3_builderContextSignal_rootState]);
|
|
292
|
+
function onUpdateFn_4(..._args) {
|
|
302
293
|
if (data) {
|
|
303
294
|
mergeNewRootState(data);
|
|
304
295
|
}
|
|
305
296
|
}
|
|
306
|
-
$:
|
|
307
|
-
function
|
|
297
|
+
$: onUpdateFn_4(...[data]);
|
|
298
|
+
function onUpdateFn_5(..._args) {
|
|
308
299
|
if (locale) {
|
|
309
300
|
mergeNewRootState({
|
|
310
301
|
locale: locale,
|
|
311
302
|
});
|
|
312
303
|
}
|
|
313
304
|
}
|
|
314
|
-
$:
|
|
305
|
+
$: onUpdateFn_5(...[locale]);
|
|
315
306
|
setContext(builderContext.key, builderContextSignal);
|
|
316
307
|
onDestroy(() => {
|
|
317
308
|
if (isBrowser()) {
|
|
@@ -325,7 +316,6 @@ onDestroy(() => {
|
|
|
325
316
|
<svelte:element
|
|
326
317
|
this={ContentWrapper}
|
|
327
318
|
{...{}}
|
|
328
|
-
key={forceReRenderCount}
|
|
329
319
|
bind:this={elementRef}
|
|
330
320
|
on:click={(event) => {
|
|
331
321
|
onClick(event);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
type BuilderEditorProps = Omit<ContentProps, "customComponents" | "apiVersion" | "isSsrAbTest" | "blocksWrapper" | "blocksWrapperProps"> & {
|
|
2
|
+
type BuilderEditorProps = Omit<ContentProps, "customComponents" | "apiVersion" | "isSsrAbTest" | "blocksWrapper" | "blocksWrapperProps" | "isNestedRender"> & {
|
|
3
3
|
builderContextSignal: Writable<BuilderContextInterface>;
|
|
4
4
|
setBuilderContextSignal?: (signal: any) => any;
|
|
5
5
|
children?: any;
|
|
@@ -13,3 +13,4 @@ export declare const getCss: ({ cssCode, contentId }: {
|
|
|
13
13
|
cssCode?: string | undefined;
|
|
14
14
|
contentId?: string | undefined;
|
|
15
15
|
}) => string;
|
|
16
|
+
export declare const getDefaultStyles: (isNested: boolean | undefined) => "" | "\n.builder-button {\n all: unset;\n}\n\n.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {\n margin: 0;\n}\n.builder-text > p, .builder-text > .builder-paragraph {\n color: inherit;\n line-height: inherit;\n letter-spacing: inherit;\n font-weight: inherit;\n font-size: inherit;\n text-align: inherit;\n font-family: inherit;\n}\n";
|
|
@@ -56,3 +56,24 @@ export const getCss = ({ cssCode, contentId }) => {
|
|
|
56
56
|
// TODO: handle if '&' is within a string like `content: "&"`
|
|
57
57
|
return cssCode?.replace(/&/g, `div[builder-content-id="${contentId}"]`) || '';
|
|
58
58
|
};
|
|
59
|
+
const DEFAULT_STYLES = `
|
|
60
|
+
.builder-button {
|
|
61
|
+
all: unset;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
65
|
+
margin: 0;
|
|
66
|
+
}
|
|
67
|
+
.builder-text > p, .builder-text > .builder-paragraph {
|
|
68
|
+
color: inherit;
|
|
69
|
+
line-height: inherit;
|
|
70
|
+
letter-spacing: inherit;
|
|
71
|
+
font-weight: inherit;
|
|
72
|
+
font-size: inherit;
|
|
73
|
+
text-align: inherit;
|
|
74
|
+
font-family: inherit;
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
export const getDefaultStyles = (isNested) => {
|
|
78
|
+
return !isNested ? DEFAULT_STYLES : '';
|
|
79
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
3
|
<script>import InlinedStyles from "../../inlined-styles.svelte";
|
|
4
|
-
import { getCss, getFontCss } from "./styles.helpers.js";
|
|
4
|
+
import { getCss, getDefaultStyles, getFontCss } from "./styles.helpers.js";
|
|
5
5
|
export let cssCode = undefined;
|
|
6
6
|
export let contentId = undefined;
|
|
7
7
|
export let customFonts = undefined;
|
|
8
|
+
export let isNestedRender = undefined;
|
|
8
9
|
let injectedStyles = `
|
|
9
10
|
${getCss({
|
|
10
11
|
cssCode: cssCode,
|
|
@@ -13,23 +14,7 @@ ${getCss({
|
|
|
13
14
|
${getFontCss({
|
|
14
15
|
customFonts: customFonts,
|
|
15
16
|
})}
|
|
16
|
-
|
|
17
|
-
.builder-button {
|
|
18
|
-
all: unset;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
22
|
-
margin: 0;
|
|
23
|
-
}
|
|
24
|
-
.builder-text > p, .builder-text > .builder-paragraph {
|
|
25
|
-
color: inherit;
|
|
26
|
-
line-height: inherit;
|
|
27
|
-
letter-spacing: inherit;
|
|
28
|
-
font-weight: inherit;
|
|
29
|
-
font-size: inherit;
|
|
30
|
-
text-align: inherit;
|
|
31
|
-
font-family: inherit;
|
|
32
|
-
}
|
|
17
|
+
${getDefaultStyles(isNestedRender)}
|
|
33
18
|
`.trim();
|
|
34
19
|
</script>
|
|
35
20
|
|
|
@@ -3,6 +3,7 @@ interface Props {
|
|
|
3
3
|
cssCode?: string;
|
|
4
4
|
customFonts?: CustomFont[];
|
|
5
5
|
contentId?: string;
|
|
6
|
+
isNestedRender?: boolean;
|
|
6
7
|
}
|
|
7
8
|
import type { CustomFont } from "./styles.helpers.js";
|
|
8
9
|
declare const __propDef: {
|
|
@@ -10,6 +11,7 @@ declare const __propDef: {
|
|
|
10
11
|
cssCode?: Props["cssCode"];
|
|
11
12
|
contentId?: Props["contentId"];
|
|
12
13
|
customFonts?: Props["customFonts"];
|
|
14
|
+
isNestedRender?: Props["isNestedRender"];
|
|
13
15
|
};
|
|
14
16
|
events: {
|
|
15
17
|
[evt: string]: CustomEvent<any>;
|
|
@@ -29,6 +29,7 @@ export let contentWrapperProps = undefined;
|
|
|
29
29
|
export let linkComponent = undefined;
|
|
30
30
|
export let trustedHosts = undefined;
|
|
31
31
|
export let isSsrAbTest;
|
|
32
|
+
export let isNestedRender = undefined;
|
|
32
33
|
function contentSetState(newRootState) {
|
|
33
34
|
$builderContextSignal.rootState = newRootState;
|
|
34
35
|
}
|
|
@@ -101,6 +102,7 @@ setContext(ComponentsContext.key, {
|
|
|
101
102
|
{/if}
|
|
102
103
|
{#if TARGET !== "reactNative"}
|
|
103
104
|
<ContentStyles
|
|
105
|
+
{isNestedRender}
|
|
104
106
|
contentId={$builderContextSignal.content?.id}
|
|
105
107
|
cssCode={$builderContextSignal.content?.data?.cssCode}
|
|
106
108
|
customFonts={$builderContextSignal.content?.data?.customFonts}
|
|
@@ -20,6 +20,7 @@ declare const __propDef: {
|
|
|
20
20
|
linkComponent?: ContentProps["linkComponent"];
|
|
21
21
|
trustedHosts?: ContentProps["trustedHosts"];
|
|
22
22
|
isSsrAbTest: ContentProps["isSsrAbTest"];
|
|
23
|
+
isNestedRender?: ContentProps["isNestedRender"];
|
|
23
24
|
};
|
|
24
25
|
events: {
|
|
25
26
|
[evt: string]: CustomEvent<any>;
|
|
@@ -8,5 +8,10 @@ interface InternalRenderProps {
|
|
|
8
8
|
* This is in a separate file so that we can override it (most notably in Vue,
|
|
9
9
|
* where prop types cannot be wrapped by generics like `EnforcePartials`).
|
|
10
10
|
*/
|
|
11
|
-
export type ContentProps = InternalRenderProps & EnforcePartials<ContentVariantsPrps
|
|
11
|
+
export type ContentProps = InternalRenderProps & EnforcePartials<ContentVariantsPrps> & {
|
|
12
|
+
/**
|
|
13
|
+
* For internal use only. Do not provide this prop.
|
|
14
|
+
*/
|
|
15
|
+
isNestedRender?: boolean;
|
|
16
|
+
};
|
|
12
17
|
export {};
|
|
@@ -10,7 +10,7 @@ import InlinedStyles from "../inlined-styles.svelte";
|
|
|
10
10
|
import { checkShouldRenderVariants, getScriptString, getUpdateCookieAndStylesScript, getVariants, } from "./helpers.js";
|
|
11
11
|
export let canTrack = undefined;
|
|
12
12
|
export let content = undefined;
|
|
13
|
-
export let
|
|
13
|
+
export let isNestedRender = undefined;
|
|
14
14
|
export let model = undefined;
|
|
15
15
|
export let data = undefined;
|
|
16
16
|
export let context = undefined;
|
|
@@ -59,7 +59,7 @@ onMount(() => {
|
|
|
59
59
|
});
|
|
60
60
|
</script>
|
|
61
61
|
|
|
62
|
-
{#if !
|
|
62
|
+
{#if !isNestedRender && TARGET !== "reactNative"}
|
|
63
63
|
<InlinedScript scriptStr={getScriptString()} />
|
|
64
64
|
{/if}
|
|
65
65
|
|
|
@@ -72,6 +72,7 @@ onMount(() => {
|
|
|
72
72
|
|
|
73
73
|
{#each getVariants(content) as variant (variant.testVariationId)}
|
|
74
74
|
<ContentComponent
|
|
75
|
+
{isNestedRender}
|
|
75
76
|
content={variant}
|
|
76
77
|
showContent={false}
|
|
77
78
|
{model}
|
|
@@ -94,6 +95,7 @@ onMount(() => {
|
|
|
94
95
|
{/each}
|
|
95
96
|
{/if}
|
|
96
97
|
<ContentComponent
|
|
98
|
+
{isNestedRender}
|
|
97
99
|
{...{}}
|
|
98
100
|
content={defaultContent()}
|
|
99
101
|
showContent={true}
|
|
@@ -3,14 +3,14 @@ type VariantsProviderProps = ContentVariantsPrps & {
|
|
|
3
3
|
/**
|
|
4
4
|
* For internal use only. Do not provide this prop.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
isNestedRender?: boolean;
|
|
7
7
|
};
|
|
8
8
|
import type { ContentVariantsPrps } from "./content-variants.types.js";
|
|
9
9
|
declare const __propDef: {
|
|
10
10
|
props: {
|
|
11
11
|
canTrack?: VariantsProviderProps["canTrack"];
|
|
12
12
|
content?: VariantsProviderProps["content"];
|
|
13
|
-
|
|
13
|
+
isNestedRender?: VariantsProviderProps["isNestedRender"];
|
|
14
14
|
model?: VariantsProviderProps["model"];
|
|
15
15
|
data?: VariantsProviderProps["data"];
|
|
16
16
|
context?: VariantsProviderProps["context"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.0.
|
|
1
|
+
export declare const SDK_VERSION = "1.0.14";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "1.0.
|
|
1
|
+
export const SDK_VERSION = "1.0.14";
|
|
@@ -76,7 +76,6 @@ function processMessage(event) {
|
|
|
76
76
|
breakpoints,
|
|
77
77
|
},
|
|
78
78
|
});
|
|
79
|
-
forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
|
|
80
79
|
}
|
|
81
80
|
},
|
|
82
81
|
animation: (animation) => {
|
|
@@ -84,7 +83,6 @@ function processMessage(event) {
|
|
|
84
83
|
},
|
|
85
84
|
contentUpdate: (newContent) => {
|
|
86
85
|
mergeNewContent(newContent);
|
|
87
|
-
forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
|
|
88
86
|
},
|
|
89
87
|
},
|
|
90
88
|
})(event);
|
|
@@ -174,7 +172,6 @@ function emitStateUpdate() {
|
|
|
174
172
|
}
|
|
175
173
|
}
|
|
176
174
|
function elementRef_onIniteditingbldr(event) {
|
|
177
|
-
forceReRenderCount = forceReRenderCount + 1;
|
|
178
175
|
window.addEventListener("message", processMessage);
|
|
179
176
|
registerInsertMenu();
|
|
180
177
|
setupBrowserForEditing({
|
|
@@ -229,10 +226,6 @@ function elementRef_onInitpreviewingbldr(event) {
|
|
|
229
226
|
}
|
|
230
227
|
}
|
|
231
228
|
let elementRef;
|
|
232
|
-
let forceReRenderCount = 0;
|
|
233
|
-
let firstRender = true;
|
|
234
|
-
let lastUpdated = 0;
|
|
235
|
-
let shouldSendResetCookie = false;
|
|
236
229
|
let ContentWrapper = contentWrapper || "div";
|
|
237
230
|
let httpReqsData = {};
|
|
238
231
|
let clicked = false;
|
|
@@ -278,40 +271,38 @@ function onUpdateFn_0(..._args) {
|
|
|
278
271
|
}
|
|
279
272
|
}
|
|
280
273
|
$: onUpdateFn_0(...[content]);
|
|
281
|
-
function onUpdateFn_1(..._args) {
|
|
282
|
-
$: onUpdateFn_1(...[shouldSendResetCookie]);
|
|
283
|
-
function onUpdateFn_2(..._args) {
|
|
274
|
+
function onUpdateFn_1(..._args) {
|
|
284
275
|
evaluateJsCode();
|
|
285
276
|
}
|
|
286
|
-
$:
|
|
277
|
+
$: onUpdateFn_1_builderContextSignal_content__data__jsCode =
|
|
287
278
|
$builderContextSignal.content?.data?.jsCode;
|
|
288
|
-
$:
|
|
289
|
-
function
|
|
279
|
+
$: onUpdateFn_1(...[onUpdateFn_1_builderContextSignal_content__data__jsCode]);
|
|
280
|
+
function onUpdateFn_2(..._args) {
|
|
290
281
|
runHttpRequests();
|
|
291
282
|
}
|
|
292
|
-
$:
|
|
283
|
+
$: onUpdateFn_2_builderContextSignal_content__data__httpRequests =
|
|
293
284
|
$builderContextSignal.content?.data?.httpRequests;
|
|
294
|
-
$:
|
|
295
|
-
function
|
|
285
|
+
$: onUpdateFn_2(...[onUpdateFn_2_builderContextSignal_content__data__httpRequests]);
|
|
286
|
+
function onUpdateFn_3(..._args) {
|
|
296
287
|
emitStateUpdate();
|
|
297
288
|
}
|
|
298
|
-
$:
|
|
289
|
+
$: onUpdateFn_3_builderContextSignal_rootState =
|
|
299
290
|
$builderContextSignal.rootState;
|
|
300
|
-
$:
|
|
301
|
-
function
|
|
291
|
+
$: onUpdateFn_3(...[onUpdateFn_3_builderContextSignal_rootState]);
|
|
292
|
+
function onUpdateFn_4(..._args) {
|
|
302
293
|
if (data) {
|
|
303
294
|
mergeNewRootState(data);
|
|
304
295
|
}
|
|
305
296
|
}
|
|
306
|
-
$:
|
|
307
|
-
function
|
|
297
|
+
$: onUpdateFn_4(...[data]);
|
|
298
|
+
function onUpdateFn_5(..._args) {
|
|
308
299
|
if (locale) {
|
|
309
300
|
mergeNewRootState({
|
|
310
301
|
locale: locale,
|
|
311
302
|
});
|
|
312
303
|
}
|
|
313
304
|
}
|
|
314
|
-
$:
|
|
305
|
+
$: onUpdateFn_5(...[locale]);
|
|
315
306
|
setContext(builderContext.key, builderContextSignal);
|
|
316
307
|
onDestroy(() => {
|
|
317
308
|
if (isBrowser()) {
|
|
@@ -325,7 +316,6 @@ onDestroy(() => {
|
|
|
325
316
|
<svelte:element
|
|
326
317
|
this={ContentWrapper}
|
|
327
318
|
{...{}}
|
|
328
|
-
key={forceReRenderCount}
|
|
329
319
|
bind:this={elementRef}
|
|
330
320
|
on:click={(event) => {
|
|
331
321
|
onClick(event);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
-
type BuilderEditorProps = Omit<ContentProps, "customComponents" | "apiVersion" | "isSsrAbTest" | "blocksWrapper" | "blocksWrapperProps"> & {
|
|
2
|
+
type BuilderEditorProps = Omit<ContentProps, "customComponents" | "apiVersion" | "isSsrAbTest" | "blocksWrapper" | "blocksWrapperProps" | "isNestedRender"> & {
|
|
3
3
|
builderContextSignal: Writable<BuilderContextInterface>;
|
|
4
4
|
setBuilderContextSignal?: (signal: any) => any;
|
|
5
5
|
children?: any;
|
|
@@ -13,3 +13,4 @@ export declare const getCss: ({ cssCode, contentId }: {
|
|
|
13
13
|
cssCode?: string | undefined;
|
|
14
14
|
contentId?: string | undefined;
|
|
15
15
|
}) => string;
|
|
16
|
+
export declare const getDefaultStyles: (isNested: boolean | undefined) => "" | "\n.builder-button {\n all: unset;\n}\n\n.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {\n margin: 0;\n}\n.builder-text > p, .builder-text > .builder-paragraph {\n color: inherit;\n line-height: inherit;\n letter-spacing: inherit;\n font-weight: inherit;\n font-size: inherit;\n text-align: inherit;\n font-family: inherit;\n}\n";
|
|
@@ -56,3 +56,24 @@ export const getCss = ({ cssCode, contentId }) => {
|
|
|
56
56
|
// TODO: handle if '&' is within a string like `content: "&"`
|
|
57
57
|
return cssCode?.replace(/&/g, `div[builder-content-id="${contentId}"]`) || '';
|
|
58
58
|
};
|
|
59
|
+
const DEFAULT_STYLES = `
|
|
60
|
+
.builder-button {
|
|
61
|
+
all: unset;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
65
|
+
margin: 0;
|
|
66
|
+
}
|
|
67
|
+
.builder-text > p, .builder-text > .builder-paragraph {
|
|
68
|
+
color: inherit;
|
|
69
|
+
line-height: inherit;
|
|
70
|
+
letter-spacing: inherit;
|
|
71
|
+
font-weight: inherit;
|
|
72
|
+
font-size: inherit;
|
|
73
|
+
text-align: inherit;
|
|
74
|
+
font-family: inherit;
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
export const getDefaultStyles = (isNested) => {
|
|
78
|
+
return !isNested ? DEFAULT_STYLES : '';
|
|
79
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script context="module"></script>
|
|
2
2
|
|
|
3
3
|
<script>import InlinedStyles from "../../inlined-styles.svelte";
|
|
4
|
-
import { getCss, getFontCss } from "./styles.helpers.js";
|
|
4
|
+
import { getCss, getDefaultStyles, getFontCss } from "./styles.helpers.js";
|
|
5
5
|
export let cssCode = undefined;
|
|
6
6
|
export let contentId = undefined;
|
|
7
7
|
export let customFonts = undefined;
|
|
8
|
+
export let isNestedRender = undefined;
|
|
8
9
|
let injectedStyles = `
|
|
9
10
|
${getCss({
|
|
10
11
|
cssCode: cssCode,
|
|
@@ -13,23 +14,7 @@ ${getCss({
|
|
|
13
14
|
${getFontCss({
|
|
14
15
|
customFonts: customFonts,
|
|
15
16
|
})}
|
|
16
|
-
|
|
17
|
-
.builder-button {
|
|
18
|
-
all: unset;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
22
|
-
margin: 0;
|
|
23
|
-
}
|
|
24
|
-
.builder-text > p, .builder-text > .builder-paragraph {
|
|
25
|
-
color: inherit;
|
|
26
|
-
line-height: inherit;
|
|
27
|
-
letter-spacing: inherit;
|
|
28
|
-
font-weight: inherit;
|
|
29
|
-
font-size: inherit;
|
|
30
|
-
text-align: inherit;
|
|
31
|
-
font-family: inherit;
|
|
32
|
-
}
|
|
17
|
+
${getDefaultStyles(isNestedRender)}
|
|
33
18
|
`.trim();
|
|
34
19
|
</script>
|
|
35
20
|
|
|
@@ -3,6 +3,7 @@ interface Props {
|
|
|
3
3
|
cssCode?: string;
|
|
4
4
|
customFonts?: CustomFont[];
|
|
5
5
|
contentId?: string;
|
|
6
|
+
isNestedRender?: boolean;
|
|
6
7
|
}
|
|
7
8
|
import type { CustomFont } from "./styles.helpers.js";
|
|
8
9
|
declare const __propDef: {
|
|
@@ -10,6 +11,7 @@ declare const __propDef: {
|
|
|
10
11
|
cssCode?: Props["cssCode"];
|
|
11
12
|
contentId?: Props["contentId"];
|
|
12
13
|
customFonts?: Props["customFonts"];
|
|
14
|
+
isNestedRender?: Props["isNestedRender"];
|
|
13
15
|
};
|
|
14
16
|
events: {
|
|
15
17
|
[evt: string]: CustomEvent<any>;
|
|
@@ -29,6 +29,7 @@ export let contentWrapperProps = undefined;
|
|
|
29
29
|
export let linkComponent = undefined;
|
|
30
30
|
export let trustedHosts = undefined;
|
|
31
31
|
export let isSsrAbTest;
|
|
32
|
+
export let isNestedRender = undefined;
|
|
32
33
|
function contentSetState(newRootState) {
|
|
33
34
|
$builderContextSignal.rootState = newRootState;
|
|
34
35
|
}
|
|
@@ -101,6 +102,7 @@ setContext(ComponentsContext.key, {
|
|
|
101
102
|
{/if}
|
|
102
103
|
{#if TARGET !== "reactNative"}
|
|
103
104
|
<ContentStyles
|
|
105
|
+
{isNestedRender}
|
|
104
106
|
contentId={$builderContextSignal.content?.id}
|
|
105
107
|
cssCode={$builderContextSignal.content?.data?.cssCode}
|
|
106
108
|
customFonts={$builderContextSignal.content?.data?.customFonts}
|
|
@@ -20,6 +20,7 @@ declare const __propDef: {
|
|
|
20
20
|
linkComponent?: ContentProps["linkComponent"];
|
|
21
21
|
trustedHosts?: ContentProps["trustedHosts"];
|
|
22
22
|
isSsrAbTest: ContentProps["isSsrAbTest"];
|
|
23
|
+
isNestedRender?: ContentProps["isNestedRender"];
|
|
23
24
|
};
|
|
24
25
|
events: {
|
|
25
26
|
[evt: string]: CustomEvent<any>;
|
|
@@ -8,5 +8,10 @@ interface InternalRenderProps {
|
|
|
8
8
|
* This is in a separate file so that we can override it (most notably in Vue,
|
|
9
9
|
* where prop types cannot be wrapped by generics like `EnforcePartials`).
|
|
10
10
|
*/
|
|
11
|
-
export type ContentProps = InternalRenderProps & EnforcePartials<ContentVariantsPrps
|
|
11
|
+
export type ContentProps = InternalRenderProps & EnforcePartials<ContentVariantsPrps> & {
|
|
12
|
+
/**
|
|
13
|
+
* For internal use only. Do not provide this prop.
|
|
14
|
+
*/
|
|
15
|
+
isNestedRender?: boolean;
|
|
16
|
+
};
|
|
12
17
|
export {};
|
|
@@ -10,7 +10,7 @@ import InlinedStyles from "../inlined-styles.svelte";
|
|
|
10
10
|
import { checkShouldRenderVariants, getScriptString, getUpdateCookieAndStylesScript, getVariants, } from "./helpers.js";
|
|
11
11
|
export let canTrack = undefined;
|
|
12
12
|
export let content = undefined;
|
|
13
|
-
export let
|
|
13
|
+
export let isNestedRender = undefined;
|
|
14
14
|
export let model = undefined;
|
|
15
15
|
export let data = undefined;
|
|
16
16
|
export let context = undefined;
|
|
@@ -59,7 +59,7 @@ onMount(() => {
|
|
|
59
59
|
});
|
|
60
60
|
</script>
|
|
61
61
|
|
|
62
|
-
{#if !
|
|
62
|
+
{#if !isNestedRender && TARGET !== "reactNative"}
|
|
63
63
|
<InlinedScript scriptStr={getScriptString()} />
|
|
64
64
|
{/if}
|
|
65
65
|
|
|
@@ -72,6 +72,7 @@ onMount(() => {
|
|
|
72
72
|
|
|
73
73
|
{#each getVariants(content) as variant (variant.testVariationId)}
|
|
74
74
|
<ContentComponent
|
|
75
|
+
{isNestedRender}
|
|
75
76
|
content={variant}
|
|
76
77
|
showContent={false}
|
|
77
78
|
{model}
|
|
@@ -94,6 +95,7 @@ onMount(() => {
|
|
|
94
95
|
{/each}
|
|
95
96
|
{/if}
|
|
96
97
|
<ContentComponent
|
|
98
|
+
{isNestedRender}
|
|
97
99
|
{...{}}
|
|
98
100
|
content={defaultContent()}
|
|
99
101
|
showContent={true}
|
|
@@ -3,14 +3,14 @@ type VariantsProviderProps = ContentVariantsPrps & {
|
|
|
3
3
|
/**
|
|
4
4
|
* For internal use only. Do not provide this prop.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
isNestedRender?: boolean;
|
|
7
7
|
};
|
|
8
8
|
import type { ContentVariantsPrps } from "./content-variants.types.js";
|
|
9
9
|
declare const __propDef: {
|
|
10
10
|
props: {
|
|
11
11
|
canTrack?: VariantsProviderProps["canTrack"];
|
|
12
12
|
content?: VariantsProviderProps["content"];
|
|
13
|
-
|
|
13
|
+
isNestedRender?: VariantsProviderProps["isNestedRender"];
|
|
14
14
|
model?: VariantsProviderProps["model"];
|
|
15
15
|
data?: VariantsProviderProps["data"];
|
|
16
16
|
context?: VariantsProviderProps["context"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.0.
|
|
1
|
+
export declare const SDK_VERSION = "1.0.14";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "1.0.
|
|
1
|
+
export const SDK_VERSION = "1.0.14";
|
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
| "isSsrAbTest"
|
|
7
7
|
| "blocksWrapper"
|
|
8
8
|
| "blocksWrapperProps"
|
|
9
|
+
| "isNestedRender"
|
|
9
10
|
> & {
|
|
10
11
|
builderContextSignal: Writable<BuilderContextInterface>;
|
|
11
12
|
setBuilderContextSignal?: (signal: any) => any;
|
|
@@ -107,7 +108,6 @@
|
|
|
107
108
|
breakpoints,
|
|
108
109
|
},
|
|
109
110
|
});
|
|
110
|
-
forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
113
|
animation: (animation) => {
|
|
@@ -115,7 +115,6 @@
|
|
|
115
115
|
},
|
|
116
116
|
contentUpdate: (newContent) => {
|
|
117
117
|
mergeNewContent(newContent);
|
|
118
|
-
forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
|
|
119
118
|
},
|
|
120
119
|
},
|
|
121
120
|
})(event);
|
|
@@ -216,7 +215,6 @@
|
|
|
216
215
|
}
|
|
217
216
|
}
|
|
218
217
|
function elementRef_onIniteditingbldr(event) {
|
|
219
|
-
forceReRenderCount = forceReRenderCount + 1;
|
|
220
218
|
window.addEventListener("message", processMessage);
|
|
221
219
|
registerInsertMenu();
|
|
222
220
|
setupBrowserForEditing({
|
|
@@ -284,10 +282,6 @@
|
|
|
284
282
|
|
|
285
283
|
let elementRef;
|
|
286
284
|
|
|
287
|
-
let forceReRenderCount = 0;
|
|
288
|
-
let firstRender = true;
|
|
289
|
-
let lastUpdated = 0;
|
|
290
|
-
let shouldSendResetCookie = false;
|
|
291
285
|
let ContentWrapper = contentWrapper || "div";
|
|
292
286
|
let httpReqsData = {};
|
|
293
287
|
let clicked = false;
|
|
@@ -341,42 +335,38 @@
|
|
|
341
335
|
|
|
342
336
|
$: onUpdateFn_0(...[content]);
|
|
343
337
|
|
|
344
|
-
function onUpdateFn_1(..._args: any[]) {
|
|
345
|
-
|
|
346
|
-
$: onUpdateFn_1(...[shouldSendResetCookie]);
|
|
347
|
-
|
|
348
|
-
function onUpdateFn_2(..._args: any[]) {
|
|
338
|
+
function onUpdateFn_1(..._args: any[]) {
|
|
349
339
|
evaluateJsCode();
|
|
350
340
|
}
|
|
351
|
-
$:
|
|
341
|
+
$: onUpdateFn_1_builderContextSignal_content__data__jsCode =
|
|
352
342
|
$builderContextSignal.content?.data?.jsCode;
|
|
353
|
-
$:
|
|
343
|
+
$: onUpdateFn_1(...[onUpdateFn_1_builderContextSignal_content__data__jsCode]);
|
|
354
344
|
|
|
355
|
-
function
|
|
345
|
+
function onUpdateFn_2(..._args: any[]) {
|
|
356
346
|
runHttpRequests();
|
|
357
347
|
}
|
|
358
|
-
$:
|
|
348
|
+
$: onUpdateFn_2_builderContextSignal_content__data__httpRequests =
|
|
359
349
|
$builderContextSignal.content?.data?.httpRequests;
|
|
360
|
-
$:
|
|
361
|
-
...[
|
|
350
|
+
$: onUpdateFn_2(
|
|
351
|
+
...[onUpdateFn_2_builderContextSignal_content__data__httpRequests]
|
|
362
352
|
);
|
|
363
353
|
|
|
364
|
-
function
|
|
354
|
+
function onUpdateFn_3(..._args: any[]) {
|
|
365
355
|
emitStateUpdate();
|
|
366
356
|
}
|
|
367
|
-
$:
|
|
357
|
+
$: onUpdateFn_3_builderContextSignal_rootState =
|
|
368
358
|
$builderContextSignal.rootState;
|
|
369
|
-
$:
|
|
359
|
+
$: onUpdateFn_3(...[onUpdateFn_3_builderContextSignal_rootState]);
|
|
370
360
|
|
|
371
|
-
function
|
|
361
|
+
function onUpdateFn_4(..._args: any[]) {
|
|
372
362
|
if (data) {
|
|
373
363
|
mergeNewRootState(data);
|
|
374
364
|
}
|
|
375
365
|
}
|
|
376
366
|
|
|
377
|
-
$:
|
|
367
|
+
$: onUpdateFn_4(...[data]);
|
|
378
368
|
|
|
379
|
-
function
|
|
369
|
+
function onUpdateFn_5(..._args: any[]) {
|
|
380
370
|
if (locale) {
|
|
381
371
|
mergeNewRootState({
|
|
382
372
|
locale: locale,
|
|
@@ -384,7 +374,7 @@
|
|
|
384
374
|
}
|
|
385
375
|
}
|
|
386
376
|
|
|
387
|
-
$:
|
|
377
|
+
$: onUpdateFn_5(...[locale]);
|
|
388
378
|
|
|
389
379
|
setContext(builderContext.key, builderContextSignal);
|
|
390
380
|
|
|
@@ -403,7 +393,6 @@
|
|
|
403
393
|
<svelte:element
|
|
404
394
|
this={ContentWrapper}
|
|
405
395
|
{...{}}
|
|
406
|
-
key={forceReRenderCount}
|
|
407
396
|
bind:this={elementRef}
|
|
408
397
|
on:click={(event) => {
|
|
409
398
|
onClick(event);
|
|
@@ -74,4 +74,25 @@ export const getCss = ({
|
|
|
74
74
|
// E.g. `& .foobar { ... }` to scope CSS
|
|
75
75
|
// TODO: handle if '&' is within a string like `content: "&"`
|
|
76
76
|
return cssCode?.replace(/&/g, `div[builder-content-id="${contentId}"]`) || '';
|
|
77
|
+
};
|
|
78
|
+
const DEFAULT_STYLES = `
|
|
79
|
+
.builder-button {
|
|
80
|
+
all: unset;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
84
|
+
margin: 0;
|
|
85
|
+
}
|
|
86
|
+
.builder-text > p, .builder-text > .builder-paragraph {
|
|
87
|
+
color: inherit;
|
|
88
|
+
line-height: inherit;
|
|
89
|
+
letter-spacing: inherit;
|
|
90
|
+
font-weight: inherit;
|
|
91
|
+
font-size: inherit;
|
|
92
|
+
text-align: inherit;
|
|
93
|
+
font-family: inherit;
|
|
94
|
+
}
|
|
95
|
+
`;
|
|
96
|
+
export const getDefaultStyles = (isNested: boolean | undefined) => {
|
|
97
|
+
return !isNested ? DEFAULT_STYLES : '';
|
|
77
98
|
}
|
|
@@ -3,17 +3,19 @@
|
|
|
3
3
|
cssCode?: string;
|
|
4
4
|
customFonts?: CustomFont[];
|
|
5
5
|
contentId?: string;
|
|
6
|
+
isNestedRender?: boolean;
|
|
6
7
|
}
|
|
7
8
|
</script>
|
|
8
9
|
|
|
9
10
|
<script lang="ts">
|
|
10
11
|
import InlinedStyles from "../../inlined-styles.svelte";
|
|
11
12
|
import type { CustomFont } from "./styles.helpers.js";
|
|
12
|
-
import { getCss, getFontCss } from "./styles.helpers.js";
|
|
13
|
+
import { getCss, getDefaultStyles, getFontCss } from "./styles.helpers.js";
|
|
13
14
|
|
|
14
15
|
export let cssCode: Props["cssCode"] = undefined;
|
|
15
16
|
export let contentId: Props["contentId"] = undefined;
|
|
16
17
|
export let customFonts: Props["customFonts"] = undefined;
|
|
18
|
+
export let isNestedRender: Props["isNestedRender"] = undefined;
|
|
17
19
|
|
|
18
20
|
let injectedStyles = `
|
|
19
21
|
${getCss({
|
|
@@ -23,23 +25,7 @@ ${getCss({
|
|
|
23
25
|
${getFontCss({
|
|
24
26
|
customFonts: customFonts,
|
|
25
27
|
})}
|
|
26
|
-
|
|
27
|
-
.builder-button {
|
|
28
|
-
all: unset;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
32
|
-
margin: 0;
|
|
33
|
-
}
|
|
34
|
-
.builder-text > p, .builder-text > .builder-paragraph {
|
|
35
|
-
color: inherit;
|
|
36
|
-
line-height: inherit;
|
|
37
|
-
letter-spacing: inherit;
|
|
38
|
-
font-weight: inherit;
|
|
39
|
-
font-size: inherit;
|
|
40
|
-
text-align: inherit;
|
|
41
|
-
font-family: inherit;
|
|
42
|
-
}
|
|
28
|
+
${getDefaultStyles(isNestedRender)}
|
|
43
29
|
`.trim();
|
|
44
30
|
</script>
|
|
45
31
|
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
export let linkComponent: ContentProps["linkComponent"] = undefined;
|
|
45
45
|
export let trustedHosts: ContentProps["trustedHosts"] = undefined;
|
|
46
46
|
export let isSsrAbTest: ContentProps["isSsrAbTest"];
|
|
47
|
+
export let isNestedRender: ContentProps["isNestedRender"] = undefined;
|
|
47
48
|
|
|
48
49
|
function contentSetState(newRootState: BuilderRenderState) {
|
|
49
50
|
$builderContextSignal.rootState = newRootState;
|
|
@@ -125,6 +126,7 @@
|
|
|
125
126
|
{/if}
|
|
126
127
|
{#if TARGET !== "reactNative"}
|
|
127
128
|
<ContentStyles
|
|
129
|
+
{isNestedRender}
|
|
128
130
|
contentId={$builderContextSignal.content?.id}
|
|
129
131
|
cssCode={$builderContextSignal.content?.data?.cssCode}
|
|
130
132
|
customFonts={$builderContextSignal.content?.data?.customFonts}
|
|
@@ -9,4 +9,9 @@ interface InternalRenderProps {
|
|
|
9
9
|
* This is in a separate file so that we can override it (most notably in Vue,
|
|
10
10
|
* where prop types cannot be wrapped by generics like `EnforcePartials`).
|
|
11
11
|
*/
|
|
12
|
-
export type ContentProps = InternalRenderProps & EnforcePartials<ContentVariantsPrps>
|
|
12
|
+
export type ContentProps = InternalRenderProps & EnforcePartials<ContentVariantsPrps> & {
|
|
13
|
+
/**
|
|
14
|
+
* For internal use only. Do not provide this prop.
|
|
15
|
+
*/
|
|
16
|
+
isNestedRender?: boolean;
|
|
17
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* For internal use only. Do not provide this prop.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
isNestedRender?: boolean;
|
|
7
7
|
};
|
|
8
8
|
</script>
|
|
9
9
|
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
export let canTrack: VariantsProviderProps["canTrack"] = undefined;
|
|
28
28
|
export let content: VariantsProviderProps["content"] = undefined;
|
|
29
|
-
export let
|
|
29
|
+
export let isNestedRender: VariantsProviderProps["isNestedRender"] =
|
|
30
30
|
undefined;
|
|
31
31
|
export let model: VariantsProviderProps["model"] = undefined;
|
|
32
32
|
export let data: VariantsProviderProps["data"] = undefined;
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
});
|
|
87
87
|
</script>
|
|
88
88
|
|
|
89
|
-
{#if !
|
|
89
|
+
{#if !isNestedRender && TARGET !== "reactNative"}
|
|
90
90
|
<InlinedScript scriptStr={getScriptString()} />
|
|
91
91
|
{/if}
|
|
92
92
|
|
|
@@ -99,6 +99,7 @@
|
|
|
99
99
|
|
|
100
100
|
{#each getVariants(content) as variant (variant.testVariationId)}
|
|
101
101
|
<ContentComponent
|
|
102
|
+
{isNestedRender}
|
|
102
103
|
content={variant}
|
|
103
104
|
showContent={false}
|
|
104
105
|
{model}
|
|
@@ -121,6 +122,7 @@
|
|
|
121
122
|
{/each}
|
|
122
123
|
{/if}
|
|
123
124
|
<ContentComponent
|
|
125
|
+
{isNestedRender}
|
|
124
126
|
{...{}}
|
|
125
127
|
content={defaultContent()}
|
|
126
128
|
showContent={true}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "1.0.
|
|
1
|
+
export const SDK_VERSION = "1.0.14"
|