@builder.io/sdk-solid 0.5.8 → 0.6.0
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/README.md +0 -4
- package/dist/index.d.ts +51 -0
- package/lib/browser/dev.js +4790 -0
- package/lib/browser/dev.jsx +4392 -0
- package/lib/browser/index.js +4767 -0
- package/lib/browser/index.jsx +4374 -0
- package/lib/edge/dev.js +7921 -0
- package/lib/edge/dev.jsx +7525 -0
- package/lib/edge/index.js +7898 -0
- package/lib/edge/index.jsx +7507 -0
- package/lib/node/dev.js +4790 -0
- package/lib/node/dev.jsx +4392 -0
- package/lib/node/index.js +4767 -0
- package/lib/node/index.jsx +4374 -0
- package/package.json +86 -14
- package/CHANGELOG.md +0 -98
- package/solid-index.jsx +0 -5
- package/src/blocks/BaseText.jsx +0 -11
- package/src/blocks/button/button.jsx +0 -41
- package/src/blocks/button/component-info.js +0 -34
- package/src/blocks/columns/columns.jsx +0 -174
- package/src/blocks/columns/component-info.js +0 -218
- package/src/blocks/custom-code/component-info.js +0 -24
- package/src/blocks/custom-code/custom-code.jsx +0 -62
- package/src/blocks/embed/component-info.js +0 -37
- package/src/blocks/embed/embed.jsx +0 -50
- package/src/blocks/embed/helpers.js +0 -3
- package/src/blocks/form/component-info.js +0 -223
- package/src/blocks/form/form.jsx +0 -5
- package/src/blocks/fragment/component-info.js +0 -8
- package/src/blocks/fragment/fragment.jsx +0 -5
- package/src/blocks/helpers.js +0 -27
- package/src/blocks/image/component-info.js +0 -122
- package/src/blocks/image/image.helpers.js +0 -46
- package/src/blocks/image/image.jsx +0 -122
- package/src/blocks/img/component-info.js +0 -15
- package/src/blocks/img/img.jsx +0 -20
- package/src/blocks/input/component-info.js +0 -45
- package/src/blocks/input/input.jsx +0 -22
- package/src/blocks/raw-text/component-info.js +0 -11
- package/src/blocks/raw-text/raw-text.jsx +0 -10
- package/src/blocks/section/component-info.js +0 -41
- package/src/blocks/section/section.jsx +0 -26
- package/src/blocks/select/component-info.js +0 -44
- package/src/blocks/select/select.jsx +0 -30
- package/src/blocks/submit-button/component-info.js +0 -23
- package/src/blocks/submit-button/submit-button.jsx +0 -11
- package/src/blocks/symbol/component-info.js +0 -35
- package/src/blocks/symbol/symbol.helpers.js +0 -60
- package/src/blocks/symbol/symbol.jsx +0 -64
- package/src/blocks/text/component-info.js +0 -20
- package/src/blocks/text/text.jsx +0 -14
- package/src/blocks/textarea/component-info.js +0 -38
- package/src/blocks/textarea/textarea.jsx +0 -16
- package/src/blocks/video/component-info.js +0 -83
- package/src/blocks/video/video.jsx +0 -61
- package/src/components/block/block.helpers.js +0 -99
- package/src/components/block/block.jsx +0 -167
- package/src/components/block/components/block-styles.jsx +0 -85
- package/src/components/block/components/block-wrapper.jsx +0 -50
- package/src/components/block/components/component-ref/component-ref.helpers.js +0 -41
- package/src/components/block/components/component-ref/component-ref.jsx +0 -58
- package/src/components/block/components/interactive-element.jsx +0 -30
- package/src/components/block/components/repeated-block.jsx +0 -20
- package/src/components/block/types.js +0 -0
- package/src/components/blocks/blocks-wrapper.jsx +0 -66
- package/src/components/blocks/blocks.jsx +0 -57
- package/src/components/content/components/enable-editor.jsx +0 -347
- package/src/components/content/components/styles.helpers.js +0 -56
- package/src/components/content/components/styles.jsx +0 -36
- package/src/components/content/content.helpers.js +0 -48
- package/src/components/content/content.jsx +0 -136
- package/src/components/content/content.types.js +0 -0
- package/src/components/content/index.js +0 -2
- package/src/components/content/wrap-component-ref.js +0 -2
- package/src/components/content-variants/content-variants.jsx +0 -115
- package/src/components/content-variants/content-variants.types.js +0 -0
- package/src/components/content-variants/helpers.js +0 -158
- package/src/components/inlined-script.jsx +0 -5
- package/src/components/inlined-styles.jsx +0 -5
- package/src/constants/builder-registered-components.js +0 -63
- package/src/constants/device-sizes.js +0 -48
- package/src/constants/sdk-version.js +0 -1
- package/src/constants/target.js +0 -4
- package/src/context/builder.context.js +0 -16
- package/src/context/components.context.js +0 -5
- package/src/context/types.js +0 -0
- package/src/functions/apply-patch-with-mutation.js +0 -66
- package/src/functions/camel-to-kebab-case.js +0 -2
- package/src/functions/evaluate/acorn-interpreter.js +0 -2876
- package/src/functions/evaluate/evaluate.js +0 -79
- package/src/functions/evaluate/index.js +0 -2
- package/src/functions/evaluate/non-node-runtime/index.js +0 -18
- package/src/functions/evaluate/non-node-runtime/non-node-runtime.js +0 -92
- package/src/functions/evaluate/types.js +0 -0
- package/src/functions/event-handler-name.js +0 -5
- package/src/functions/extract-text-styles.js +0 -14
- package/src/functions/fast-clone.js +0 -2
- package/src/functions/fetch-builder-props.js +0 -60
- package/src/functions/get-block-actions-handler.js +0 -11
- package/src/functions/get-block-actions.js +0 -29
- package/src/functions/get-block-component-options.js +0 -27
- package/src/functions/get-block-properties.js +0 -63
- package/src/functions/get-builder-search-params/index.js +0 -33
- package/src/functions/get-content/generate-content-url.js +0 -59
- package/src/functions/get-content/index.js +0 -116
- package/src/functions/get-content/types.js +0 -0
- package/src/functions/get-fetch.js +0 -12
- package/src/functions/get-global-this.js +0 -16
- package/src/functions/get-processed-block.js +0 -74
- package/src/functions/get-react-native-block-styles.js +0 -32
- package/src/functions/is-browser.js +0 -4
- package/src/functions/is-editing.js +0 -6
- package/src/functions/is-iframe.js +0 -5
- package/src/functions/is-non-node-server.js +0 -9
- package/src/functions/is-previewing.js +0 -12
- package/src/functions/on-change.js +0 -24
- package/src/functions/register-component.js +0 -60
- package/src/functions/register.js +0 -27
- package/src/functions/sanitize-react-native-block-styles.js +0 -71
- package/src/functions/set-editor-settings.js +0 -13
- package/src/functions/set.js +0 -9
- package/src/functions/track/helpers.js +0 -48
- package/src/functions/track/index.js +0 -131
- package/src/functions/track/interaction.js +0 -57
- package/src/functions/transform-block-properties.js +0 -4
- package/src/functions/transform-block.js +0 -4
- package/src/helpers/ab-tests.js +0 -158
- package/src/helpers/canTrack.js +0 -3
- package/src/helpers/cookie.js +0 -77
- package/src/helpers/css.js +0 -30
- package/src/helpers/flatten.js +0 -31
- package/src/helpers/localStorage.js +0 -32
- package/src/helpers/logger.js +0 -8
- package/src/helpers/nullable.js +0 -2
- package/src/helpers/preview-lru-cache/get.js +0 -4
- package/src/helpers/preview-lru-cache/helpers.js +0 -0
- package/src/helpers/preview-lru-cache/init.js +0 -2
- package/src/helpers/preview-lru-cache/set.js +0 -31
- package/src/helpers/preview-lru-cache/types.js +0 -0
- package/src/helpers/sessionId.js +0 -55
- package/src/helpers/time.js +0 -3
- package/src/helpers/url.js +0 -11
- package/src/helpers/uuid.js +0 -11
- package/src/helpers/visitorId.js +0 -35
- package/src/index-helpers/blocks-exports.js +0 -13
- package/src/index-helpers/top-of-file.js +0 -2
- package/src/index.js +0 -12
- package/src/scripts/init-editing.js +0 -109
- package/src/types/api-version.js +0 -2
- package/src/types/builder-block.js +0 -0
- package/src/types/builder-content.js +0 -0
- package/src/types/builder-props.js +0 -0
- package/src/types/can-track.js +0 -0
- package/src/types/components.js +0 -0
- package/src/types/deep-partial.js +0 -0
- package/src/types/element.js +0 -0
- package/src/types/enforced-partials.js +0 -0
- package/src/types/input.js +0 -0
- package/src/types/targets.js +0 -0
- package/src/types/typescript.js +0 -0
- package/vite.config.ts +0 -18
package/package.json
CHANGED
|
@@ -1,41 +1,113 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-solid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist",
|
|
7
|
+
"lib"
|
|
8
|
+
],
|
|
9
|
+
"sideEffects": false,
|
|
5
10
|
"type": "module",
|
|
6
|
-
"main": "./
|
|
7
|
-
"module": "./
|
|
11
|
+
"main": "./lib/browser/index.js",
|
|
12
|
+
"module": "./lib/browser/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"browser": {},
|
|
8
15
|
"exports": {
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
16
|
+
"solid": {
|
|
17
|
+
"node": {
|
|
18
|
+
"development": "./lib/node/dev.jsx",
|
|
19
|
+
"import": "./lib/node/index.jsx"
|
|
20
|
+
},
|
|
21
|
+
"browser": {
|
|
22
|
+
"development": "./lib/browser/dev.jsx",
|
|
23
|
+
"import": "./lib/browser/index.jsx"
|
|
24
|
+
},
|
|
25
|
+
"edge-routine": {
|
|
26
|
+
"development": "./lib/edge/dev.jsx",
|
|
27
|
+
"import": "./lib/edge/index.jsx"
|
|
28
|
+
},
|
|
29
|
+
"workerd": {
|
|
30
|
+
"development": "./lib/edge/dev.jsx",
|
|
31
|
+
"import": "./lib/edge/index.jsx"
|
|
32
|
+
},
|
|
33
|
+
"deno": {
|
|
34
|
+
"development": "./lib/edge/dev.jsx",
|
|
35
|
+
"import": "./lib/edge/index.jsx"
|
|
36
|
+
},
|
|
37
|
+
"lagon": {
|
|
38
|
+
"development": "./lib/edge/dev.jsx",
|
|
39
|
+
"import": "./lib/edge/index.jsx"
|
|
40
|
+
},
|
|
41
|
+
"netlify": {
|
|
42
|
+
"development": "./lib/edge/dev.jsx",
|
|
43
|
+
"import": "./lib/edge/index.jsx"
|
|
44
|
+
},
|
|
45
|
+
"edge-light": {
|
|
46
|
+
"development": "./lib/edge/dev.jsx",
|
|
47
|
+
"import": "./lib/edge/index.jsx"
|
|
48
|
+
},
|
|
49
|
+
"bun": {
|
|
50
|
+
"development": "./lib/edge/dev.jsx",
|
|
51
|
+
"import": "./lib/edge/index.jsx"
|
|
52
|
+
},
|
|
53
|
+
"electron": {
|
|
54
|
+
"development": "./lib/node/dev.jsx",
|
|
55
|
+
"import": "./lib/node/index.jsx"
|
|
56
|
+
},
|
|
57
|
+
"default": {
|
|
58
|
+
"development": "./lib/browser/dev.jsx",
|
|
59
|
+
"import": "./lib/browser/index.jsx"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"development": {
|
|
63
|
+
"import": {
|
|
64
|
+
"types": "./dist/index.d.ts",
|
|
65
|
+
"default": "./lib/browser/dev.js"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"import": {
|
|
69
|
+
"types": "./dist/index.d.ts",
|
|
70
|
+
"default": "./lib/browser/index.js"
|
|
12
71
|
}
|
|
13
72
|
},
|
|
73
|
+
"typesVersions": {},
|
|
14
74
|
"scripts": {
|
|
15
|
-
"build": "
|
|
75
|
+
"build": "nx run-many -p @builder.io/sdk-solid -t build:node build:edge build:browser",
|
|
76
|
+
"build:one": "tsup",
|
|
77
|
+
"build:node": "SDK_ENV=node yarn build:one",
|
|
78
|
+
"build:edge": "SDK_ENV=edge yarn build:one",
|
|
79
|
+
"build:browser": "SDK_ENV=browser yarn build:one"
|
|
16
80
|
},
|
|
17
81
|
"dependencies": {
|
|
18
82
|
"solid-styled-components": "^0.27.6"
|
|
19
83
|
},
|
|
20
84
|
"peerDependencies": {
|
|
21
|
-
"solid-js": "
|
|
85
|
+
"solid-js": "^1.6.0"
|
|
22
86
|
},
|
|
23
87
|
"devDependencies": {
|
|
88
|
+
"@builder.io/sdks": "workspace:*",
|
|
89
|
+
"esbuild": "^0.18.15",
|
|
90
|
+
"esbuild-plugin-solid": "^0.5.0",
|
|
24
91
|
"nx": "^16.6.0",
|
|
25
92
|
"nx-cloud": "^16.2.0",
|
|
26
|
-
"solid-js": "
|
|
27
|
-
"
|
|
28
|
-
"
|
|
93
|
+
"solid-js": "^1.7.8",
|
|
94
|
+
"tsup": "^7.1.0",
|
|
95
|
+
"tsup-preset-solid": "^2.0.1",
|
|
96
|
+
"typescript": "^5.1.6"
|
|
29
97
|
},
|
|
98
|
+
"keywords": [
|
|
99
|
+
"solid"
|
|
100
|
+
],
|
|
30
101
|
"nx": {
|
|
31
|
-
"implicitDependencies": [
|
|
32
|
-
"@builder.io/sdks"
|
|
33
|
-
],
|
|
34
102
|
"targets": {
|
|
35
103
|
"build": {
|
|
36
104
|
"dependsOn": [
|
|
37
105
|
"^build:solid",
|
|
38
106
|
"^build"
|
|
107
|
+
],
|
|
108
|
+
"outputs": [
|
|
109
|
+
"{projectRoot}/lib",
|
|
110
|
+
"{projectRoot}/dist"
|
|
39
111
|
]
|
|
40
112
|
}
|
|
41
113
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
### 0.5.8
|
|
2
|
-
|
|
3
|
-
- Fix: properly serialize messages sent to visual editor.
|
|
4
|
-
|
|
5
|
-
### 0.5.7
|
|
6
|
-
|
|
7
|
-
- No Changes.
|
|
8
|
-
|
|
9
|
-
### 0.5.6
|
|
10
|
-
|
|
11
|
-
- No Changes.
|
|
12
|
-
|
|
13
|
-
### 0.5.5
|
|
14
|
-
|
|
15
|
-
- Fix: remove `lru-cache` import and usage.
|
|
16
|
-
|
|
17
|
-
### 0.5.4
|
|
18
|
-
|
|
19
|
-
- Fix build issues caused by extraneous `acorn` import.
|
|
20
|
-
- Put Edge runtime evaluator behind dynamic import.
|
|
21
|
-
|
|
22
|
-
### 0.5.2
|
|
23
|
-
|
|
24
|
-
- No Changes.
|
|
25
|
-
|
|
26
|
-
### 0.5.1
|
|
27
|
-
|
|
28
|
-
- Fix: make `RenderBlocks` properties `context` and `registeredComponents` optional for external use.
|
|
29
|
-
|
|
30
|
-
### 0.5.0
|
|
31
|
-
|
|
32
|
-
- Feature: Added support for rudimentary data-bindings in Non-Node.js (edge, serverless, etc.) server runtimes.
|
|
33
|
-
|
|
34
|
-
### 0.4.5
|
|
35
|
-
|
|
36
|
-
- Fix: show dynamic symbols correctly in Preview mode.
|
|
37
|
-
- Feature: SSR A/B test Symbols nested inside page content.
|
|
38
|
-
|
|
39
|
-
### 0.4.4
|
|
40
|
-
|
|
41
|
-
- Fix: tracking URL from `builder.io/api/v1/track` to `cdn.builder.io/api/v1/track` for improved reliability.
|
|
42
|
-
|
|
43
|
-
### 0.4.3
|
|
44
|
-
|
|
45
|
-
- Fix: SSR A/B test environment check (`isHydrationTarget`) now accurately checks current environment.
|
|
46
|
-
|
|
47
|
-
### 0.4.2
|
|
48
|
-
|
|
49
|
-
- No external changes.
|
|
50
|
-
|
|
51
|
-
### 0.4.1
|
|
52
|
-
|
|
53
|
-
- Fix: bring back `getBuilderSearchParams` export that was accidentally removed.
|
|
54
|
-
|
|
55
|
-
### 0.4.0
|
|
56
|
-
|
|
57
|
-
- Feature: A/B tests are now rendered correctly during server-side rendering (SSR) when applicable. This behaviour is backwards compatible with previous versions.
|
|
58
|
-
- Feature: Add support for `enrich` API flag.
|
|
59
|
-
- Mark `noTraverse` and `includeRefs` as deprecated.
|
|
60
|
-
|
|
61
|
-
### 0.3.1
|
|
62
|
-
|
|
63
|
-
- Feature: Added SDK version to data sent to visual editor for improved debugging.
|
|
64
|
-
- Fix: Columns block: removed redundant margin-left in first column.
|
|
65
|
-
|
|
66
|
-
### 0.3.0
|
|
67
|
-
|
|
68
|
-
- No Changes.
|
|
69
|
-
|
|
70
|
-
### 0.2.3
|
|
71
|
-
|
|
72
|
-
- No Changes.
|
|
73
|
-
|
|
74
|
-
### 0.2.2
|
|
75
|
-
|
|
76
|
-
- Fix: dynamic bindings for Link URLs.
|
|
77
|
-
- Fix: previewing content that includes a symbol whose `model` property is a `page`.
|
|
78
|
-
- Fix: "Show If"/"Hide If" bindings when the initial value is `undefined`.
|
|
79
|
-
|
|
80
|
-
### 0.2.1
|
|
81
|
-
|
|
82
|
-
- No Changes.
|
|
83
|
-
|
|
84
|
-
### 0.2.0
|
|
85
|
-
|
|
86
|
-
- Sets the default `apiVersion` to `v3`.
|
|
87
|
-
|
|
88
|
-
In case you feel the need to use our older API Version `v2`, reach out to us at support@builder.io first. But you can override the default by setting `apiVersion` explicitly to `v2` as follows:
|
|
89
|
-
|
|
90
|
-
```jsx
|
|
91
|
-
<RenderContent apiVersion="v2" />
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
```js
|
|
95
|
-
getContent({ apiVersion: 'v2' });
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
More details on the Builder API Versions visit [this link](https://www.builder.io/c/docs/content-api-versions).
|
package/solid-index.jsx
DELETED
package/src/blocks/BaseText.jsx
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useContext } from "solid-js";
|
|
2
|
-
|
|
3
|
-
import BuilderContext from "../context/builder.context.js";
|
|
4
|
-
|
|
5
|
-
function BaseText(props) {
|
|
6
|
-
const builderContext = useContext(BuilderContext);
|
|
7
|
-
|
|
8
|
-
return <span style={builderContext.inheritedStyles}>{props.text}</span>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default BaseText;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Show } from "solid-js";
|
|
2
|
-
|
|
3
|
-
import { css } from "solid-styled-components";
|
|
4
|
-
|
|
5
|
-
import { filterAttrs } from "../helpers.js";
|
|
6
|
-
|
|
7
|
-
function Button(props) {
|
|
8
|
-
return (
|
|
9
|
-
<Show
|
|
10
|
-
fallback={
|
|
11
|
-
<button
|
|
12
|
-
class={
|
|
13
|
-
props.attributes.class +
|
|
14
|
-
" " +
|
|
15
|
-
css({
|
|
16
|
-
all: "unset",
|
|
17
|
-
})
|
|
18
|
-
}
|
|
19
|
-
{...{}}
|
|
20
|
-
{...props.attributes}
|
|
21
|
-
style={props.attributes.style}
|
|
22
|
-
>
|
|
23
|
-
{props.text}
|
|
24
|
-
</button>
|
|
25
|
-
}
|
|
26
|
-
when={props.link}
|
|
27
|
-
>
|
|
28
|
-
<a
|
|
29
|
-
role="button"
|
|
30
|
-
{...{}}
|
|
31
|
-
{...props.attributes}
|
|
32
|
-
href={props.link}
|
|
33
|
-
target={props.openLinkInNewTab ? "_blank" : undefined}
|
|
34
|
-
>
|
|
35
|
-
{props.text}
|
|
36
|
-
</a>
|
|
37
|
-
</Show>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export default Button;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
const componentInfo = {
|
|
2
|
-
name: "Core:Button",
|
|
3
|
-
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
|
|
4
|
-
defaultStyles: {
|
|
5
|
-
appearance: "none",
|
|
6
|
-
paddingTop: "15px",
|
|
7
|
-
paddingBottom: "15px",
|
|
8
|
-
paddingLeft: "25px",
|
|
9
|
-
paddingRight: "25px",
|
|
10
|
-
backgroundColor: "#000000",
|
|
11
|
-
color: "white",
|
|
12
|
-
borderRadius: "4px",
|
|
13
|
-
textAlign: "center",
|
|
14
|
-
cursor: "pointer"
|
|
15
|
-
},
|
|
16
|
-
inputs: [{
|
|
17
|
-
name: "text",
|
|
18
|
-
type: "text",
|
|
19
|
-
defaultValue: "Click me!",
|
|
20
|
-
bubble: true
|
|
21
|
-
}, {
|
|
22
|
-
name: "link",
|
|
23
|
-
type: "url",
|
|
24
|
-
bubble: true
|
|
25
|
-
}, {
|
|
26
|
-
name: "openLinkInNewTab",
|
|
27
|
-
type: "boolean",
|
|
28
|
-
defaultValue: false,
|
|
29
|
-
friendlyName: "Open link in new tab"
|
|
30
|
-
}],
|
|
31
|
-
static: true,
|
|
32
|
-
noWrap: true
|
|
33
|
-
};
|
|
34
|
-
export { componentInfo }
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { Show, For, createSignal } from "solid-js";
|
|
2
|
-
|
|
3
|
-
import { css } from "solid-styled-components";
|
|
4
|
-
|
|
5
|
-
import Blocks from "../../components/blocks/blocks";
|
|
6
|
-
import { getSizesForBreakpoints } from "../../constants/device-sizes.js";
|
|
7
|
-
import InlinedStyles from "../../components/inlined-styles";
|
|
8
|
-
import { TARGET } from "../../constants/target.js";
|
|
9
|
-
|
|
10
|
-
function Columns(props) {
|
|
11
|
-
const [gutterSize, setGutterSize] = createSignal(
|
|
12
|
-
typeof props.space === "number" ? props.space || 0 : 20
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
const [cols, setCols] = createSignal(props.columns || []);
|
|
16
|
-
|
|
17
|
-
const [stackAt, setStackAt] = createSignal(props.stackColumnsAt || "tablet");
|
|
18
|
-
|
|
19
|
-
const [flexDir, setFlexDir] = createSignal(
|
|
20
|
-
props.stackColumnsAt === "never"
|
|
21
|
-
? "row"
|
|
22
|
-
: props.reverseColumnsWhenStacked
|
|
23
|
-
? "column-reverse"
|
|
24
|
-
: "column"
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
function getWidth(index) {
|
|
28
|
-
return cols()[index]?.width || 100 / cols().length;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function getColumnCssWidth(index) {
|
|
32
|
-
const subtractWidth = (gutterSize() * (cols().length - 1)) / cols().length;
|
|
33
|
-
return `calc(${getWidth(index)}% - ${subtractWidth}px)`;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function getTabletStyle({ stackedStyle, desktopStyle }) {
|
|
37
|
-
return stackAt() === "tablet" ? stackedStyle : desktopStyle;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function getMobileStyle({ stackedStyle, desktopStyle }) {
|
|
41
|
-
return stackAt() === "never" ? desktopStyle : stackedStyle;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function columnsCssVars() {
|
|
45
|
-
return {
|
|
46
|
-
"--flex-dir": flexDir(),
|
|
47
|
-
"--flex-dir-tablet": getTabletStyle({
|
|
48
|
-
stackedStyle: flexDir(),
|
|
49
|
-
desktopStyle: "row",
|
|
50
|
-
}),
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function columnCssVars(index) {
|
|
55
|
-
const gutter = index === 0 ? 0 : gutterSize();
|
|
56
|
-
if (TARGET === "reactNative") {
|
|
57
|
-
return {
|
|
58
|
-
marginLeft: props.stackColumnsAt === "never" ? gutter : 0,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
const width = getColumnCssWidth(index);
|
|
62
|
-
const gutterPixels = `${gutter}px`;
|
|
63
|
-
const mobileWidth = "100%";
|
|
64
|
-
const mobileMarginLeft = 0;
|
|
65
|
-
const marginLeftKey = "margin-left";
|
|
66
|
-
return {
|
|
67
|
-
width,
|
|
68
|
-
[marginLeftKey]: gutterPixels,
|
|
69
|
-
"--column-width-mobile": getMobileStyle({
|
|
70
|
-
stackedStyle: mobileWidth,
|
|
71
|
-
desktopStyle: width,
|
|
72
|
-
}),
|
|
73
|
-
"--column-margin-left-mobile": getMobileStyle({
|
|
74
|
-
stackedStyle: mobileMarginLeft,
|
|
75
|
-
desktopStyle: gutterPixels,
|
|
76
|
-
}),
|
|
77
|
-
"--column-width-tablet": getTabletStyle({
|
|
78
|
-
stackedStyle: mobileWidth,
|
|
79
|
-
desktopStyle: width,
|
|
80
|
-
}),
|
|
81
|
-
"--column-margin-left-tablet": getTabletStyle({
|
|
82
|
-
stackedStyle: mobileMarginLeft,
|
|
83
|
-
desktopStyle: gutterPixels,
|
|
84
|
-
}),
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function getWidthForBreakpointSize(size) {
|
|
89
|
-
const breakpointSizes = getSizesForBreakpoints(
|
|
90
|
-
props.builderContext.content?.meta?.breakpoints || {}
|
|
91
|
-
);
|
|
92
|
-
return breakpointSizes[size].max;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function columnsStyles() {
|
|
96
|
-
return `
|
|
97
|
-
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
98
|
-
.${props.builderBlock.id}-breakpoints {
|
|
99
|
-
flex-direction: var(--flex-dir-tablet);
|
|
100
|
-
align-items: stretch;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.${props.builderBlock.id}-breakpoints > .builder-column {
|
|
104
|
-
width: var(--column-width-tablet) !important;
|
|
105
|
-
margin-left: var(--column-margin-left-tablet) !important;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
@media (max-width: ${getWidthForBreakpointSize("small")}px) {
|
|
110
|
-
.${props.builderBlock.id}-breakpoints {
|
|
111
|
-
flex-direction: var(--flex-dir);
|
|
112
|
-
align-items: stretch;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.${props.builderBlock.id}-breakpoints > .builder-column {
|
|
116
|
-
width: var(--column-width-mobile) !important;
|
|
117
|
-
margin-left: var(--column-margin-left-mobile) !important;
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
`;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return (
|
|
124
|
-
<div
|
|
125
|
-
class={
|
|
126
|
-
`builder-columns ${props.builderBlock.id}-breakpoints` +
|
|
127
|
-
" " +
|
|
128
|
-
css({
|
|
129
|
-
display: "flex",
|
|
130
|
-
lineHeight: "normal",
|
|
131
|
-
})
|
|
132
|
-
}
|
|
133
|
-
style={columnsCssVars()}
|
|
134
|
-
{...{}}
|
|
135
|
-
>
|
|
136
|
-
<Show when={TARGET !== "reactNative"}>
|
|
137
|
-
<InlinedStyles styles={columnsStyles()}></InlinedStyles>
|
|
138
|
-
</Show>
|
|
139
|
-
<For each={props.columns}>
|
|
140
|
-
{(column, _index) => {
|
|
141
|
-
const index = _index();
|
|
142
|
-
return (
|
|
143
|
-
<div
|
|
144
|
-
class={
|
|
145
|
-
"builder-column " +
|
|
146
|
-
css({
|
|
147
|
-
display: "flex",
|
|
148
|
-
flexDirection: "column",
|
|
149
|
-
alignItems: "stretch",
|
|
150
|
-
})
|
|
151
|
-
}
|
|
152
|
-
style={columnCssVars(index)}
|
|
153
|
-
{...{}}
|
|
154
|
-
key={index}
|
|
155
|
-
>
|
|
156
|
-
<Blocks
|
|
157
|
-
blocks={column.blocks}
|
|
158
|
-
path={`component.options.columns.${index}.blocks`}
|
|
159
|
-
parent={props.builderBlock.id}
|
|
160
|
-
styleProp={{
|
|
161
|
-
flexGrow: "1",
|
|
162
|
-
}}
|
|
163
|
-
context={props.builderContext}
|
|
164
|
-
registeredComponents={props.builderComponents}
|
|
165
|
-
></Blocks>
|
|
166
|
-
</div>
|
|
167
|
-
);
|
|
168
|
-
}}
|
|
169
|
-
</For>
|
|
170
|
-
</div>
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export default Columns;
|