@builder.io/react 3.1.1 → 3.1.2
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/CHANGELOG.md +46 -33
- 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 -1
- 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 -1
- package/dist/builder-react.unpkg.js.map +1 -1
- package/dist/lib/package.json +2 -2
- package/dist/lib/src/blocks/Image.js.map +1 -1
- package/dist/lib/src/blocks/Router.js.map +1 -1
- package/dist/lib/src/blocks/Section.js.map +1 -1
- package/dist/lib/src/blocks/StateProvider.js.map +1 -1
- package/dist/lib/src/blocks/Symbol.js.map +1 -1
- package/dist/lib/src/blocks/Video.js.map +1 -1
- package/dist/lib/src/components/Link.js.map +1 -1
- package/dist/lib/src/components/builder-component.component.js.map +1 -1
- package/dist/lib/src/components/variants-provider.component.js.map +1 -1
- package/dist/types/src/blocks/raw/RawText.d.ts +2 -1
- package/dist/types/src/components/Link.d.ts +1 -1
- package/dist/types/src/components/builder-block.component.d.ts +1 -1
- package/dist/types/src/components/builder-component.component.d.ts +3 -4
- package/dist/types/src/components/builder-content.component.d.ts +16 -4
- package/dist/types/src/components/variants-provider.component.d.ts +1 -1
- package/dist/types/src/functions/no-wrap.d.ts +2 -0
- package/dist/types/src/functions/safe-dynamic-require.d.ts +0 -3
- package/package.json +3 -3
- package/src/blocks/Image.tsx +1 -1
- package/src/blocks/Router.tsx +2 -2
- package/src/blocks/Section.tsx +5 -2
- package/src/blocks/StateProvider.tsx +2 -2
- package/src/blocks/Symbol.tsx +2 -2
- package/src/blocks/Video.tsx +20 -18
- package/src/components/Link.tsx +1 -1
- package/src/components/builder-component.component.tsx +2 -2
- package/src/components/variants-provider.component.tsx +1 -4
- package/tsconfig.json +1 -0
package/src/blocks/Router.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/core';
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { PropsWithChildren } from 'react';
|
|
4
4
|
import { BuilderElement, builder, Builder } from '@builder.io/sdk';
|
|
5
5
|
import { BuilderStoreContext } from '../store/builder-store';
|
|
6
6
|
import { BuilderComponent } from '../components/builder-component.component';
|
|
@@ -55,7 +55,7 @@ export interface RouteEvent {
|
|
|
55
55
|
preventDefault(): void;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
class RouterComponent extends React.Component<RouterProps
|
|
58
|
+
class RouterComponent extends React.Component<PropsWithChildren<RouterProps>> {
|
|
59
59
|
builder = builder;
|
|
60
60
|
|
|
61
61
|
routed = false;
|
package/src/blocks/Section.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/core';
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { PropsWithChildren } from 'react';
|
|
4
4
|
import { BuilderElement } from '@builder.io/sdk';
|
|
5
5
|
import { BuilderBlock as BuilderBlockComponent } from '../components/builder-block.component';
|
|
6
6
|
import { withBuilder } from '../functions/with-builder';
|
|
@@ -14,7 +14,10 @@ interface SectionProps {
|
|
|
14
14
|
lazyStyles?: any;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
class SectionComponent extends React.Component<
|
|
17
|
+
class SectionComponent extends React.Component<
|
|
18
|
+
PropsWithChildren<SectionProps>,
|
|
19
|
+
{ inView?: boolean }
|
|
20
|
+
> {
|
|
18
21
|
ref: HTMLElement | null = null;
|
|
19
22
|
|
|
20
23
|
unmountCallbacks: Function[] = [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { PropsWithChildren } from 'react';
|
|
3
3
|
import { BuilderElement } from '@builder.io/sdk';
|
|
4
4
|
import { BuilderBlock as BuilderBlockComponent } from '../components/builder-block.component';
|
|
5
5
|
import { BuilderStoreContext } from '../store/builder-store';
|
|
@@ -11,7 +11,7 @@ interface StateProviderProps {
|
|
|
11
11
|
context?: any;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
class StateProviderComponent extends React.Component<StateProviderProps
|
|
14
|
+
class StateProviderComponent extends React.Component<PropsWithChildren<StateProviderProps>> {
|
|
15
15
|
render() {
|
|
16
16
|
return (
|
|
17
17
|
<BuilderStoreContext.Consumer>
|
package/src/blocks/Symbol.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/core';
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { PropsWithChildren } from 'react';
|
|
4
4
|
import { BuilderComponent } from '../components/builder-component.component';
|
|
5
5
|
import { Builder, BuilderElement } from '@builder.io/sdk';
|
|
6
6
|
import hash from 'hash-sum';
|
|
@@ -47,7 +47,7 @@ export interface SymbolProps {
|
|
|
47
47
|
inheritState?: boolean;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
class SymbolComponent extends React.Component<SymbolProps
|
|
50
|
+
class SymbolComponent extends React.Component<PropsWithChildren<SymbolProps>> {
|
|
51
51
|
ref: BuilderComponent | null = null;
|
|
52
52
|
staticRef: HTMLDivElement | null = null;
|
|
53
53
|
|
package/src/blocks/Video.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/core';
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { PropsWithChildren } from 'react';
|
|
4
4
|
|
|
5
5
|
import { throttle } from '../functions/throttle';
|
|
6
6
|
import { withChildren } from '../functions/with-children';
|
|
@@ -8,23 +8,25 @@ import { Builder } from '@builder.io/sdk';
|
|
|
8
8
|
|
|
9
9
|
const DEFAULT_ASPECT_RATIO = 0.7004048582995948;
|
|
10
10
|
|
|
11
|
-
class VideoComponent extends React.Component<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
11
|
+
class VideoComponent extends React.Component<
|
|
12
|
+
PropsWithChildren<{
|
|
13
|
+
video: string;
|
|
14
|
+
autoPlay?: boolean;
|
|
15
|
+
controls?: boolean;
|
|
16
|
+
muted?: boolean;
|
|
17
|
+
loop?: boolean;
|
|
18
|
+
playsInline?: boolean;
|
|
19
|
+
aspectRatio?: number;
|
|
20
|
+
width?: number;
|
|
21
|
+
height?: number;
|
|
22
|
+
fit?: 'contain' | 'cover' | 'fill';
|
|
23
|
+
preload?: 'auto' | 'metadata' | 'none';
|
|
24
|
+
position?: string;
|
|
25
|
+
posterImage?: string;
|
|
26
|
+
lazyLoad?: boolean;
|
|
27
|
+
fitContent?: boolean;
|
|
28
|
+
}>
|
|
29
|
+
> {
|
|
28
30
|
video: HTMLVideoElement | null = null;
|
|
29
31
|
containerRef: HTMLElement | null = null;
|
|
30
32
|
|
package/src/components/Link.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import { BuilderStoreContext } from '../store/builder-store';
|
|
|
8
8
|
* custom Link component (e.g Next, Gatsby, React Router)
|
|
9
9
|
* <BuilderComponent renderLink=(props) => <myCustomLink {...props} /> />
|
|
10
10
|
*/
|
|
11
|
-
export const Link: React.
|
|
11
|
+
export const Link = (props: React.AnchorHTMLAttributes<HTMLAnchorElement>) => (
|
|
12
12
|
<BuilderStoreContext.Consumer>
|
|
13
13
|
{context => {
|
|
14
14
|
if (context.renderLink) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { PropsWithChildren } from 'react';
|
|
3
3
|
import ReactDOM from 'react-dom';
|
|
4
4
|
import { jsx, css } from '@emotion/core';
|
|
5
5
|
import { BuilderContent, getContentWithInfo } from './builder-content.component';
|
|
@@ -336,7 +336,7 @@ function searchToObject(location: Location | Url) {
|
|
|
336
336
|
* `props.content`.
|
|
337
337
|
*/
|
|
338
338
|
export class BuilderComponent extends React.Component<
|
|
339
|
-
BuilderComponentProps
|
|
339
|
+
PropsWithChildren<BuilderComponentProps>,
|
|
340
340
|
BuilderComponentState
|
|
341
341
|
> {
|
|
342
342
|
static defaults: Pick<BuilderComponentProps, 'codegen'> = {
|
|
@@ -101,10 +101,7 @@ interface VariantsProviderProps {
|
|
|
101
101
|
children: (variants: BuilderContent[], renderScript?: () => JSX.Element) => JSX.Element;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
export const VariantsProvider:
|
|
105
|
-
initialContent,
|
|
106
|
-
children,
|
|
107
|
-
}) => {
|
|
104
|
+
export const VariantsProvider = ({ initialContent, children }: VariantsProviderProps) => {
|
|
108
105
|
if (Builder.isBrowser && !builder.canTrack) {
|
|
109
106
|
return children([initialContent]);
|
|
110
107
|
}
|