@builder.io/sdk-svelte 2.0.26 → 2.0.29
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/accordion/accordion.svelte +9 -7
- package/lib/browser/blocks/columns/columns.svelte +24 -16
- package/lib/browser/blocks/tabs/tabs.svelte +2 -2
- package/lib/browser/components/blocks/blocks-wrapper.svelte +11 -4
- package/lib/browser/constants/sdk-version.d.ts +1 -1
- package/lib/browser/constants/sdk-version.js +1 -1
- package/lib/browser/functions/evaluate/node-runtime/node-runtime.js +5 -4
- package/lib/browser/functions/evaluate/node-runtime/setIvm.d.ts +1 -0
- package/lib/browser/functions/evaluate/node-runtime/setIvm.js +1 -0
- package/lib/edge/blocks/accordion/accordion.svelte +9 -7
- package/lib/edge/blocks/columns/columns.svelte +24 -16
- package/lib/edge/blocks/tabs/tabs.svelte +2 -2
- package/lib/edge/components/blocks/blocks-wrapper.svelte +11 -4
- package/lib/edge/constants/sdk-version.d.ts +1 -1
- package/lib/edge/constants/sdk-version.js +1 -1
- package/lib/edge/functions/evaluate/node-runtime/node-runtime.js +5 -4
- package/lib/edge/functions/evaluate/node-runtime/setIvm.d.ts +1 -0
- package/lib/edge/functions/evaluate/node-runtime/setIvm.js +1 -0
- package/lib/node/blocks/accordion/accordion.svelte +9 -7
- package/lib/node/blocks/columns/columns.svelte +24 -16
- package/lib/node/blocks/tabs/tabs.svelte +2 -2
- package/lib/node/components/blocks/blocks-wrapper.svelte +11 -4
- package/lib/node/constants/sdk-version.d.ts +1 -1
- package/lib/node/constants/sdk-version.js +1 -1
- package/lib/node/functions/evaluate/node-runtime/node-runtime.js +5 -4
- package/lib/node/functions/evaluate/node-runtime/setIvm.d.ts +1 -0
- package/lib/node/functions/evaluate/node-runtime/setIvm.js +1 -0
- package/package.json +1 -1
- package/src/blocks/accordion/accordion.svelte +9 -7
- package/src/blocks/columns/columns.svelte +20 -14
- package/src/blocks/tabs/tabs.svelte +2 -2
- package/src/components/blocks/blocks-wrapper.svelte +11 -4
- package/src/constants/sdk-version.ts +1 -1
- package/src/functions/evaluate/node-runtime/node-runtime.ts +3 -3
- package/src/functions/evaluate/node-runtime/setIvm.ts +1 -0
|
@@ -117,13 +117,15 @@ let open = [];
|
|
|
117
117
|
<div
|
|
118
118
|
style={stringifyStyles({
|
|
119
119
|
...accordionTitleStyles(),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
...(grid && {
|
|
121
|
+
width: gridRowWidth,
|
|
122
|
+
...{
|
|
123
|
+
order:
|
|
124
|
+
openGridItemOrder() !== null
|
|
125
|
+
? convertOrderNumberToString(index)
|
|
126
|
+
: convertOrderNumberToString(index + 1),
|
|
127
|
+
},
|
|
128
|
+
}),
|
|
127
129
|
})}
|
|
128
130
|
class={getAccordionTitleClassName(index)}
|
|
129
131
|
data-index={index}
|
|
@@ -32,30 +32,30 @@ function getTagName(column) {
|
|
|
32
32
|
return column.link ? builderLinkComponent || "a" : "div";
|
|
33
33
|
}
|
|
34
34
|
function getWidth(index) {
|
|
35
|
-
return cols[index]?.width || 100 / cols.length;
|
|
35
|
+
return cols()[index]?.width || 100 / cols().length;
|
|
36
36
|
}
|
|
37
37
|
function getColumnCssWidth(index) {
|
|
38
38
|
const width = getWidth(index);
|
|
39
|
-
const subtractWidth = gutterSize * (cols.length - 1) * (width / 100);
|
|
39
|
+
const subtractWidth = gutterSize() * (cols().length - 1) * (width / 100);
|
|
40
40
|
return `calc(${width}% - ${subtractWidth}px)`;
|
|
41
41
|
}
|
|
42
42
|
function getTabletStyle({ stackedStyle, desktopStyle, }) {
|
|
43
|
-
return stackAt === "tablet" ? stackedStyle : desktopStyle;
|
|
43
|
+
return stackAt() === "tablet" ? stackedStyle : desktopStyle;
|
|
44
44
|
}
|
|
45
45
|
function getMobileStyle({ stackedStyle, desktopStyle, }) {
|
|
46
|
-
return stackAt === "never" ? desktopStyle : stackedStyle;
|
|
46
|
+
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
47
47
|
}
|
|
48
48
|
function columnsCssVars() {
|
|
49
49
|
return {
|
|
50
|
-
"--flex-dir": flexDir,
|
|
50
|
+
"--flex-dir": flexDir(),
|
|
51
51
|
"--flex-dir-tablet": getTabletStyle({
|
|
52
|
-
stackedStyle: flexDir,
|
|
52
|
+
stackedStyle: flexDir(),
|
|
53
53
|
desktopStyle: "row",
|
|
54
54
|
}),
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
function columnCssVars(index) {
|
|
58
|
-
const gutter = index === 0 ? 0 : gutterSize;
|
|
58
|
+
const gutter = index === 0 ? 0 : gutterSize();
|
|
59
59
|
const width = getColumnCssWidth(index);
|
|
60
60
|
const gutterPixels = `${gutter}px`;
|
|
61
61
|
const mobileWidth = "100%";
|
|
@@ -132,14 +132,22 @@ function getAttributes(column, index) {
|
|
|
132
132
|
style: mapStyleObjToStrIfNeeded(columnCssVars(index)),
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
$: gutterSize = () => {
|
|
136
|
+
return typeof space === "number" ? space || 0 : 20;
|
|
137
|
+
};
|
|
138
|
+
$: cols = () => {
|
|
139
|
+
return columns || [];
|
|
140
|
+
};
|
|
141
|
+
$: stackAt = () => {
|
|
142
|
+
return stackColumnsAt || "tablet";
|
|
143
|
+
};
|
|
144
|
+
$: flexDir = () => {
|
|
145
|
+
return stackColumnsAt === "never"
|
|
146
|
+
? "row"
|
|
147
|
+
: reverseColumnsWhenStacked
|
|
148
|
+
? "column-reverse"
|
|
149
|
+
: "column";
|
|
150
|
+
};
|
|
143
151
|
</script>
|
|
144
152
|
|
|
145
153
|
<div
|
|
@@ -160,7 +168,7 @@ let flexDir = stackColumnsAt === "never"
|
|
|
160
168
|
actionAttributes={{}}
|
|
161
169
|
attributes={getAttributes(column, index)}
|
|
162
170
|
><Blocks
|
|
163
|
-
path={`
|
|
171
|
+
path={`columns.${index}.blocks`}
|
|
164
172
|
parent={builderBlock.id}
|
|
165
173
|
styleProp={{
|
|
166
174
|
flexGrow: "1",
|
|
@@ -55,7 +55,7 @@ let activeTab = defaultActiveTab ? defaultActiveTab - 1 : 0;
|
|
|
55
55
|
}}
|
|
56
56
|
><Blocks
|
|
57
57
|
parent={builderBlock.id}
|
|
58
|
-
path={`
|
|
58
|
+
path={`tabs.${index}.label`}
|
|
59
59
|
blocks={tab.label}
|
|
60
60
|
context={builderContext}
|
|
61
61
|
registeredComponents={builderComponents}
|
|
@@ -68,7 +68,7 @@ let activeTab = defaultActiveTab ? defaultActiveTab - 1 : 0;
|
|
|
68
68
|
<div>
|
|
69
69
|
<Blocks
|
|
70
70
|
parent={builderBlock.id}
|
|
71
|
-
path={`
|
|
71
|
+
path={`tabs.${activeTab}.content`}
|
|
72
72
|
blocks={activeTabContent(activeTab)}
|
|
73
73
|
context={builderContext}
|
|
74
74
|
registeredComponents={builderComponents}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import { isEditing } from "../../functions/is-editing";
|
|
5
5
|
export let blocks;
|
|
6
6
|
export let classNameProp = undefined;
|
|
7
|
-
export let parent;
|
|
8
7
|
export let path;
|
|
8
|
+
export let parent;
|
|
9
9
|
export let styleProp;
|
|
10
10
|
export let BlocksWrapperProps;
|
|
11
11
|
export let BlocksWrapper;
|
|
@@ -25,7 +25,7 @@ function onClick() {
|
|
|
25
25
|
type: "builder.clickEmptyBlocks",
|
|
26
26
|
data: {
|
|
27
27
|
parentElementId: parent,
|
|
28
|
-
dataPath:
|
|
28
|
+
dataPath: dataPath(),
|
|
29
29
|
},
|
|
30
30
|
}, "*");
|
|
31
31
|
}
|
|
@@ -36,7 +36,7 @@ function onMouseEnter() {
|
|
|
36
36
|
type: "builder.hoverEmptyBlocks",
|
|
37
37
|
data: {
|
|
38
38
|
parentElementId: parent,
|
|
39
|
-
dataPath:
|
|
39
|
+
dataPath: dataPath(),
|
|
40
40
|
},
|
|
41
41
|
}, "*");
|
|
42
42
|
}
|
|
@@ -46,6 +46,13 @@ $: className = () => {
|
|
|
46
46
|
.filter(Boolean)
|
|
47
47
|
.join(" ");
|
|
48
48
|
};
|
|
49
|
+
$: dataPath = () => {
|
|
50
|
+
if (!path) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
const pathPrefix = "component.options.";
|
|
54
|
+
return path.startsWith(pathPrefix) ? path : `${pathPrefix}${path || ""}`;
|
|
55
|
+
};
|
|
49
56
|
let blocksWrapperRef;
|
|
50
57
|
onMount(() => { });
|
|
51
58
|
</script>
|
|
@@ -55,7 +62,7 @@ onMount(() => { });
|
|
|
55
62
|
style={stringifyStyles(styleProp)}
|
|
56
63
|
bind:this={blocksWrapperRef}
|
|
57
64
|
class={className() + " svelte-element"}
|
|
58
|
-
builder-path={
|
|
65
|
+
builder-path={dataPath()}
|
|
59
66
|
builder-parent-id={parent}
|
|
60
67
|
{...{}}
|
|
61
68
|
on:click={(event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.29";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.29";
|
|
@@ -63,6 +63,8 @@ let IVM_CONTEXT = null;
|
|
|
63
63
|
* `safeDynamicRequire` trick to import the `isolated-vm` package.
|
|
64
64
|
*/
|
|
65
65
|
export const setIvm = (ivm, options = {}) => {
|
|
66
|
+
if (IVM_INSTANCE)
|
|
67
|
+
return;
|
|
66
68
|
IVM_INSTANCE = ivm;
|
|
67
69
|
setIsolateContext(options);
|
|
68
70
|
};
|
|
@@ -92,6 +94,8 @@ const getIvm = () => {
|
|
|
92
94
|
function setIsolateContext(options = {
|
|
93
95
|
memoryLimit: 128
|
|
94
96
|
}) {
|
|
97
|
+
if (IVM_CONTEXT)
|
|
98
|
+
return IVM_CONTEXT;
|
|
95
99
|
const ivm = getIvm();
|
|
96
100
|
const isolate = new ivm.Isolate(options);
|
|
97
101
|
const context = isolate.createContextSync();
|
|
@@ -108,10 +112,7 @@ function setIsolateContext(options = {
|
|
|
108
112
|
return context;
|
|
109
113
|
}
|
|
110
114
|
const getIsolateContext = () => {
|
|
111
|
-
|
|
112
|
-
return IVM_CONTEXT;
|
|
113
|
-
const context = setIsolateContext();
|
|
114
|
-
return context;
|
|
115
|
+
return setIsolateContext();
|
|
115
116
|
};
|
|
116
117
|
export const runInNode = ({ code, builder, context, event, localState, rootSetState, rootState }) => {
|
|
117
118
|
const ivm = getIvm();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setIvm } from './node-runtime';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setIvm } from './node-runtime';
|
|
@@ -117,13 +117,15 @@ let open = [];
|
|
|
117
117
|
<div
|
|
118
118
|
style={stringifyStyles({
|
|
119
119
|
...accordionTitleStyles(),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
...(grid && {
|
|
121
|
+
width: gridRowWidth,
|
|
122
|
+
...{
|
|
123
|
+
order:
|
|
124
|
+
openGridItemOrder() !== null
|
|
125
|
+
? convertOrderNumberToString(index)
|
|
126
|
+
: convertOrderNumberToString(index + 1),
|
|
127
|
+
},
|
|
128
|
+
}),
|
|
127
129
|
})}
|
|
128
130
|
class={getAccordionTitleClassName(index)}
|
|
129
131
|
data-index={index}
|
|
@@ -32,30 +32,30 @@ function getTagName(column) {
|
|
|
32
32
|
return column.link ? builderLinkComponent || "a" : "div";
|
|
33
33
|
}
|
|
34
34
|
function getWidth(index) {
|
|
35
|
-
return cols[index]?.width || 100 / cols.length;
|
|
35
|
+
return cols()[index]?.width || 100 / cols().length;
|
|
36
36
|
}
|
|
37
37
|
function getColumnCssWidth(index) {
|
|
38
38
|
const width = getWidth(index);
|
|
39
|
-
const subtractWidth = gutterSize * (cols.length - 1) * (width / 100);
|
|
39
|
+
const subtractWidth = gutterSize() * (cols().length - 1) * (width / 100);
|
|
40
40
|
return `calc(${width}% - ${subtractWidth}px)`;
|
|
41
41
|
}
|
|
42
42
|
function getTabletStyle({ stackedStyle, desktopStyle, }) {
|
|
43
|
-
return stackAt === "tablet" ? stackedStyle : desktopStyle;
|
|
43
|
+
return stackAt() === "tablet" ? stackedStyle : desktopStyle;
|
|
44
44
|
}
|
|
45
45
|
function getMobileStyle({ stackedStyle, desktopStyle, }) {
|
|
46
|
-
return stackAt === "never" ? desktopStyle : stackedStyle;
|
|
46
|
+
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
47
47
|
}
|
|
48
48
|
function columnsCssVars() {
|
|
49
49
|
return {
|
|
50
|
-
"--flex-dir": flexDir,
|
|
50
|
+
"--flex-dir": flexDir(),
|
|
51
51
|
"--flex-dir-tablet": getTabletStyle({
|
|
52
|
-
stackedStyle: flexDir,
|
|
52
|
+
stackedStyle: flexDir(),
|
|
53
53
|
desktopStyle: "row",
|
|
54
54
|
}),
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
function columnCssVars(index) {
|
|
58
|
-
const gutter = index === 0 ? 0 : gutterSize;
|
|
58
|
+
const gutter = index === 0 ? 0 : gutterSize();
|
|
59
59
|
const width = getColumnCssWidth(index);
|
|
60
60
|
const gutterPixels = `${gutter}px`;
|
|
61
61
|
const mobileWidth = "100%";
|
|
@@ -132,14 +132,22 @@ function getAttributes(column, index) {
|
|
|
132
132
|
style: mapStyleObjToStrIfNeeded(columnCssVars(index)),
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
$: gutterSize = () => {
|
|
136
|
+
return typeof space === "number" ? space || 0 : 20;
|
|
137
|
+
};
|
|
138
|
+
$: cols = () => {
|
|
139
|
+
return columns || [];
|
|
140
|
+
};
|
|
141
|
+
$: stackAt = () => {
|
|
142
|
+
return stackColumnsAt || "tablet";
|
|
143
|
+
};
|
|
144
|
+
$: flexDir = () => {
|
|
145
|
+
return stackColumnsAt === "never"
|
|
146
|
+
? "row"
|
|
147
|
+
: reverseColumnsWhenStacked
|
|
148
|
+
? "column-reverse"
|
|
149
|
+
: "column";
|
|
150
|
+
};
|
|
143
151
|
</script>
|
|
144
152
|
|
|
145
153
|
<div
|
|
@@ -160,7 +168,7 @@ let flexDir = stackColumnsAt === "never"
|
|
|
160
168
|
actionAttributes={{}}
|
|
161
169
|
attributes={getAttributes(column, index)}
|
|
162
170
|
><Blocks
|
|
163
|
-
path={`
|
|
171
|
+
path={`columns.${index}.blocks`}
|
|
164
172
|
parent={builderBlock.id}
|
|
165
173
|
styleProp={{
|
|
166
174
|
flexGrow: "1",
|
|
@@ -55,7 +55,7 @@ let activeTab = defaultActiveTab ? defaultActiveTab - 1 : 0;
|
|
|
55
55
|
}}
|
|
56
56
|
><Blocks
|
|
57
57
|
parent={builderBlock.id}
|
|
58
|
-
path={`
|
|
58
|
+
path={`tabs.${index}.label`}
|
|
59
59
|
blocks={tab.label}
|
|
60
60
|
context={builderContext}
|
|
61
61
|
registeredComponents={builderComponents}
|
|
@@ -68,7 +68,7 @@ let activeTab = defaultActiveTab ? defaultActiveTab - 1 : 0;
|
|
|
68
68
|
<div>
|
|
69
69
|
<Blocks
|
|
70
70
|
parent={builderBlock.id}
|
|
71
|
-
path={`
|
|
71
|
+
path={`tabs.${activeTab}.content`}
|
|
72
72
|
blocks={activeTabContent(activeTab)}
|
|
73
73
|
context={builderContext}
|
|
74
74
|
registeredComponents={builderComponents}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import { isEditing } from "../../functions/is-editing";
|
|
5
5
|
export let blocks;
|
|
6
6
|
export let classNameProp = undefined;
|
|
7
|
-
export let parent;
|
|
8
7
|
export let path;
|
|
8
|
+
export let parent;
|
|
9
9
|
export let styleProp;
|
|
10
10
|
export let BlocksWrapperProps;
|
|
11
11
|
export let BlocksWrapper;
|
|
@@ -25,7 +25,7 @@ function onClick() {
|
|
|
25
25
|
type: "builder.clickEmptyBlocks",
|
|
26
26
|
data: {
|
|
27
27
|
parentElementId: parent,
|
|
28
|
-
dataPath:
|
|
28
|
+
dataPath: dataPath(),
|
|
29
29
|
},
|
|
30
30
|
}, "*");
|
|
31
31
|
}
|
|
@@ -36,7 +36,7 @@ function onMouseEnter() {
|
|
|
36
36
|
type: "builder.hoverEmptyBlocks",
|
|
37
37
|
data: {
|
|
38
38
|
parentElementId: parent,
|
|
39
|
-
dataPath:
|
|
39
|
+
dataPath: dataPath(),
|
|
40
40
|
},
|
|
41
41
|
}, "*");
|
|
42
42
|
}
|
|
@@ -46,6 +46,13 @@ $: className = () => {
|
|
|
46
46
|
.filter(Boolean)
|
|
47
47
|
.join(" ");
|
|
48
48
|
};
|
|
49
|
+
$: dataPath = () => {
|
|
50
|
+
if (!path) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
const pathPrefix = "component.options.";
|
|
54
|
+
return path.startsWith(pathPrefix) ? path : `${pathPrefix}${path || ""}`;
|
|
55
|
+
};
|
|
49
56
|
let blocksWrapperRef;
|
|
50
57
|
onMount(() => { });
|
|
51
58
|
</script>
|
|
@@ -55,7 +62,7 @@ onMount(() => { });
|
|
|
55
62
|
style={stringifyStyles(styleProp)}
|
|
56
63
|
bind:this={blocksWrapperRef}
|
|
57
64
|
class={className() + " svelte-element"}
|
|
58
|
-
builder-path={
|
|
65
|
+
builder-path={dataPath()}
|
|
59
66
|
builder-parent-id={parent}
|
|
60
67
|
{...{}}
|
|
61
68
|
on:click={(event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.29";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.29";
|
|
@@ -63,6 +63,8 @@ let IVM_CONTEXT = null;
|
|
|
63
63
|
* `safeDynamicRequire` trick to import the `isolated-vm` package.
|
|
64
64
|
*/
|
|
65
65
|
export const setIvm = (ivm, options = {}) => {
|
|
66
|
+
if (IVM_INSTANCE)
|
|
67
|
+
return;
|
|
66
68
|
IVM_INSTANCE = ivm;
|
|
67
69
|
setIsolateContext(options);
|
|
68
70
|
};
|
|
@@ -92,6 +94,8 @@ const getIvm = () => {
|
|
|
92
94
|
function setIsolateContext(options = {
|
|
93
95
|
memoryLimit: 128
|
|
94
96
|
}) {
|
|
97
|
+
if (IVM_CONTEXT)
|
|
98
|
+
return IVM_CONTEXT;
|
|
95
99
|
const ivm = getIvm();
|
|
96
100
|
const isolate = new ivm.Isolate(options);
|
|
97
101
|
const context = isolate.createContextSync();
|
|
@@ -108,10 +112,7 @@ function setIsolateContext(options = {
|
|
|
108
112
|
return context;
|
|
109
113
|
}
|
|
110
114
|
const getIsolateContext = () => {
|
|
111
|
-
|
|
112
|
-
return IVM_CONTEXT;
|
|
113
|
-
const context = setIsolateContext();
|
|
114
|
-
return context;
|
|
115
|
+
return setIsolateContext();
|
|
115
116
|
};
|
|
116
117
|
export const runInNode = ({ code, builder, context, event, localState, rootSetState, rootState }) => {
|
|
117
118
|
const ivm = getIvm();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setIvm } from './node-runtime';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setIvm } from './node-runtime';
|
|
@@ -117,13 +117,15 @@ let open = [];
|
|
|
117
117
|
<div
|
|
118
118
|
style={stringifyStyles({
|
|
119
119
|
...accordionTitleStyles(),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
...(grid && {
|
|
121
|
+
width: gridRowWidth,
|
|
122
|
+
...{
|
|
123
|
+
order:
|
|
124
|
+
openGridItemOrder() !== null
|
|
125
|
+
? convertOrderNumberToString(index)
|
|
126
|
+
: convertOrderNumberToString(index + 1),
|
|
127
|
+
},
|
|
128
|
+
}),
|
|
127
129
|
})}
|
|
128
130
|
class={getAccordionTitleClassName(index)}
|
|
129
131
|
data-index={index}
|
|
@@ -32,30 +32,30 @@ function getTagName(column) {
|
|
|
32
32
|
return column.link ? builderLinkComponent || "a" : "div";
|
|
33
33
|
}
|
|
34
34
|
function getWidth(index) {
|
|
35
|
-
return cols[index]?.width || 100 / cols.length;
|
|
35
|
+
return cols()[index]?.width || 100 / cols().length;
|
|
36
36
|
}
|
|
37
37
|
function getColumnCssWidth(index) {
|
|
38
38
|
const width = getWidth(index);
|
|
39
|
-
const subtractWidth = gutterSize * (cols.length - 1) * (width / 100);
|
|
39
|
+
const subtractWidth = gutterSize() * (cols().length - 1) * (width / 100);
|
|
40
40
|
return `calc(${width}% - ${subtractWidth}px)`;
|
|
41
41
|
}
|
|
42
42
|
function getTabletStyle({ stackedStyle, desktopStyle, }) {
|
|
43
|
-
return stackAt === "tablet" ? stackedStyle : desktopStyle;
|
|
43
|
+
return stackAt() === "tablet" ? stackedStyle : desktopStyle;
|
|
44
44
|
}
|
|
45
45
|
function getMobileStyle({ stackedStyle, desktopStyle, }) {
|
|
46
|
-
return stackAt === "never" ? desktopStyle : stackedStyle;
|
|
46
|
+
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
47
47
|
}
|
|
48
48
|
function columnsCssVars() {
|
|
49
49
|
return {
|
|
50
|
-
"--flex-dir": flexDir,
|
|
50
|
+
"--flex-dir": flexDir(),
|
|
51
51
|
"--flex-dir-tablet": getTabletStyle({
|
|
52
|
-
stackedStyle: flexDir,
|
|
52
|
+
stackedStyle: flexDir(),
|
|
53
53
|
desktopStyle: "row",
|
|
54
54
|
}),
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
function columnCssVars(index) {
|
|
58
|
-
const gutter = index === 0 ? 0 : gutterSize;
|
|
58
|
+
const gutter = index === 0 ? 0 : gutterSize();
|
|
59
59
|
const width = getColumnCssWidth(index);
|
|
60
60
|
const gutterPixels = `${gutter}px`;
|
|
61
61
|
const mobileWidth = "100%";
|
|
@@ -132,14 +132,22 @@ function getAttributes(column, index) {
|
|
|
132
132
|
style: mapStyleObjToStrIfNeeded(columnCssVars(index)),
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
$: gutterSize = () => {
|
|
136
|
+
return typeof space === "number" ? space || 0 : 20;
|
|
137
|
+
};
|
|
138
|
+
$: cols = () => {
|
|
139
|
+
return columns || [];
|
|
140
|
+
};
|
|
141
|
+
$: stackAt = () => {
|
|
142
|
+
return stackColumnsAt || "tablet";
|
|
143
|
+
};
|
|
144
|
+
$: flexDir = () => {
|
|
145
|
+
return stackColumnsAt === "never"
|
|
146
|
+
? "row"
|
|
147
|
+
: reverseColumnsWhenStacked
|
|
148
|
+
? "column-reverse"
|
|
149
|
+
: "column";
|
|
150
|
+
};
|
|
143
151
|
</script>
|
|
144
152
|
|
|
145
153
|
<div
|
|
@@ -160,7 +168,7 @@ let flexDir = stackColumnsAt === "never"
|
|
|
160
168
|
actionAttributes={{}}
|
|
161
169
|
attributes={getAttributes(column, index)}
|
|
162
170
|
><Blocks
|
|
163
|
-
path={`
|
|
171
|
+
path={`columns.${index}.blocks`}
|
|
164
172
|
parent={builderBlock.id}
|
|
165
173
|
styleProp={{
|
|
166
174
|
flexGrow: "1",
|
|
@@ -55,7 +55,7 @@ let activeTab = defaultActiveTab ? defaultActiveTab - 1 : 0;
|
|
|
55
55
|
}}
|
|
56
56
|
><Blocks
|
|
57
57
|
parent={builderBlock.id}
|
|
58
|
-
path={`
|
|
58
|
+
path={`tabs.${index}.label`}
|
|
59
59
|
blocks={tab.label}
|
|
60
60
|
context={builderContext}
|
|
61
61
|
registeredComponents={builderComponents}
|
|
@@ -68,7 +68,7 @@ let activeTab = defaultActiveTab ? defaultActiveTab - 1 : 0;
|
|
|
68
68
|
<div>
|
|
69
69
|
<Blocks
|
|
70
70
|
parent={builderBlock.id}
|
|
71
|
-
path={`
|
|
71
|
+
path={`tabs.${activeTab}.content`}
|
|
72
72
|
blocks={activeTabContent(activeTab)}
|
|
73
73
|
context={builderContext}
|
|
74
74
|
registeredComponents={builderComponents}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
import { isEditing } from "../../functions/is-editing";
|
|
5
5
|
export let blocks;
|
|
6
6
|
export let classNameProp = undefined;
|
|
7
|
-
export let parent;
|
|
8
7
|
export let path;
|
|
8
|
+
export let parent;
|
|
9
9
|
export let styleProp;
|
|
10
10
|
export let BlocksWrapperProps;
|
|
11
11
|
export let BlocksWrapper;
|
|
@@ -25,7 +25,7 @@ function onClick() {
|
|
|
25
25
|
type: "builder.clickEmptyBlocks",
|
|
26
26
|
data: {
|
|
27
27
|
parentElementId: parent,
|
|
28
|
-
dataPath:
|
|
28
|
+
dataPath: dataPath(),
|
|
29
29
|
},
|
|
30
30
|
}, "*");
|
|
31
31
|
}
|
|
@@ -36,7 +36,7 @@ function onMouseEnter() {
|
|
|
36
36
|
type: "builder.hoverEmptyBlocks",
|
|
37
37
|
data: {
|
|
38
38
|
parentElementId: parent,
|
|
39
|
-
dataPath:
|
|
39
|
+
dataPath: dataPath(),
|
|
40
40
|
},
|
|
41
41
|
}, "*");
|
|
42
42
|
}
|
|
@@ -46,6 +46,13 @@ $: className = () => {
|
|
|
46
46
|
.filter(Boolean)
|
|
47
47
|
.join(" ");
|
|
48
48
|
};
|
|
49
|
+
$: dataPath = () => {
|
|
50
|
+
if (!path) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
const pathPrefix = "component.options.";
|
|
54
|
+
return path.startsWith(pathPrefix) ? path : `${pathPrefix}${path || ""}`;
|
|
55
|
+
};
|
|
49
56
|
let blocksWrapperRef;
|
|
50
57
|
onMount(() => { });
|
|
51
58
|
</script>
|
|
@@ -55,7 +62,7 @@ onMount(() => { });
|
|
|
55
62
|
style={stringifyStyles(styleProp)}
|
|
56
63
|
bind:this={blocksWrapperRef}
|
|
57
64
|
class={className() + " svelte-element"}
|
|
58
|
-
builder-path={
|
|
65
|
+
builder-path={dataPath()}
|
|
59
66
|
builder-parent-id={parent}
|
|
60
67
|
{...{}}
|
|
61
68
|
on:click={(event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.29";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.29";
|
|
@@ -63,6 +63,8 @@ let IVM_CONTEXT = null;
|
|
|
63
63
|
* `safeDynamicRequire` trick to import the `isolated-vm` package.
|
|
64
64
|
*/
|
|
65
65
|
export const setIvm = (ivm, options = {}) => {
|
|
66
|
+
if (IVM_INSTANCE)
|
|
67
|
+
return;
|
|
66
68
|
IVM_INSTANCE = ivm;
|
|
67
69
|
setIsolateContext(options);
|
|
68
70
|
};
|
|
@@ -92,6 +94,8 @@ const getIvm = () => {
|
|
|
92
94
|
function setIsolateContext(options = {
|
|
93
95
|
memoryLimit: 128
|
|
94
96
|
}) {
|
|
97
|
+
if (IVM_CONTEXT)
|
|
98
|
+
return IVM_CONTEXT;
|
|
95
99
|
const ivm = getIvm();
|
|
96
100
|
const isolate = new ivm.Isolate(options);
|
|
97
101
|
const context = isolate.createContextSync();
|
|
@@ -108,10 +112,7 @@ function setIsolateContext(options = {
|
|
|
108
112
|
return context;
|
|
109
113
|
}
|
|
110
114
|
const getIsolateContext = () => {
|
|
111
|
-
|
|
112
|
-
return IVM_CONTEXT;
|
|
113
|
-
const context = setIsolateContext();
|
|
114
|
-
return context;
|
|
115
|
+
return setIsolateContext();
|
|
115
116
|
};
|
|
116
117
|
export const runInNode = ({ code, builder, context, event, localState, rootSetState, rootState }) => {
|
|
117
118
|
const ivm = getIvm();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setIvm } from './node-runtime';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setIvm } from './node-runtime';
|
package/package.json
CHANGED
|
@@ -154,13 +154,15 @@
|
|
|
154
154
|
<div
|
|
155
155
|
style={stringifyStyles({
|
|
156
156
|
...accordionTitleStyles(),
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
157
|
+
...(grid && {
|
|
158
|
+
width: gridRowWidth,
|
|
159
|
+
...{
|
|
160
|
+
order:
|
|
161
|
+
openGridItemOrder() !== null
|
|
162
|
+
? convertOrderNumberToString(index)
|
|
163
|
+
: convertOrderNumberToString(index + 1),
|
|
164
|
+
},
|
|
165
|
+
}),
|
|
164
166
|
})}
|
|
165
167
|
class={getAccordionTitleClassName(index)}
|
|
166
168
|
data-index={index}
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
return column.link ? builderLinkComponent || "a" : "div";
|
|
43
43
|
}
|
|
44
44
|
function getWidth(index: number) {
|
|
45
|
-
return cols[index]?.width || 100 / cols.length;
|
|
45
|
+
return cols()[index]?.width || 100 / cols().length;
|
|
46
46
|
}
|
|
47
47
|
function getColumnCssWidth(index: number) {
|
|
48
48
|
const width = getWidth(index);
|
|
49
|
-
const subtractWidth = gutterSize * (cols.length - 1) * (width / 100);
|
|
49
|
+
const subtractWidth = gutterSize() * (cols().length - 1) * (width / 100);
|
|
50
50
|
return `calc(${width}% - ${subtractWidth}px)`;
|
|
51
51
|
}
|
|
52
52
|
function getTabletStyle({
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
stackedStyle: CSSVal;
|
|
57
57
|
desktopStyle: CSSVal;
|
|
58
58
|
}) {
|
|
59
|
-
return stackAt === "tablet" ? stackedStyle : desktopStyle;
|
|
59
|
+
return stackAt() === "tablet" ? stackedStyle : desktopStyle;
|
|
60
60
|
}
|
|
61
61
|
function getMobileStyle({
|
|
62
62
|
stackedStyle,
|
|
@@ -65,19 +65,19 @@
|
|
|
65
65
|
stackedStyle: CSSVal;
|
|
66
66
|
desktopStyle: CSSVal;
|
|
67
67
|
}) {
|
|
68
|
-
return stackAt === "never" ? desktopStyle : stackedStyle;
|
|
68
|
+
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
69
69
|
}
|
|
70
70
|
function columnsCssVars() {
|
|
71
71
|
return {
|
|
72
|
-
"--flex-dir": flexDir,
|
|
72
|
+
"--flex-dir": flexDir(),
|
|
73
73
|
"--flex-dir-tablet": getTabletStyle({
|
|
74
|
-
stackedStyle: flexDir,
|
|
74
|
+
stackedStyle: flexDir(),
|
|
75
75
|
desktopStyle: "row",
|
|
76
76
|
}),
|
|
77
77
|
} as Dictionary<string>;
|
|
78
78
|
}
|
|
79
79
|
function columnCssVars(index: number) {
|
|
80
|
-
const gutter = index === 0 ? 0 : gutterSize;
|
|
80
|
+
const gutter = index === 0 ? 0 : gutterSize();
|
|
81
81
|
const width = getColumnCssWidth(index);
|
|
82
82
|
const gutterPixels = `${gutter}px`;
|
|
83
83
|
const mobileWidth = "100%";
|
|
@@ -156,16 +156,22 @@
|
|
|
156
156
|
style: mapStyleObjToStrIfNeeded(columnCssVars(index)),
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
159
|
+
$: gutterSize = () => {
|
|
160
|
+
return typeof space === "number" ? space || 0 : 20;
|
|
161
|
+
};
|
|
162
|
+
$: cols = () => {
|
|
163
|
+
return columns || [];
|
|
164
|
+
};
|
|
165
|
+
$: stackAt = () => {
|
|
166
|
+
return stackColumnsAt || "tablet";
|
|
167
|
+
};
|
|
168
|
+
$: flexDir = () => {
|
|
169
|
+
return stackColumnsAt === "never"
|
|
165
170
|
? "row"
|
|
166
171
|
: reverseColumnsWhenStacked
|
|
167
172
|
? "column-reverse"
|
|
168
173
|
: "column";
|
|
174
|
+
};
|
|
169
175
|
</script>
|
|
170
176
|
|
|
171
177
|
<div
|
|
@@ -186,7 +192,7 @@
|
|
|
186
192
|
actionAttributes={{}}
|
|
187
193
|
attributes={getAttributes(column, index)}
|
|
188
194
|
><Blocks
|
|
189
|
-
path={`
|
|
195
|
+
path={`columns.${index}.blocks`}
|
|
190
196
|
parent={builderBlock.id}
|
|
191
197
|
styleProp={{
|
|
192
198
|
flexGrow: "1",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
}}
|
|
62
62
|
><Blocks
|
|
63
63
|
parent={builderBlock.id}
|
|
64
|
-
path={`
|
|
64
|
+
path={`tabs.${index}.label`}
|
|
65
65
|
blocks={tab.label}
|
|
66
66
|
context={builderContext}
|
|
67
67
|
registeredComponents={builderComponents}
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
<div>
|
|
75
75
|
<Blocks
|
|
76
76
|
parent={builderBlock.id}
|
|
77
|
-
path={`
|
|
77
|
+
path={`tabs.${activeTab}.content`}
|
|
78
78
|
blocks={activeTabContent(activeTab)}
|
|
79
79
|
context={builderContext}
|
|
80
80
|
registeredComponents={builderComponents}
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
|
|
26
26
|
export let blocks: BlocksWrapperProps["blocks"];
|
|
27
27
|
export let classNameProp: BlocksWrapperProps["classNameProp"] = undefined;
|
|
28
|
-
export let parent: BlocksWrapperProps["parent"];
|
|
29
28
|
export let path: BlocksWrapperProps["path"];
|
|
29
|
+
export let parent: BlocksWrapperProps["parent"];
|
|
30
30
|
export let styleProp: BlocksWrapperProps["styleProp"];
|
|
31
31
|
export let BlocksWrapperProps: BlocksWrapperProps["BlocksWrapperProps"];
|
|
32
32
|
export let BlocksWrapper: BlocksWrapperProps["BlocksWrapper"];
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
type: "builder.clickEmptyBlocks",
|
|
50
50
|
data: {
|
|
51
51
|
parentElementId: parent,
|
|
52
|
-
dataPath:
|
|
52
|
+
dataPath: dataPath(),
|
|
53
53
|
},
|
|
54
54
|
},
|
|
55
55
|
"*"
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
type: "builder.hoverEmptyBlocks",
|
|
64
64
|
data: {
|
|
65
65
|
parentElementId: parent,
|
|
66
|
-
dataPath:
|
|
66
|
+
dataPath: dataPath(),
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
69
|
"*"
|
|
@@ -75,6 +75,13 @@
|
|
|
75
75
|
.filter(Boolean)
|
|
76
76
|
.join(" ");
|
|
77
77
|
};
|
|
78
|
+
$: dataPath = () => {
|
|
79
|
+
if (!path) {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
const pathPrefix = "component.options.";
|
|
83
|
+
return path.startsWith(pathPrefix) ? path : `${pathPrefix}${path || ""}`;
|
|
84
|
+
};
|
|
78
85
|
|
|
79
86
|
let blocksWrapperRef;
|
|
80
87
|
|
|
@@ -86,7 +93,7 @@
|
|
|
86
93
|
style={stringifyStyles(styleProp)}
|
|
87
94
|
bind:this={blocksWrapperRef}
|
|
88
95
|
class={className() + " svelte-element"}
|
|
89
|
-
builder-path={
|
|
96
|
+
builder-path={dataPath()}
|
|
90
97
|
builder-parent-id={parent}
|
|
91
98
|
{...{}}
|
|
92
99
|
on:click={(event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.29"
|
|
@@ -75,6 +75,7 @@ let IVM_CONTEXT: Context | null = null;
|
|
|
75
75
|
* `safeDynamicRequire` trick to import the `isolated-vm` package.
|
|
76
76
|
*/
|
|
77
77
|
export const setIvm = (ivm: IsolatedVMImport, options: IsolateOptions = {}) => {
|
|
78
|
+
if (IVM_INSTANCE) return;
|
|
78
79
|
IVM_INSTANCE = ivm;
|
|
79
80
|
setIsolateContext(options);
|
|
80
81
|
};
|
|
@@ -102,6 +103,7 @@ const getIvm = (): IsolatedVMImport => {
|
|
|
102
103
|
function setIsolateContext(options: IsolateOptions = {
|
|
103
104
|
memoryLimit: 128
|
|
104
105
|
}) {
|
|
106
|
+
if (IVM_CONTEXT) return IVM_CONTEXT;
|
|
105
107
|
const ivm = getIvm();
|
|
106
108
|
const isolate = new ivm.Isolate(options);
|
|
107
109
|
const context = isolate.createContextSync();
|
|
@@ -120,9 +122,7 @@ function setIsolateContext(options: IsolateOptions = {
|
|
|
120
122
|
return context;
|
|
121
123
|
}
|
|
122
124
|
const getIsolateContext = () => {
|
|
123
|
-
|
|
124
|
-
const context = setIsolateContext();
|
|
125
|
-
return context;
|
|
125
|
+
return setIsolateContext();
|
|
126
126
|
};
|
|
127
127
|
export const runInNode = ({
|
|
128
128
|
code,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setIvm } from './node-runtime'
|