@builder.io/sdk-react 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/lib/browser/index.cjs +97 -0
- package/lib/browser/index.mjs +2598 -0
- package/lib/browser/server-entry-2e639417.js +2 -0
- package/lib/browser/server-entry-f7504f89.mjs +534 -0
- package/lib/browser/server-entry.cjs +1 -0
- package/lib/browser/server-entry.mjs +16 -0
- package/lib/edge/index.cjs +117 -0
- package/lib/edge/index.mjs +5042 -0
- package/lib/edge/server-entry-2e639417.js +2 -0
- package/lib/edge/server-entry-f7504f89.mjs +534 -0
- package/lib/edge/server-entry.cjs +1 -0
- package/lib/edge/server-entry.mjs +16 -0
- package/lib/node/index.cjs +97 -0
- package/lib/node/index.mjs +2598 -0
- package/lib/node/server-entry-2e639417.js +2 -0
- package/lib/node/server-entry-f7504f89.mjs +534 -0
- package/lib/node/server-entry.cjs +1 -0
- package/lib/node/server-entry.mjs +16 -0
- package/package.json +97 -11
- package/{dist → types}/components/content/content.types.d.ts +2 -2
- package/{dist → types}/components/content-variants/content-variants.d.ts +2 -2
- package/{dist → types}/components/content-variants/content-variants.types.d.ts +1 -1
- package/types/constants/sdk-version.d.ts +1 -0
- package/types/functions/deopt.d.ts +4 -0
- package/types/functions/evaluate/browser-runtime/browser.d.ts +4 -0
- package/types/functions/evaluate/browser-runtime/index.d.ts +1 -0
- package/types/functions/evaluate/edge-runtime/edge-runtime.d.ts +2 -0
- package/types/functions/evaluate/edge-runtime/index.d.ts +1 -0
- package/types/functions/evaluate/evaluate.d.ts +6 -0
- package/types/functions/evaluate/helpers.d.ts +18 -0
- package/types/functions/evaluate/index.d.ts +1 -0
- package/types/functions/evaluate/node-runtime/index.d.ts +1 -0
- package/types/functions/evaluate/placeholder-runtime.d.ts +2 -0
- package/{dist → types}/functions/fetch-builder-props.d.ts +4 -3
- package/{dist → types}/functions/get-content/index.d.ts +4 -5
- package/types/functions/is-edge-runtime.d.ts +4 -0
- package/{dist → types}/index-helpers/blocks-exports.d.ts +2 -2
- package/types/index.d.ts +7 -0
- package/{dist/index.d.ts → types/server-index.d.ts} +0 -1
- package/dist/blocks/BaseText.js +0 -9
- package/dist/blocks/button/button.js +0 -12
- package/dist/blocks/button/component-info.js +0 -34
- package/dist/blocks/columns/columns.js +0 -121
- package/dist/blocks/columns/component-info.js +0 -219
- package/dist/blocks/custom-code/component-info.js +0 -23
- package/dist/blocks/custom-code/custom-code.js +0 -51
- package/dist/blocks/embed/component-info.js +0 -39
- package/dist/blocks/embed/embed.js +0 -42
- package/dist/blocks/embed/helpers.js +0 -2
- package/dist/blocks/form/component-info.js +0 -232
- package/dist/blocks/form/form.js +0 -6
- package/dist/blocks/fragment/component-info.js +0 -7
- package/dist/blocks/fragment/fragment.js +0 -6
- package/dist/blocks/helpers.js +0 -40
- package/dist/blocks/image/component-info.js +0 -122
- package/dist/blocks/image/image.helpers.js +0 -47
- package/dist/blocks/image/image.js +0 -82
- package/dist/blocks/img/component-info.js +0 -15
- package/dist/blocks/img/img.js +0 -10
- package/dist/blocks/input/component-info.js +0 -46
- package/dist/blocks/input/input.js +0 -7
- package/dist/blocks/raw-text/component-info.js +0 -10
- package/dist/blocks/raw-text/raw-text.js +0 -6
- package/dist/blocks/section/component-info.js +0 -40
- package/dist/blocks/section/section.js +0 -17
- package/dist/blocks/select/component-info.js +0 -43
- package/dist/blocks/select/select.js +0 -7
- package/dist/blocks/submit-button/component-info.js +0 -26
- package/dist/blocks/submit-button/submit-button.js +0 -6
- package/dist/blocks/symbol/component-info.js +0 -34
- package/dist/blocks/symbol/symbol.helpers.js +0 -31
- package/dist/blocks/symbol/symbol.js +0 -45
- package/dist/blocks/text/component-info.js +0 -19
- package/dist/blocks/text/text.js +0 -8
- package/dist/blocks/textarea/component-info.js +0 -37
- package/dist/blocks/textarea/textarea.js +0 -6
- package/dist/blocks/video/component-info.js +0 -82
- package/dist/blocks/video/video.js +0 -50
- package/dist/components/block/block.helpers.js +0 -69
- package/dist/components/block/block.js +0 -94
- package/dist/components/block/components/block-styles.js +0 -65
- package/dist/components/block/components/block-wrapper.js +0 -36
- package/dist/components/block/components/component-ref/component-ref.helpers.js +0 -22
- package/dist/components/block/components/component-ref/component-ref.js +0 -23
- package/dist/components/block/components/interactive-element.js +0 -20
- package/dist/components/block/components/repeated-block.js +0 -11
- package/dist/components/block/types.js +0 -1
- package/dist/components/blocks/blocks-wrapper.js +0 -38
- package/dist/components/blocks/blocks.js +0 -17
- package/dist/components/content/components/enable-editor.js +0 -271
- package/dist/components/content/components/styles.helpers.js +0 -58
- package/dist/components/content/components/styles.js +0 -32
- package/dist/components/content/content.helpers.js +0 -30
- package/dist/components/content/content.js +0 -85
- package/dist/components/content/content.types.js +0 -1
- package/dist/components/content/index.js +0 -1
- package/dist/components/content/wrap-component-ref.js +0 -6
- package/dist/components/content-variants/content-variants.js +0 -52
- package/dist/components/content-variants/content-variants.types.js +0 -1
- package/dist/components/content-variants/helpers.js +0 -189
- package/dist/components/inlined-script.js +0 -6
- package/dist/components/inlined-styles.js +0 -6
- package/dist/constants/builder-registered-components.js +0 -60
- package/dist/constants/device-sizes.js +0 -45
- package/dist/constants/sdk-version.d.ts +0 -1
- package/dist/constants/sdk-version.js +0 -1
- package/dist/constants/target.js +0 -2
- package/dist/context/builder.context.js +0 -12
- package/dist/context/components.context.js +0 -2
- package/dist/context/types.js +0 -1
- package/dist/functions/apply-patch-with-mutation.js +0 -54
- package/dist/functions/camel-to-kebab-case.js +0 -1
- package/dist/functions/evaluate/acorn-interpreter.js +0 -3111
- package/dist/functions/evaluate/evaluate.d.ts +0 -10
- package/dist/functions/evaluate/evaluate.js +0 -70
- package/dist/functions/evaluate/index.d.ts +0 -1
- package/dist/functions/evaluate/index.js +0 -1
- package/dist/functions/evaluate/non-node-runtime/index.d.ts +0 -1
- package/dist/functions/evaluate/non-node-runtime/index.js +0 -2
- package/dist/functions/evaluate/non-node-runtime/non-node-runtime.d.ts +0 -2
- package/dist/functions/evaluate/non-node-runtime/non-node-runtime.js +0 -84
- package/dist/functions/evaluate/types.d.ts +0 -11
- package/dist/functions/evaluate/types.js +0 -1
- package/dist/functions/event-handler-name.js +0 -4
- package/dist/functions/extract-text-styles.js +0 -22
- package/dist/functions/fast-clone.js +0 -4
- package/dist/functions/fetch-builder-props.js +0 -25
- package/dist/functions/get-block-actions-handler.js +0 -10
- package/dist/functions/get-block-actions.js +0 -28
- package/dist/functions/get-block-component-options.js +0 -10
- package/dist/functions/get-block-properties.js +0 -72
- package/dist/functions/get-builder-search-params/index.js +0 -38
- package/dist/functions/get-content/generate-content-url.js +0 -33
- package/dist/functions/get-content/index.js +0 -100
- package/dist/functions/get-content/types.js +0 -1
- package/dist/functions/get-fetch.js +0 -11
- package/dist/functions/get-global-this.js +0 -15
- package/dist/functions/get-processed-block.js +0 -46
- package/dist/functions/get-react-native-block-styles.js +0 -17
- package/dist/functions/is-browser.js +0 -3
- package/dist/functions/is-editing.js +0 -5
- package/dist/functions/is-iframe.js +0 -4
- package/dist/functions/is-non-node-server.d.ts +0 -4
- package/dist/functions/is-non-node-server.js +0 -8
- package/dist/functions/is-previewing.js +0 -11
- package/dist/functions/on-change.js +0 -28
- package/dist/functions/register-component.js +0 -38
- package/dist/functions/register.js +0 -27
- package/dist/functions/sanitize-react-native-block-styles.js +0 -61
- package/dist/functions/set-editor-settings.js +0 -12
- package/dist/functions/set.js +0 -14
- package/dist/functions/track/helpers.js +0 -51
- package/dist/functions/track/index.js +0 -71
- package/dist/functions/track/interaction.js +0 -53
- package/dist/functions/transform-block-properties.js +0 -5
- package/dist/functions/transform-block.js +0 -4
- package/dist/helpers/ab-tests.js +0 -122
- package/dist/helpers/canTrack.js +0 -2
- package/dist/helpers/cookie.js +0 -55
- package/dist/helpers/css.js +0 -27
- package/dist/helpers/flatten.js +0 -19
- package/dist/helpers/localStorage.js +0 -24
- package/dist/helpers/logger.js +0 -7
- package/dist/helpers/nullable.js +0 -1
- package/dist/helpers/preview-lru-cache/get.js +0 -3
- package/dist/helpers/preview-lru-cache/helpers.js +0 -0
- package/dist/helpers/preview-lru-cache/init.js +0 -6
- package/dist/helpers/preview-lru-cache/set.js +0 -5
- package/dist/helpers/preview-lru-cache/types.js +0 -0
- package/dist/helpers/sessionId.js +0 -30
- package/dist/helpers/time.js +0 -2
- package/dist/helpers/url.js +0 -15
- package/dist/helpers/uuid.js +0 -15
- package/dist/helpers/visitorId.js +0 -30
- package/dist/index-helpers/blocks-exports.js +0 -19
- package/dist/index-helpers/top-of-file.js +0 -4
- package/dist/index.js +0 -11
- package/dist/scripts/init-editing.js +0 -110
- package/dist/types/api-version.js +0 -1
- package/dist/types/builder-block.js +0 -1
- package/dist/types/builder-content.js +0 -1
- package/dist/types/builder-props.js +0 -1
- package/dist/types/can-track.js +0 -1
- package/dist/types/components.js +0 -1
- package/dist/types/deep-partial.js +0 -1
- package/dist/types/element.js +0 -1
- package/dist/types/enforced-partials.js +0 -1
- package/dist/types/input.js +0 -1
- package/dist/types/targets.js +0 -1
- package/dist/types/typescript.js +0 -1
- /package/{dist → types}/blocks/BaseText.d.ts +0 -0
- /package/{dist → types}/blocks/button/button.d.ts +0 -0
- /package/{dist → types}/blocks/button/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/columns/columns.d.ts +0 -0
- /package/{dist → types}/blocks/columns/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/custom-code/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/custom-code/custom-code.d.ts +0 -0
- /package/{dist → types}/blocks/embed/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/embed/embed.d.ts +0 -0
- /package/{dist → types}/blocks/embed/helpers.d.ts +0 -0
- /package/{dist → types}/blocks/form/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/form/form.d.ts +0 -0
- /package/{dist → types}/blocks/fragment/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/fragment/fragment.d.ts +0 -0
- /package/{dist → types}/blocks/helpers.d.ts +0 -0
- /package/{dist → types}/blocks/image/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/image/image.d.ts +0 -0
- /package/{dist → types}/blocks/image/image.helpers.d.ts +0 -0
- /package/{dist → types}/blocks/img/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/img/img.d.ts +0 -0
- /package/{dist → types}/blocks/input/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/input/input.d.ts +0 -0
- /package/{dist → types}/blocks/raw-text/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/raw-text/raw-text.d.ts +0 -0
- /package/{dist → types}/blocks/section/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/section/section.d.ts +0 -0
- /package/{dist → types}/blocks/select/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/select/select.d.ts +0 -0
- /package/{dist → types}/blocks/submit-button/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/submit-button/submit-button.d.ts +0 -0
- /package/{dist → types}/blocks/symbol/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/symbol/symbol.d.ts +0 -0
- /package/{dist → types}/blocks/symbol/symbol.helpers.d.ts +0 -0
- /package/{dist → types}/blocks/text/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/text/text.d.ts +0 -0
- /package/{dist → types}/blocks/textarea/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/textarea/textarea.d.ts +0 -0
- /package/{dist → types}/blocks/video/component-info.d.ts +0 -0
- /package/{dist → types}/blocks/video/video.d.ts +0 -0
- /package/{dist → types}/components/block/block.d.ts +0 -0
- /package/{dist → types}/components/block/block.helpers.d.ts +0 -0
- /package/{dist → types}/components/block/components/block-styles.d.ts +0 -0
- /package/{dist → types}/components/block/components/block-wrapper.d.ts +0 -0
- /package/{dist → types}/components/block/components/component-ref/component-ref.d.ts +0 -0
- /package/{dist → types}/components/block/components/component-ref/component-ref.helpers.d.ts +0 -0
- /package/{dist → types}/components/block/components/interactive-element.d.ts +0 -0
- /package/{dist → types}/components/block/components/repeated-block.d.ts +0 -0
- /package/{dist → types}/components/block/types.d.ts +0 -0
- /package/{dist → types}/components/blocks/blocks-wrapper.d.ts +0 -0
- /package/{dist → types}/components/blocks/blocks.d.ts +0 -0
- /package/{dist → types}/components/content/components/enable-editor.d.ts +0 -0
- /package/{dist → types}/components/content/components/styles.d.ts +0 -0
- /package/{dist → types}/components/content/components/styles.helpers.d.ts +0 -0
- /package/{dist → types}/components/content/content.d.ts +0 -0
- /package/{dist → types}/components/content/content.helpers.d.ts +0 -0
- /package/{dist → types}/components/content/index.d.ts +0 -0
- /package/{dist → types}/components/content/wrap-component-ref.d.ts +0 -0
- /package/{dist → types}/components/content-variants/helpers.d.ts +0 -0
- /package/{dist → types}/components/inlined-script.d.ts +0 -0
- /package/{dist → types}/components/inlined-styles.d.ts +0 -0
- /package/{dist → types}/constants/builder-registered-components.d.ts +0 -0
- /package/{dist → types}/constants/device-sizes.d.ts +0 -0
- /package/{dist → types}/constants/target.d.ts +0 -0
- /package/{dist → types}/context/builder.context.d.ts +0 -0
- /package/{dist → types}/context/components.context.d.ts +0 -0
- /package/{dist → types}/context/types.d.ts +0 -0
- /package/{dist → types}/functions/apply-patch-with-mutation.d.ts +0 -0
- /package/{dist → types}/functions/camel-to-kebab-case.d.ts +0 -0
- /package/{dist/functions/evaluate → types/functions/evaluate/edge-runtime}/acorn-interpreter.d.ts +0 -0
- /package/{dist → types}/functions/event-handler-name.d.ts +0 -0
- /package/{dist → types}/functions/extract-text-styles.d.ts +0 -0
- /package/{dist → types}/functions/fast-clone.d.ts +0 -0
- /package/{dist → types}/functions/get-block-actions-handler.d.ts +0 -0
- /package/{dist → types}/functions/get-block-actions.d.ts +0 -0
- /package/{dist → types}/functions/get-block-component-options.d.ts +0 -0
- /package/{dist → types}/functions/get-block-properties.d.ts +0 -0
- /package/{dist → types}/functions/get-builder-search-params/index.d.ts +0 -0
- /package/{dist → types}/functions/get-content/generate-content-url.d.ts +0 -0
- /package/{dist → types}/functions/get-content/types.d.ts +0 -0
- /package/{dist → types}/functions/get-fetch.d.ts +0 -0
- /package/{dist → types}/functions/get-global-this.d.ts +0 -0
- /package/{dist → types}/functions/get-processed-block.d.ts +0 -0
- /package/{dist → types}/functions/get-react-native-block-styles.d.ts +0 -0
- /package/{dist → types}/functions/is-browser.d.ts +0 -0
- /package/{dist → types}/functions/is-editing.d.ts +0 -0
- /package/{dist → types}/functions/is-iframe.d.ts +0 -0
- /package/{dist → types}/functions/is-previewing.d.ts +0 -0
- /package/{dist → types}/functions/on-change.d.ts +0 -0
- /package/{dist → types}/functions/register-component.d.ts +0 -0
- /package/{dist → types}/functions/register.d.ts +0 -0
- /package/{dist → types}/functions/sanitize-react-native-block-styles.d.ts +0 -0
- /package/{dist → types}/functions/set-editor-settings.d.ts +0 -0
- /package/{dist → types}/functions/set.d.ts +0 -0
- /package/{dist → types}/functions/track/helpers.d.ts +0 -0
- /package/{dist → types}/functions/track/index.d.ts +0 -0
- /package/{dist → types}/functions/track/interaction.d.ts +0 -0
- /package/{dist → types}/functions/transform-block-properties.d.ts +0 -0
- /package/{dist → types}/functions/transform-block.d.ts +0 -0
- /package/{dist → types}/helpers/ab-tests.d.ts +0 -0
- /package/{dist → types}/helpers/canTrack.d.ts +0 -0
- /package/{dist → types}/helpers/cookie.d.ts +0 -0
- /package/{dist → types}/helpers/css.d.ts +0 -0
- /package/{dist → types}/helpers/flatten.d.ts +0 -0
- /package/{dist → types}/helpers/localStorage.d.ts +0 -0
- /package/{dist → types}/helpers/logger.d.ts +0 -0
- /package/{dist → types}/helpers/nullable.d.ts +0 -0
- /package/{dist → types}/helpers/preview-lru-cache/get.d.ts +0 -0
- /package/{dist → types}/helpers/preview-lru-cache/helpers.d.ts +0 -0
- /package/{dist → types}/helpers/preview-lru-cache/init.d.ts +0 -0
- /package/{dist → types}/helpers/preview-lru-cache/set.d.ts +0 -0
- /package/{dist → types}/helpers/preview-lru-cache/types.d.ts +0 -0
- /package/{dist → types}/helpers/sessionId.d.ts +0 -0
- /package/{dist → types}/helpers/time.d.ts +0 -0
- /package/{dist → types}/helpers/url.d.ts +0 -0
- /package/{dist → types}/helpers/uuid.d.ts +0 -0
- /package/{dist → types}/helpers/visitorId.d.ts +0 -0
- /package/{dist → types}/index-helpers/top-of-file.d.ts +0 -0
- /package/{dist → types}/scripts/init-editing.d.ts +0 -0
- /package/{dist → types}/types/api-version.d.ts +0 -0
- /package/{dist → types}/types/builder-block.d.ts +0 -0
- /package/{dist → types}/types/builder-content.d.ts +0 -0
- /package/{dist → types}/types/builder-props.d.ts +0 -0
- /package/{dist → types}/types/can-track.d.ts +0 -0
- /package/{dist → types}/types/components.d.ts +0 -0
- /package/{dist → types}/types/deep-partial.d.ts +0 -0
- /package/{dist → types}/types/element.d.ts +0 -0
- /package/{dist → types}/types/enforced-partials.d.ts +0 -0
- /package/{dist → types}/types/input.d.ts +0 -0
- /package/{dist → types}/types/targets.d.ts +0 -0
- /package/{dist → types}/types/typescript.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BuilderRenderState } from '../../context/types.js';
|
|
2
2
|
import type { EnforcePartials } from '../../types/enforced-partials.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ContentVariantsPrps } from '../content-variants/content-variants.types.js';
|
|
4
4
|
interface InternalRenderProps {
|
|
5
5
|
/**
|
|
6
6
|
* TO-DO: improve qwik generator to not remap this name for non-HTML tags, then name it `className`
|
|
@@ -9,7 +9,7 @@ interface InternalRenderProps {
|
|
|
9
9
|
showContent: boolean;
|
|
10
10
|
isSsrAbTest: boolean;
|
|
11
11
|
}
|
|
12
|
-
export type ContentProps = InternalRenderProps & EnforcePartials<
|
|
12
|
+
export type ContentProps = InternalRenderProps & EnforcePartials<ContentVariantsPrps>;
|
|
13
13
|
export interface BuilderComponentStateChange {
|
|
14
14
|
state: BuilderRenderState;
|
|
15
15
|
ref: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
type VariantsProviderProps =
|
|
2
|
+
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
|
-
import type {
|
|
8
|
+
import type { ContentVariantsPrps } from "./content-variants.types.js";
|
|
9
9
|
declare function ContentVariants(props: VariantsProviderProps): JSX.Element;
|
|
10
10
|
export default ContentVariants;
|
|
@@ -2,7 +2,7 @@ import type { BuilderRenderContext, RegisteredComponent } from '../../context/ty
|
|
|
2
2
|
import type { ApiVersion } from '../../types/api-version.js';
|
|
3
3
|
import type { BuilderContent } from '../../types/builder-content.js';
|
|
4
4
|
import type { Nullable } from '../../types/typescript.js';
|
|
5
|
-
export interface
|
|
5
|
+
export interface ContentVariantsPrps {
|
|
6
6
|
content?: Nullable<BuilderContent>;
|
|
7
7
|
model?: string;
|
|
8
8
|
data?: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SDK_VERSION = "0.6.0";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BuilderRenderState } from '../../../context/types.js';
|
|
2
|
+
import type { ExecutorArgs } from '../helpers.js';
|
|
3
|
+
export declare const runInBrowser: ({ code, builder, context, event, localState, rootSetState, rootState }: ExecutorArgs) => any;
|
|
4
|
+
export declare function flattenState(rootState: Record<string | symbol, any>, localState: Record<string | symbol, any> | undefined, rootSetState: ((rootState: BuilderRenderState) => void) | undefined): BuilderRenderState;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { runInBrowser as evaluator } from './browser.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { runInEdge as evaluator } from './edge-runtime.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ExecutorArgs } from './helpers.js';
|
|
2
|
+
export type EvaluatorArgs = Omit<ExecutorArgs, 'builder' | 'event'> & {
|
|
3
|
+
event?: Event;
|
|
4
|
+
isExpression?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression }: EvaluatorArgs): any;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BuilderContextInterface, BuilderRenderState } from '../../context/types.js';
|
|
2
|
+
import type { getUserAttributes } from '../track/helpers.js';
|
|
3
|
+
export type BuilderGlobals = {
|
|
4
|
+
isEditing: boolean | undefined;
|
|
5
|
+
isBrowser: boolean | undefined;
|
|
6
|
+
isServer: boolean | undefined;
|
|
7
|
+
getUserAttributes: typeof getUserAttributes;
|
|
8
|
+
};
|
|
9
|
+
export type ExecutorArgs = Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'> & {
|
|
10
|
+
code: string;
|
|
11
|
+
builder: BuilderGlobals;
|
|
12
|
+
event: Event | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type Executor = (args: ExecutorArgs) => any;
|
|
15
|
+
export type FunctionArguments = ReturnType<typeof getFunctionArguments>;
|
|
16
|
+
export declare const getFunctionArguments: ({ builder, context, event, state }: Pick<ExecutorArgs, "context" | "builder" | "event"> & {
|
|
17
|
+
state: BuilderRenderState;
|
|
18
|
+
}) => [string, Event | BuilderRenderState | import("../../context/types.js").BuilderRenderContext | BuilderGlobals][];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { evaluate } from './evaluate.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { evaluator } from '../browser-runtime/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ContentVariantsPrps } from '../components/content-variants/content-variants.types.js';
|
|
2
2
|
import type { Dictionary } from '../types/typescript.js';
|
|
3
3
|
import type { GetContentOptions } from './get-content/types.js';
|
|
4
4
|
type GetBuilderPropsOptions = (Omit<GetContentOptions, 'model'> & {
|
|
@@ -33,7 +33,8 @@ type GetBuilderPropsOptions = (Omit<GetContentOptions, 'model'> & {
|
|
|
33
33
|
searchParams?: undefined;
|
|
34
34
|
});
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Given an `apiKey` and `url` (or `path` + `searchParams`), provides all props that `Content` needs to render Builder Content.
|
|
37
|
+
*
|
|
37
38
|
*/
|
|
38
|
-
export declare const fetchBuilderProps: (_args: GetBuilderPropsOptions) => Promise<
|
|
39
|
+
export declare const fetchBuilderProps: (_args: GetBuilderPropsOptions) => Promise<ContentVariantsPrps>;
|
|
39
40
|
export {};
|
|
@@ -5,17 +5,16 @@ import type { GetContentOptions } from './types.js';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare function fetchOneEntry(options: GetContentOptions): Promise<BuilderContent | null>;
|
|
7
7
|
/**
|
|
8
|
-
* @deprecated
|
|
9
|
-
* Consider using `fetchBuilderProps` instead for easier setup.
|
|
8
|
+
* @deprecated `getContent` was renamed to `fetchOneEntry`. This is a temporary alias to avoid breaking changes.
|
|
10
9
|
*
|
|
11
|
-
* NOTE:
|
|
10
|
+
* NOTE: consider using `fetchBuilderProps` instead for easier setup.
|
|
12
11
|
*/
|
|
13
12
|
export declare const getContent: typeof fetchOneEntry;
|
|
14
13
|
type ContentResults = {
|
|
15
14
|
results: BuilderContent[];
|
|
16
15
|
};
|
|
17
16
|
/**
|
|
18
|
-
* Exported only for testing purposes.
|
|
17
|
+
* @internal Exported only for testing purposes. Do not use.
|
|
19
18
|
*/
|
|
20
19
|
export declare const _processContentResult: (options: GetContentOptions, content: ContentResults, url?: URL) => Promise<ContentResults>;
|
|
21
20
|
/**
|
|
@@ -23,7 +22,7 @@ export declare const _processContentResult: (options: GetContentOptions, content
|
|
|
23
22
|
*/
|
|
24
23
|
export declare function fetchEntries(options: GetContentOptions): Promise<ContentResults>;
|
|
25
24
|
/**
|
|
26
|
-
* @deprecated
|
|
25
|
+
* @deprecated `getAllContent` was renamed to `fetchEntries`. This is a temporary alias to avoid breaking changes.
|
|
27
26
|
*/
|
|
28
27
|
export declare const getAllContent: typeof fetchEntries;
|
|
29
28
|
export {};
|
|
@@ -10,10 +10,10 @@ import { default as Blocks } from '../components/blocks/blocks';
|
|
|
10
10
|
import { default as Content } from '../components/content-variants/content-variants';
|
|
11
11
|
export { Blocks, Content };
|
|
12
12
|
/**
|
|
13
|
-
* @deprecated
|
|
13
|
+
* @deprecated Renamed to `Blocks`.
|
|
14
14
|
*/
|
|
15
15
|
export declare const RenderBlocks: typeof Blocks;
|
|
16
16
|
/**
|
|
17
|
-
* @deprecated
|
|
17
|
+
* @deprecated Renamed to `Content`.
|
|
18
18
|
*/
|
|
19
19
|
export declare const RenderContent: typeof Content;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './index-helpers/top-of-file.js';
|
|
2
|
+
export * from './index-helpers/blocks-exports.js';
|
|
3
|
+
/**
|
|
4
|
+
* We have a separate entry point to the SDKs that guarantees no components are being imported. This is useful
|
|
5
|
+
* for React SDK, which would break in the NextJS App directory because the component imports have `use client` in them.
|
|
6
|
+
*/
|
|
7
|
+
export * from './server-index.js';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from './index-helpers/top-of-file.js';
|
|
2
|
-
export * from './index-helpers/blocks-exports.js';
|
|
3
2
|
export { isEditing } from './functions/is-editing.js';
|
|
4
3
|
export { isPreviewing } from './functions/is-previewing.js';
|
|
5
4
|
export { createRegisterComponentMessage } from './functions/register-component.js';
|
package/dist/blocks/BaseText.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { useContext } from "react";
|
|
4
|
-
import BuilderContext from "../context/builder.context.js";
|
|
5
|
-
function BaseText(props) {
|
|
6
|
-
const builderContext = useContext(BuilderContext);
|
|
7
|
-
return (React.createElement("span", { style: builderContext.inheritedStyles }, props.text));
|
|
8
|
-
}
|
|
9
|
-
export default BaseText;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
function Button(props) {
|
|
4
|
-
return (React.createElement(React.Fragment, null,
|
|
5
|
-
props.link ? (React.createElement(React.Fragment, null,
|
|
6
|
-
React.createElement("a", { role: "button", ...{}, ...props.attributes, href: props.link, target: props.openLinkInNewTab ? "_blank" : undefined }, props.text))) : (React.createElement(React.Fragment, null,
|
|
7
|
-
React.createElement("button", { ...{}, ...props.attributes, style: props.attributes.style, className: props.attributes.className + " button-7267e9c6" }, props.text))),
|
|
8
|
-
React.createElement("style", null, `.button-7267e9c6 {
|
|
9
|
-
all: unset;
|
|
10
|
-
}`)));
|
|
11
|
-
}
|
|
12
|
-
export default Button;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export const componentInfo = {
|
|
2
|
-
name: 'Core:Button',
|
|
3
|
-
image: 'https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13',
|
|
4
|
-
defaultStyles: {
|
|
5
|
-
// TODO: make min width more intuitive and set one
|
|
6
|
-
appearance: 'none',
|
|
7
|
-
paddingTop: '15px',
|
|
8
|
-
paddingBottom: '15px',
|
|
9
|
-
paddingLeft: '25px',
|
|
10
|
-
paddingRight: '25px',
|
|
11
|
-
backgroundColor: '#000000',
|
|
12
|
-
color: 'white',
|
|
13
|
-
borderRadius: '4px',
|
|
14
|
-
textAlign: 'center',
|
|
15
|
-
cursor: 'pointer'
|
|
16
|
-
},
|
|
17
|
-
inputs: [{
|
|
18
|
-
name: 'text',
|
|
19
|
-
type: 'text',
|
|
20
|
-
defaultValue: 'Click me!',
|
|
21
|
-
bubble: true
|
|
22
|
-
}, {
|
|
23
|
-
name: 'link',
|
|
24
|
-
type: 'url',
|
|
25
|
-
bubble: true
|
|
26
|
-
}, {
|
|
27
|
-
name: 'openLinkInNewTab',
|
|
28
|
-
type: 'boolean',
|
|
29
|
-
defaultValue: false,
|
|
30
|
-
friendlyName: 'Open link in new tab'
|
|
31
|
-
}],
|
|
32
|
-
static: true,
|
|
33
|
-
noWrap: true
|
|
34
|
-
};
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import Blocks from "../../components/blocks/blocks";
|
|
5
|
-
import { getSizesForBreakpoints } from "../../constants/device-sizes.js";
|
|
6
|
-
import InlinedStyles from "../../components/inlined-styles";
|
|
7
|
-
import { TARGET } from "../../constants/target.js";
|
|
8
|
-
function Columns(props) {
|
|
9
|
-
const [gutterSize, setGutterSize] = useState(() => typeof props.space === "number" ? props.space || 0 : 20);
|
|
10
|
-
const [cols, setCols] = useState(() => props.columns || []);
|
|
11
|
-
const [stackAt, setStackAt] = useState(() => props.stackColumnsAt || "tablet");
|
|
12
|
-
function getWidth(index) {
|
|
13
|
-
return cols[index]?.width || 100 / cols.length;
|
|
14
|
-
}
|
|
15
|
-
function getColumnCssWidth(index) {
|
|
16
|
-
const subtractWidth = (gutterSize * (cols.length - 1)) / cols.length;
|
|
17
|
-
return `calc(${getWidth(index)}% - ${subtractWidth}px)`;
|
|
18
|
-
}
|
|
19
|
-
function getTabletStyle({ stackedStyle, desktopStyle, }) {
|
|
20
|
-
return stackAt === "tablet" ? stackedStyle : desktopStyle;
|
|
21
|
-
}
|
|
22
|
-
function getMobileStyle({ stackedStyle, desktopStyle, }) {
|
|
23
|
-
return stackAt === "never" ? desktopStyle : stackedStyle;
|
|
24
|
-
}
|
|
25
|
-
const [flexDir, setFlexDir] = useState(() => props.stackColumnsAt === "never"
|
|
26
|
-
? "row"
|
|
27
|
-
: props.reverseColumnsWhenStacked
|
|
28
|
-
? "column-reverse"
|
|
29
|
-
: "column");
|
|
30
|
-
function columnsCssVars() {
|
|
31
|
-
return {
|
|
32
|
-
"--flex-dir": flexDir,
|
|
33
|
-
"--flex-dir-tablet": getTabletStyle({
|
|
34
|
-
stackedStyle: flexDir,
|
|
35
|
-
desktopStyle: "row",
|
|
36
|
-
}),
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function columnCssVars(index) {
|
|
40
|
-
const gutter = index === 0 ? 0 : gutterSize;
|
|
41
|
-
if (TARGET === "reactNative") {
|
|
42
|
-
return {
|
|
43
|
-
marginLeft: props.stackColumnsAt === "never" ? gutter : 0,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
const width = getColumnCssWidth(index);
|
|
47
|
-
const gutterPixels = `${gutter}px`;
|
|
48
|
-
const mobileWidth = "100%";
|
|
49
|
-
const mobileMarginLeft = 0;
|
|
50
|
-
const marginLeftKey = "marginLeft";
|
|
51
|
-
return {
|
|
52
|
-
width,
|
|
53
|
-
[marginLeftKey]: gutterPixels,
|
|
54
|
-
"--column-width-mobile": getMobileStyle({
|
|
55
|
-
stackedStyle: mobileWidth,
|
|
56
|
-
desktopStyle: width,
|
|
57
|
-
}),
|
|
58
|
-
"--column-margin-left-mobile": getMobileStyle({
|
|
59
|
-
stackedStyle: mobileMarginLeft,
|
|
60
|
-
desktopStyle: gutterPixels,
|
|
61
|
-
}),
|
|
62
|
-
"--column-width-tablet": getTabletStyle({
|
|
63
|
-
stackedStyle: mobileWidth,
|
|
64
|
-
desktopStyle: width,
|
|
65
|
-
}),
|
|
66
|
-
"--column-margin-left-tablet": getTabletStyle({
|
|
67
|
-
stackedStyle: mobileMarginLeft,
|
|
68
|
-
desktopStyle: gutterPixels,
|
|
69
|
-
}),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function getWidthForBreakpointSize(size) {
|
|
73
|
-
const breakpointSizes = getSizesForBreakpoints(props.builderContext.content?.meta?.breakpoints || {});
|
|
74
|
-
return breakpointSizes[size].max;
|
|
75
|
-
}
|
|
76
|
-
function columnsStyles() {
|
|
77
|
-
return `
|
|
78
|
-
@media (max-width: ${getWidthForBreakpointSize("medium")}px) {
|
|
79
|
-
.${props.builderBlock.id}-breakpoints {
|
|
80
|
-
flex-direction: var(--flex-dir-tablet);
|
|
81
|
-
align-items: stretch;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.${props.builderBlock.id}-breakpoints > .builder-column {
|
|
85
|
-
width: var(--column-width-tablet) !important;
|
|
86
|
-
margin-left: var(--column-margin-left-tablet) !important;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
@media (max-width: ${getWidthForBreakpointSize("small")}px) {
|
|
91
|
-
.${props.builderBlock.id}-breakpoints {
|
|
92
|
-
flex-direction: var(--flex-dir);
|
|
93
|
-
align-items: stretch;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.${props.builderBlock.id}-breakpoints > .builder-column {
|
|
97
|
-
width: var(--column-width-mobile) !important;
|
|
98
|
-
margin-left: var(--column-margin-left-mobile) !important;
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
`;
|
|
102
|
-
}
|
|
103
|
-
return (React.createElement(React.Fragment, null,
|
|
104
|
-
React.createElement("div", { className: `builder-columns ${props.builderBlock.id}-breakpoints` +
|
|
105
|
-
" div-9f5ab4f8", style: columnsCssVars(), ...{} },
|
|
106
|
-
TARGET !== "reactNative" ? (React.createElement(React.Fragment, null,
|
|
107
|
-
React.createElement(InlinedStyles, { styles: columnsStyles() }))) : null,
|
|
108
|
-
props.columns?.map((column, index) => (React.createElement("div", { className: "builder-column div-9f5ab4f8-2", style: columnCssVars(index), ...{}, key: index },
|
|
109
|
-
React.createElement(Blocks, { blocks: column.blocks, path: `component.options.columns.${index}.blocks`, parent: props.builderBlock.id, styleProp: {
|
|
110
|
-
flexGrow: "1",
|
|
111
|
-
}, context: props.builderContext, registeredComponents: props.builderComponents }))))),
|
|
112
|
-
React.createElement("style", null, `.div-9f5ab4f8 {
|
|
113
|
-
display: flex;
|
|
114
|
-
line-height: normal;
|
|
115
|
-
}.div-9f5ab4f8-2 {
|
|
116
|
-
display: flex;
|
|
117
|
-
flex-direction: column;
|
|
118
|
-
align-items: stretch;
|
|
119
|
-
}`)));
|
|
120
|
-
}
|
|
121
|
-
export default Columns;
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
export const componentInfo = {
|
|
2
|
-
// TODO: ways to statically preprocess JSON for references, functions, etc
|
|
3
|
-
name: 'Columns',
|
|
4
|
-
isRSC: true,
|
|
5
|
-
inputs: [{
|
|
6
|
-
name: 'columns',
|
|
7
|
-
type: 'array',
|
|
8
|
-
broadcast: true,
|
|
9
|
-
subFields: [{
|
|
10
|
-
name: 'blocks',
|
|
11
|
-
type: 'array',
|
|
12
|
-
hideFromUI: true,
|
|
13
|
-
defaultValue: [{
|
|
14
|
-
'@type': '@builder.io/sdk:Element',
|
|
15
|
-
responsiveStyles: {
|
|
16
|
-
large: {
|
|
17
|
-
display: 'flex',
|
|
18
|
-
flexDirection: 'column',
|
|
19
|
-
alignItems: 'stretch',
|
|
20
|
-
flexShrink: '0',
|
|
21
|
-
position: 'relative',
|
|
22
|
-
marginTop: '30px',
|
|
23
|
-
textAlign: 'center',
|
|
24
|
-
lineHeight: 'normal',
|
|
25
|
-
height: 'auto',
|
|
26
|
-
minHeight: '20px',
|
|
27
|
-
minWidth: '20px',
|
|
28
|
-
overflow: 'hidden'
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
component: {
|
|
32
|
-
name: 'Image',
|
|
33
|
-
options: {
|
|
34
|
-
image: 'https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d',
|
|
35
|
-
backgroundPosition: 'center',
|
|
36
|
-
backgroundSize: 'cover',
|
|
37
|
-
aspectRatio: 0.7004048582995948
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}, {
|
|
41
|
-
'@type': '@builder.io/sdk:Element',
|
|
42
|
-
responsiveStyles: {
|
|
43
|
-
large: {
|
|
44
|
-
display: 'flex',
|
|
45
|
-
flexDirection: 'column',
|
|
46
|
-
alignItems: 'stretch',
|
|
47
|
-
flexShrink: '0',
|
|
48
|
-
position: 'relative',
|
|
49
|
-
marginTop: '30px',
|
|
50
|
-
textAlign: 'center',
|
|
51
|
-
lineHeight: 'normal',
|
|
52
|
-
height: 'auto'
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
component: {
|
|
56
|
-
name: 'Text',
|
|
57
|
-
options: {
|
|
58
|
-
text: '<p>Enter some text...</p>'
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}]
|
|
62
|
-
}, {
|
|
63
|
-
name: 'width',
|
|
64
|
-
type: 'number',
|
|
65
|
-
hideFromUI: true,
|
|
66
|
-
helperText: 'Width %, e.g. set to 50 to fill half of the space'
|
|
67
|
-
}, {
|
|
68
|
-
name: 'link',
|
|
69
|
-
type: 'url',
|
|
70
|
-
helperText: 'Optionally set a url that clicking this column will link to'
|
|
71
|
-
}],
|
|
72
|
-
defaultValue: [{
|
|
73
|
-
blocks: [{
|
|
74
|
-
'@type': '@builder.io/sdk:Element',
|
|
75
|
-
responsiveStyles: {
|
|
76
|
-
large: {
|
|
77
|
-
display: 'flex',
|
|
78
|
-
flexDirection: 'column',
|
|
79
|
-
alignItems: 'stretch',
|
|
80
|
-
flexShrink: '0',
|
|
81
|
-
position: 'relative',
|
|
82
|
-
marginTop: '30px',
|
|
83
|
-
textAlign: 'center',
|
|
84
|
-
lineHeight: 'normal',
|
|
85
|
-
height: 'auto',
|
|
86
|
-
minHeight: '20px',
|
|
87
|
-
minWidth: '20px',
|
|
88
|
-
overflow: 'hidden'
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
component: {
|
|
92
|
-
name: 'Image',
|
|
93
|
-
options: {
|
|
94
|
-
image: 'https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d',
|
|
95
|
-
backgroundPosition: 'center',
|
|
96
|
-
backgroundSize: 'cover',
|
|
97
|
-
aspectRatio: 0.7004048582995948
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}, {
|
|
101
|
-
'@type': '@builder.io/sdk:Element',
|
|
102
|
-
responsiveStyles: {
|
|
103
|
-
large: {
|
|
104
|
-
display: 'flex',
|
|
105
|
-
flexDirection: 'column',
|
|
106
|
-
alignItems: 'stretch',
|
|
107
|
-
flexShrink: '0',
|
|
108
|
-
position: 'relative',
|
|
109
|
-
marginTop: '30px',
|
|
110
|
-
textAlign: 'center',
|
|
111
|
-
lineHeight: 'normal',
|
|
112
|
-
height: 'auto'
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
component: {
|
|
116
|
-
name: 'Text',
|
|
117
|
-
options: {
|
|
118
|
-
text: '<p>Enter some text...</p>'
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}]
|
|
122
|
-
}, {
|
|
123
|
-
blocks: [{
|
|
124
|
-
'@type': '@builder.io/sdk:Element',
|
|
125
|
-
responsiveStyles: {
|
|
126
|
-
large: {
|
|
127
|
-
display: 'flex',
|
|
128
|
-
flexDirection: 'column',
|
|
129
|
-
alignItems: 'stretch',
|
|
130
|
-
flexShrink: '0',
|
|
131
|
-
position: 'relative',
|
|
132
|
-
marginTop: '30px',
|
|
133
|
-
textAlign: 'center',
|
|
134
|
-
lineHeight: 'normal',
|
|
135
|
-
height: 'auto',
|
|
136
|
-
minHeight: '20px',
|
|
137
|
-
minWidth: '20px',
|
|
138
|
-
overflow: 'hidden'
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
component: {
|
|
142
|
-
name: 'Image',
|
|
143
|
-
options: {
|
|
144
|
-
image: 'https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d',
|
|
145
|
-
backgroundPosition: 'center',
|
|
146
|
-
backgroundSize: 'cover',
|
|
147
|
-
aspectRatio: 0.7004048582995948
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}, {
|
|
151
|
-
'@type': '@builder.io/sdk:Element',
|
|
152
|
-
responsiveStyles: {
|
|
153
|
-
large: {
|
|
154
|
-
display: 'flex',
|
|
155
|
-
flexDirection: 'column',
|
|
156
|
-
alignItems: 'stretch',
|
|
157
|
-
flexShrink: '0',
|
|
158
|
-
position: 'relative',
|
|
159
|
-
marginTop: '30px',
|
|
160
|
-
textAlign: 'center',
|
|
161
|
-
lineHeight: 'normal',
|
|
162
|
-
height: 'auto'
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
component: {
|
|
166
|
-
name: 'Text',
|
|
167
|
-
options: {
|
|
168
|
-
text: '<p>Enter some text...</p>'
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}]
|
|
172
|
-
}],
|
|
173
|
-
onChange: (options) => {
|
|
174
|
-
function clearWidths() {
|
|
175
|
-
columns.forEach(col => {
|
|
176
|
-
col.delete('width');
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
const columns = options.get('columns');
|
|
180
|
-
if (Array.isArray(columns)) {
|
|
181
|
-
const containsColumnWithWidth = !!columns.find(col => col.get('width'));
|
|
182
|
-
if (containsColumnWithWidth) {
|
|
183
|
-
const containsColumnWithoutWidth = !!columns.find(col => !col.get('width'));
|
|
184
|
-
if (containsColumnWithoutWidth) {
|
|
185
|
-
clearWidths();
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
const sumWidths = columns.reduce((memo, col) => {
|
|
189
|
-
return memo + col.get('width');
|
|
190
|
-
}, 0);
|
|
191
|
-
const widthsDontAddUp = sumWidths !== 100;
|
|
192
|
-
if (widthsDontAddUp) {
|
|
193
|
-
clearWidths();
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}, {
|
|
200
|
-
name: 'space',
|
|
201
|
-
type: 'number',
|
|
202
|
-
defaultValue: 20,
|
|
203
|
-
helperText: 'Size of gap between columns',
|
|
204
|
-
advanced: true
|
|
205
|
-
}, {
|
|
206
|
-
name: 'stackColumnsAt',
|
|
207
|
-
type: 'string',
|
|
208
|
-
defaultValue: 'tablet',
|
|
209
|
-
helperText: 'Convert horizontal columns to vertical at what device size',
|
|
210
|
-
enum: ['tablet', 'mobile', 'never'],
|
|
211
|
-
advanced: true
|
|
212
|
-
}, {
|
|
213
|
-
name: 'reverseColumnsWhenStacked',
|
|
214
|
-
type: 'boolean',
|
|
215
|
-
defaultValue: false,
|
|
216
|
-
helperText: 'When stacking columns for mobile devices, reverse the ordering',
|
|
217
|
-
advanced: true
|
|
218
|
-
}]
|
|
219
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export const componentInfo = {
|
|
2
|
-
name: 'Custom Code',
|
|
3
|
-
static: true,
|
|
4
|
-
requiredPermissions: ['editCode'],
|
|
5
|
-
inputs: [{
|
|
6
|
-
name: 'code',
|
|
7
|
-
type: 'html',
|
|
8
|
-
required: true,
|
|
9
|
-
defaultValue: '<p>Hello there, I am custom HTML code!</p>',
|
|
10
|
-
code: true
|
|
11
|
-
}, {
|
|
12
|
-
name: 'replaceNodes',
|
|
13
|
-
type: 'boolean',
|
|
14
|
-
helperText: 'Preserve server rendered dom nodes',
|
|
15
|
-
advanced: true
|
|
16
|
-
}, {
|
|
17
|
-
name: 'scriptsClientOnly',
|
|
18
|
-
type: 'boolean',
|
|
19
|
-
defaultValue: false,
|
|
20
|
-
helperText: 'Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads',
|
|
21
|
-
advanced: true
|
|
22
|
-
}]
|
|
23
|
-
};
|