@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.
Files changed (42) hide show
  1. package/CHANGELOG.md +46 -33
  2. package/dist/builder-react-lite.cjs.js +1 -1
  3. package/dist/builder-react-lite.cjs.js.map +1 -1
  4. package/dist/builder-react-lite.esm.js +1 -1
  5. package/dist/builder-react-lite.esm.js.map +1 -1
  6. package/dist/builder-react.browser.js +1 -1
  7. package/dist/builder-react.browser.js.map +1 -1
  8. package/dist/builder-react.cjs.js +1 -1
  9. package/dist/builder-react.cjs.js.map +1 -1
  10. package/dist/builder-react.es5.js +1 -1
  11. package/dist/builder-react.es5.js.map +1 -1
  12. package/dist/builder-react.unpkg.js +1 -1
  13. package/dist/builder-react.unpkg.js.map +1 -1
  14. package/dist/lib/package.json +2 -2
  15. package/dist/lib/src/blocks/Image.js.map +1 -1
  16. package/dist/lib/src/blocks/Router.js.map +1 -1
  17. package/dist/lib/src/blocks/Section.js.map +1 -1
  18. package/dist/lib/src/blocks/StateProvider.js.map +1 -1
  19. package/dist/lib/src/blocks/Symbol.js.map +1 -1
  20. package/dist/lib/src/blocks/Video.js.map +1 -1
  21. package/dist/lib/src/components/Link.js.map +1 -1
  22. package/dist/lib/src/components/builder-component.component.js.map +1 -1
  23. package/dist/lib/src/components/variants-provider.component.js.map +1 -1
  24. package/dist/types/src/blocks/raw/RawText.d.ts +2 -1
  25. package/dist/types/src/components/Link.d.ts +1 -1
  26. package/dist/types/src/components/builder-block.component.d.ts +1 -1
  27. package/dist/types/src/components/builder-component.component.d.ts +3 -4
  28. package/dist/types/src/components/builder-content.component.d.ts +16 -4
  29. package/dist/types/src/components/variants-provider.component.d.ts +1 -1
  30. package/dist/types/src/functions/no-wrap.d.ts +2 -0
  31. package/dist/types/src/functions/safe-dynamic-require.d.ts +0 -3
  32. package/package.json +3 -3
  33. package/src/blocks/Image.tsx +1 -1
  34. package/src/blocks/Router.tsx +2 -2
  35. package/src/blocks/Section.tsx +5 -2
  36. package/src/blocks/StateProvider.tsx +2 -2
  37. package/src/blocks/Symbol.tsx +2 -2
  38. package/src/blocks/Video.tsx +20 -18
  39. package/src/components/Link.tsx +1 -1
  40. package/src/components/builder-component.component.tsx +2 -2
  41. package/src/components/variants-provider.component.tsx +1 -4
  42. package/tsconfig.json +1 -0
@@ -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;
@@ -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<SectionProps, { inView?: boolean }> {
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>
@@ -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
 
@@ -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
- video: string;
13
- autoPlay?: boolean;
14
- controls?: boolean;
15
- muted?: boolean;
16
- loop?: boolean;
17
- playsInline?: boolean;
18
- aspectRatio?: number;
19
- width?: number;
20
- height?: number;
21
- fit?: 'contain' | 'cover' | 'fill';
22
- preload?: 'auto' | 'metadata' | 'none';
23
- position?: string;
24
- posterImage?: string;
25
- lazyLoad?: boolean;
26
- fitContent?: boolean;
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
 
@@ -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.SFC<React.AnchorHTMLAttributes<HTMLAnchorElement>> = props => (
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: React.SFC<VariantsProviderProps> = ({
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
  }
package/tsconfig.json CHANGED
@@ -7,6 +7,7 @@
7
7
  "module": "es2015",
8
8
  "lib": ["dom", "es5", "es2015.promise"],
9
9
  "strict": true,
10
+ "noImplicitAny": false,
10
11
  "sourceMap": true,
11
12
  "declaration": true,
12
13
  "skipLibCheck": true,