@builder.io/react 2.0.4-6 → 2.0.4-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder-react-lite.cjs.js +1 -1
- package/dist/builder-react-lite.cjs.js.map +1 -1
- package/dist/builder-react-lite.esm.js +1 -1
- package/dist/builder-react-lite.esm.js.map +1 -1
- package/dist/builder-react.browser.js +1 -6
- package/dist/builder-react.browser.js.map +1 -1
- package/dist/builder-react.cjs.js +1 -1
- package/dist/builder-react.cjs.js.map +1 -1
- package/dist/builder-react.es5.js +1 -1
- package/dist/builder-react.es5.js.map +1 -1
- package/dist/builder-react.unpkg.js +1 -6
- package/dist/builder-react.unpkg.js.map +1 -1
- package/dist/lib/package.json +4 -2
- package/dist/lib/rollup.config.js +0 -2
- package/dist/lib/rollup.config.js.map +1 -1
- package/dist/lib/src/blocks/Columns.js +8 -8
- package/dist/lib/src/blocks/Columns.js.map +1 -1
- package/dist/lib/src/blocks/Image.js +12 -12
- package/dist/lib/src/blocks/Image.js.map +1 -1
- package/dist/lib/src/blocks/Mutation.js +6 -6
- package/dist/lib/src/blocks/Mutation.js.map +1 -1
- package/dist/lib/src/blocks/Router.js +9 -9
- package/dist/lib/src/blocks/Router.js.map +1 -1
- package/dist/lib/src/blocks/Section.js +6 -6
- package/dist/lib/src/blocks/Section.js.map +1 -1
- package/dist/lib/src/blocks/Slot.js +5 -5
- package/dist/lib/src/blocks/Slot.js.map +1 -1
- package/dist/lib/src/blocks/Symbol.js +8 -8
- package/dist/lib/src/blocks/Symbol.js.map +1 -1
- package/dist/lib/src/blocks/Text.js +6 -6
- package/dist/lib/src/blocks/Text.js.map +1 -1
- package/dist/lib/src/blocks/Video.js +8 -8
- package/dist/lib/src/blocks/Video.js.map +1 -1
- package/dist/lib/src/blocks/forms/Form.js +10 -10
- package/dist/lib/src/blocks/forms/Form.js.map +1 -1
- package/dist/lib/src/components/builder-block.component.js +28 -16
- package/dist/lib/src/components/builder-block.component.js.map +1 -1
- package/dist/lib/src/components/builder-blocks.component.js +7 -7
- package/dist/lib/src/components/builder-blocks.component.js.map +1 -1
- package/dist/lib/src/components/builder-component.component.js +72 -75
- package/dist/lib/src/components/builder-component.component.js.map +1 -1
- package/dist/lib/src/components/insert-spacer.component.js +7 -7
- package/dist/lib/src/components/insert-spacer.component.js.map +1 -1
- package/dist/types/src/blocks/Mutation.d.ts +2 -3
- package/dist/types/src/blocks/Slot.d.ts +2 -3
- package/dist/types/src/components/builder-block.component.d.ts +1 -2
- package/dist/types/src/components/builder-blocks.component.d.ts +1 -3
- package/dist/types/src/components/insert-spacer.component.d.ts +1 -3
- package/package.json +4 -2
- package/rollup.config.ts +0 -2
- package/src/blocks/Columns.tsx +1 -1
- package/src/blocks/Image.tsx +1 -1
- package/src/blocks/Mutation.tsx +1 -1
- package/src/blocks/Router.tsx +1 -1
- package/src/blocks/Section.tsx +1 -1
- package/src/blocks/Slot.tsx +1 -1
- package/src/blocks/Symbol.tsx +1 -1
- package/src/blocks/Text.tsx +2 -2
- package/src/blocks/Video.tsx +1 -1
- package/src/blocks/forms/Form.tsx +1 -1
- package/src/components/builder-block.component.tsx +17 -3
- package/src/components/builder-blocks.component.tsx +1 -1
- package/src/components/builder-component.component.tsx +1 -5
- package/src/components/insert-spacer.component.tsx +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
|
|
3
3
|
import { Builder, builder, BuilderElement, Component } from '@builder.io/sdk';
|
|
4
|
-
import { ClassNames, jsx } from '@emotion/
|
|
4
|
+
import { ClassNames, jsx } from '@emotion/core';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { Size, sizeNames, sizes } from '../constants/device-sizes.constant';
|
|
7
7
|
import { set } from '../functions/set';
|
|
@@ -11,6 +11,7 @@ import { BuilderStoreContext } from '../store/builder-store';
|
|
|
11
11
|
import { applyPatchWithMinimalMutationChain } from '../functions/apply-patch-with-mutation';
|
|
12
12
|
import { blockToHtmlString } from '../functions/block-to-html-string';
|
|
13
13
|
import { Link } from './Link';
|
|
14
|
+
import traverse from 'traverse';
|
|
14
15
|
|
|
15
16
|
const camelCaseToKebabCase = (str?: string) =>
|
|
16
17
|
str ? str.replace(/([A-Z])/g, g => `-${g[0].toLowerCase()}`) : '';
|
|
@@ -18,6 +19,19 @@ const camelCaseToKebabCase = (str?: string) =>
|
|
|
18
19
|
const kebabCaseToCamelCase = (str = '') =>
|
|
19
20
|
str.replace(/-([a-z])/g, match => match[1].toUpperCase());
|
|
20
21
|
|
|
22
|
+
const localizedType = '@builder.io/core:LocalizedValue';
|
|
23
|
+
const resolveLocalizedOptions = (options?: any, locale?: string) => {
|
|
24
|
+
if (!locale || !options) {
|
|
25
|
+
return options;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return traverse(options).map(function(el) {
|
|
29
|
+
if (el && el['@type'] === localizedType) {
|
|
30
|
+
this.update(el[locale] || el.Default)
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
21
35
|
const Device = { desktop: 0, tablet: 1, mobile: 2 };
|
|
22
36
|
|
|
23
37
|
const voidElements = new Set([
|
|
@@ -452,10 +466,10 @@ export class BuilderBlock extends React.Component<
|
|
|
452
466
|
}
|
|
453
467
|
}
|
|
454
468
|
|
|
455
|
-
const innerComponentProperties = (options.component || options.options) && {
|
|
469
|
+
const innerComponentProperties = resolveLocalizedOptions( (options.component || options.options) && {
|
|
456
470
|
...options.options,
|
|
457
471
|
...(options.component.options || options.component.data),
|
|
458
|
-
}
|
|
472
|
+
}, this.privateState.state.locale)
|
|
459
473
|
|
|
460
474
|
const isVoid = voidElements.has(TagName);
|
|
461
475
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ReactDOM from 'react-dom';
|
|
3
|
-
import { jsx, css
|
|
4
|
-
import createCache from '@emotion/cache';
|
|
3
|
+
import { jsx, css } from '@emotion/core';
|
|
5
4
|
import { BuilderContent, getContentWithInfo } from './builder-content.component';
|
|
6
5
|
import { BuilderBlocks } from './builder-blocks.component';
|
|
7
6
|
import {
|
|
@@ -101,7 +100,6 @@ const sizeMap = {
|
|
|
101
100
|
|
|
102
101
|
const fetchCache: { [key: string]: any } = {};
|
|
103
102
|
|
|
104
|
-
const cache = createCache({ key: 'builder'});
|
|
105
103
|
export interface BuilderComponentProps {
|
|
106
104
|
/**
|
|
107
105
|
* @package
|
|
@@ -944,7 +942,6 @@ export class BuilderComponent extends React.Component<
|
|
|
944
942
|
key={this.state.key}
|
|
945
943
|
ref={ref => (this.ref = ref)}
|
|
946
944
|
>
|
|
947
|
-
<CacheProvider value={cache}>
|
|
948
945
|
<BuilderMetaContext.Consumer>
|
|
949
946
|
{value => (
|
|
950
947
|
<BuilderMetaContext.Provider
|
|
@@ -1116,7 +1113,6 @@ export class BuilderComponent extends React.Component<
|
|
|
1116
1113
|
</BuilderMetaContext.Provider>
|
|
1117
1114
|
)}
|
|
1118
1115
|
</BuilderMetaContext.Consumer>
|
|
1119
|
-
</CacheProvider>
|
|
1120
1116
|
</WrapComponent>
|
|
1121
1117
|
);
|
|
1122
1118
|
}
|