@builder.io/react 8.0.6-1 → 8.0.6-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/dist/builder-react-lite.cjs.js +2 -0
- package/dist/builder-react-lite.cjs.js.map +1 -0
- package/dist/builder-react-lite.esm.js +2 -0
- package/dist/builder-react-lite.esm.js.map +1 -0
- package/dist/builder-react.browser.js +11 -0
- package/dist/builder-react.browser.js.map +1 -0
- package/dist/builder-react.cjs.js +2 -0
- package/dist/builder-react.cjs.js.map +1 -0
- package/dist/builder-react.es5.js +2 -0
- package/dist/builder-react.es5.js.map +1 -0
- package/dist/builder-react.unpkg.js +11 -0
- package/dist/builder-react.unpkg.js.map +1 -0
- package/dist/lib/lib/on-change.js +228 -0
- package/dist/lib/lib/on-change.js.map +1 -0
- package/dist/lib/package.json +110 -0
- package/dist/lib/rollup.config.js +131 -0
- package/dist/lib/rollup.config.js.map +1 -0
- package/dist/lib/src/blocks/Button.js +86 -0
- package/dist/lib/src/blocks/Button.js.map +1 -0
- package/dist/lib/src/blocks/Columns.js +243 -0
- package/dist/lib/src/blocks/Columns.js.map +1 -0
- package/dist/lib/src/blocks/CustomCode.js +227 -0
- package/dist/lib/src/blocks/CustomCode.js.map +1 -0
- package/dist/lib/src/blocks/Embed.js +114 -0
- package/dist/lib/src/blocks/Embed.js.map +1 -0
- package/dist/lib/src/blocks/Fragment.js +45 -0
- package/dist/lib/src/blocks/Fragment.js.map +1 -0
- package/dist/lib/src/blocks/Image.js +532 -0
- package/dist/lib/src/blocks/Image.js.map +1 -0
- package/dist/lib/src/blocks/Mutation.js +93 -0
- package/dist/lib/src/blocks/Mutation.js.map +1 -0
- package/dist/lib/src/blocks/PersonalizationContainer.js +174 -0
- package/dist/lib/src/blocks/PersonalizationContainer.js.map +1 -0
- package/dist/lib/src/blocks/Router.js +354 -0
- package/dist/lib/src/blocks/Router.js.map +1 -0
- package/dist/lib/src/blocks/Section.js +150 -0
- package/dist/lib/src/blocks/Section.js.map +1 -0
- package/dist/lib/src/blocks/Slot.js +41 -0
- package/dist/lib/src/blocks/Slot.js.map +1 -0
- package/dist/lib/src/blocks/StateProvider.js +61 -0
- package/dist/lib/src/blocks/StateProvider.js.map +1 -0
- package/dist/lib/src/blocks/Symbol.js +192 -0
- package/dist/lib/src/blocks/Symbol.js.map +1 -0
- package/dist/lib/src/blocks/Text.js +132 -0
- package/dist/lib/src/blocks/Text.js.map +1 -0
- package/dist/lib/src/blocks/Video.js +261 -0
- package/dist/lib/src/blocks/Video.js.map +1 -0
- package/dist/lib/src/blocks/forms/Button.js +74 -0
- package/dist/lib/src/blocks/forms/Button.js.map +1 -0
- package/dist/lib/src/blocks/forms/Form.js +590 -0
- package/dist/lib/src/blocks/forms/Form.js.map +1 -0
- package/dist/lib/src/blocks/forms/Input.js +133 -0
- package/dist/lib/src/blocks/forms/Input.js.map +1 -0
- package/dist/lib/src/blocks/forms/Label.js +81 -0
- package/dist/lib/src/blocks/forms/Label.js.map +1 -0
- package/dist/lib/src/blocks/forms/Select.js +104 -0
- package/dist/lib/src/blocks/forms/Select.js.map +1 -0
- package/dist/lib/src/blocks/forms/TextArea.js +89 -0
- package/dist/lib/src/blocks/forms/TextArea.js.map +1 -0
- package/dist/lib/src/blocks/raw/Img.js +66 -0
- package/dist/lib/src/blocks/raw/Img.js.map +1 -0
- package/dist/lib/src/blocks/raw/RawText.js +47 -0
- package/dist/lib/src/blocks/raw/RawText.js.map +1 -0
- package/dist/lib/src/builder-react-lite.js +31 -0
- package/dist/lib/src/builder-react-lite.js.map +1 -0
- package/dist/lib/src/builder-react.js +106 -0
- package/dist/lib/src/builder-react.js.map +1 -0
- package/dist/lib/src/components/Link.js +35 -0
- package/dist/lib/src/components/Link.js.map +1 -0
- package/dist/lib/src/components/builder-block.component.js +556 -0
- package/dist/lib/src/components/builder-block.component.js.map +1 -0
- package/dist/lib/src/components/builder-blocks.component.js +167 -0
- package/dist/lib/src/components/builder-blocks.component.js.map +1 -0
- package/dist/lib/src/components/builder-component.component.js +1126 -0
- package/dist/lib/src/components/builder-component.component.js.map +1 -0
- package/dist/lib/src/components/builder-content.component.js +321 -0
- package/dist/lib/src/components/builder-content.component.js.map +1 -0
- package/dist/lib/src/components/insert-spacer.component.js +106 -0
- package/dist/lib/src/components/insert-spacer.component.js.map +1 -0
- package/dist/lib/src/components/no-wrap.js +7 -0
- package/dist/lib/src/components/no-wrap.js.map +1 -0
- package/dist/lib/src/components/variants-provider.component.js +108 -0
- package/dist/lib/src/components/variants-provider.component.js.map +1 -0
- package/dist/lib/src/constants/device-sizes.constant.js +91 -0
- package/dist/lib/src/constants/device-sizes.constant.js.map +1 -0
- package/dist/lib/src/constants/file-types.constant.js +72 -0
- package/dist/lib/src/constants/file-types.constant.js.map +1 -0
- package/dist/lib/src/decorators/builder-block.decorator.js +10 -0
- package/dist/lib/src/decorators/builder-block.decorator.js.map +1 -0
- package/dist/lib/src/functions/apply-patch-with-mutation.js +80 -0
- package/dist/lib/src/functions/apply-patch-with-mutation.js.map +1 -0
- package/dist/lib/src/functions/apply-patch-with-mutation.test.js +54 -0
- package/dist/lib/src/functions/apply-patch-with-mutation.test.js.map +1 -0
- package/dist/lib/src/functions/block-to-html-string.js +21 -0
- package/dist/lib/src/functions/block-to-html-string.js.map +1 -0
- package/dist/lib/src/functions/debonce-next-tick.js +43 -0
- package/dist/lib/src/functions/debonce-next-tick.js.map +1 -0
- package/dist/lib/src/functions/extract-localized-values.js +35 -0
- package/dist/lib/src/functions/extract-localized-values.js.map +1 -0
- package/dist/lib/src/functions/filter-with-custom-targeting.js +88 -0
- package/dist/lib/src/functions/filter-with-custom-targeting.js.map +1 -0
- package/dist/lib/src/functions/get-builder-pixel.js +27 -0
- package/dist/lib/src/functions/get-builder-pixel.js.map +1 -0
- package/dist/lib/src/functions/get.js +12 -0
- package/dist/lib/src/functions/get.js.map +1 -0
- package/dist/lib/src/functions/is-debug.js +8 -0
- package/dist/lib/src/functions/is-debug.js.map +1 -0
- package/dist/lib/src/functions/no-wrap.js +60 -0
- package/dist/lib/src/functions/no-wrap.js.map +1 -0
- package/dist/lib/src/functions/safe-dynamic-require.js +51 -0
- package/dist/lib/src/functions/safe-dynamic-require.js.map +1 -0
- package/dist/lib/src/functions/set.js +21 -0
- package/dist/lib/src/functions/set.js.map +1 -0
- package/dist/lib/src/functions/should-force-browser-runtime-in-node.js +22 -0
- package/dist/lib/src/functions/should-force-browser-runtime-in-node.js.map +1 -0
- package/dist/lib/src/functions/string-to-function.js +166 -0
- package/dist/lib/src/functions/string-to-function.js.map +1 -0
- package/dist/lib/src/functions/throttle.js +42 -0
- package/dist/lib/src/functions/throttle.js.map +1 -0
- package/dist/lib/src/functions/traverse.js +72 -0
- package/dist/lib/src/functions/traverse.js.map +1 -0
- package/dist/lib/src/functions/try-eval.js +75 -0
- package/dist/lib/src/functions/try-eval.js.map +1 -0
- package/dist/lib/src/functions/update-metadata.js +42 -0
- package/dist/lib/src/functions/update-metadata.js.map +1 -0
- package/dist/lib/src/functions/utils.js +20 -0
- package/dist/lib/src/functions/utils.js.map +1 -0
- package/dist/lib/src/functions/with-builder.js +10 -0
- package/dist/lib/src/functions/with-builder.js.map +1 -0
- package/dist/lib/src/functions/with-children.js +77 -0
- package/dist/lib/src/functions/with-children.js.map +1 -0
- package/dist/lib/src/hooks/useIsPreviewing.js +16 -0
- package/dist/lib/src/hooks/useIsPreviewing.js.map +1 -0
- package/dist/lib/src/scripts/init-editing.js +18 -0
- package/dist/lib/src/scripts/init-editing.js.map +1 -0
- package/dist/lib/src/sdk-version.js +5 -0
- package/dist/lib/src/sdk-version.js.map +1 -0
- package/dist/lib/src/store/builder-async-requests.js +19 -0
- package/dist/lib/src/store/builder-async-requests.js.map +1 -0
- package/dist/lib/src/store/builder-meta.js +13 -0
- package/dist/lib/src/store/builder-meta.js.map +1 -0
- package/dist/lib/src/store/builder-store.js +15 -0
- package/dist/lib/src/store/builder-store.js.map +1 -0
- package/dist/lib/src/to-error.js +22 -0
- package/dist/lib/src/to-error.js.map +1 -0
- package/dist/lib/test/basic.test.js +212 -0
- package/dist/lib/test/basic.test.js.map +1 -0
- package/dist/lib/test/functions/render-block.js +24 -0
- package/dist/lib/test/functions/render-block.js.map +1 -0
- package/dist/lib/test/image.test.js +107 -0
- package/dist/lib/test/image.test.js.map +1 -0
- package/dist/lib/test/setupTests.js +8 -0
- package/dist/lib/test/setupTests.js.map +1 -0
- package/dist/types/lib/on-change.d.ts +8 -0
- package/dist/types/rollup.config.d.ts +44 -0
- package/dist/types/src/blocks/Button.d.ts +7 -0
- package/dist/types/src/blocks/Columns.d.ts +1 -0
- package/dist/types/src/blocks/CustomCode.d.ts +1 -0
- package/dist/types/src/blocks/Embed.d.ts +1 -0
- package/dist/types/src/blocks/Fragment.d.ts +5 -0
- package/dist/types/src/blocks/Image.d.ts +6 -0
- package/dist/types/src/blocks/Mutation.d.ts +8 -0
- package/dist/types/src/blocks/PersonalizationContainer.d.ts +19 -0
- package/dist/types/src/blocks/Router.d.ts +32 -0
- package/dist/types/src/blocks/Section.d.ts +1 -0
- package/dist/types/src/blocks/Slot.d.ts +5 -0
- package/dist/types/src/blocks/StateProvider.d.ts +1 -0
- package/dist/types/src/blocks/Symbol.d.ts +19 -0
- package/dist/types/src/blocks/Text.d.ts +6 -0
- package/dist/types/src/blocks/Video.d.ts +1 -0
- package/dist/types/src/blocks/forms/Button.d.ts +5 -0
- package/dist/types/src/blocks/forms/Form.d.ts +24 -0
- package/dist/types/src/blocks/forms/Input.d.ts +10 -0
- package/dist/types/src/blocks/forms/Label.d.ts +8 -0
- package/dist/types/src/blocks/forms/Select.d.ts +12 -0
- package/dist/types/src/blocks/forms/TextArea.d.ts +9 -0
- package/dist/types/src/blocks/raw/Img.d.ts +7 -0
- package/dist/types/src/blocks/raw/RawText.d.ts +8 -0
- package/dist/types/src/builder-react-lite.d.ts +17 -0
- package/dist/types/src/builder-react.d.ts +45 -0
- package/dist/types/src/components/Link.d.ts +9 -0
- package/dist/types/src/components/builder-block.component.d.ts +50 -0
- package/dist/types/src/components/builder-blocks.component.d.ts +29 -0
- package/dist/types/src/components/builder-component.component.d.ts +324 -0
- package/dist/types/src/components/builder-content.component.d.ts +271 -0
- package/dist/types/src/components/insert-spacer.component.d.ts +13 -0
- package/dist/types/src/components/no-wrap.d.ts +2 -0
- package/dist/types/src/components/variants-provider.component.d.ts +8 -0
- package/dist/types/src/constants/device-sizes.constant.d.ts +57 -0
- package/dist/types/src/constants/file-types.constant.d.ts +2 -0
- package/dist/types/src/decorators/builder-block.decorator.d.ts +5 -0
- package/dist/types/src/functions/apply-patch-with-mutation.d.ts +5 -0
- package/dist/types/src/functions/apply-patch-with-mutation.test.d.ts +1 -0
- package/dist/types/src/functions/block-to-html-string.d.ts +3 -0
- package/dist/types/src/functions/debonce-next-tick.d.ts +2 -0
- package/dist/types/src/functions/extract-localized-values.d.ts +2 -0
- package/dist/types/src/functions/filter-with-custom-targeting.d.ts +15 -0
- package/dist/types/src/functions/get-builder-pixel.d.ts +2 -0
- package/dist/types/src/functions/get.d.ts +1 -0
- package/dist/types/src/functions/is-debug.d.ts +1 -0
- package/dist/types/src/functions/no-wrap.d.ts +33 -0
- package/dist/types/src/functions/safe-dynamic-require.d.ts +3 -0
- package/dist/types/src/functions/set.d.ts +1 -0
- package/dist/types/src/functions/should-force-browser-runtime-in-node.d.ts +1 -0
- package/dist/types/src/functions/string-to-function.d.ts +7 -0
- package/dist/types/src/functions/throttle.d.ts +1 -0
- package/dist/types/src/functions/traverse.d.ts +34 -0
- package/dist/types/src/functions/try-eval.d.ts +1 -0
- package/dist/types/src/functions/update-metadata.d.ts +17 -0
- package/dist/types/src/functions/utils.d.ts +2 -0
- package/dist/types/src/functions/with-builder.d.ts +2 -0
- package/dist/types/src/functions/with-children.d.ts +29 -0
- package/dist/types/src/hooks/useIsPreviewing.d.ts +1 -0
- package/dist/types/src/scripts/init-editing.d.ts +1 -0
- package/dist/types/src/sdk-version.d.ts +1 -0
- package/dist/types/src/store/builder-async-requests.d.ts +13 -0
- package/dist/types/src/store/builder-meta.d.ts +6 -0
- package/dist/types/src/store/builder-store.d.ts +10 -0
- package/dist/types/src/to-error.d.ts +13 -0
- package/dist/types/test/basic.test.d.ts +4 -0
- package/dist/types/test/functions/render-block.d.ts +3 -0
- package/dist/types/test/image.test.d.ts +1 -0
- package/dist/types/test/setupTests.d.ts +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type UserAttributes = {
|
|
2
|
+
date?: string | Date;
|
|
3
|
+
urlPath?: string;
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
};
|
|
6
|
+
type QueryOperator = 'is' | 'isNot' | 'contains' | 'startsWith' | 'endsWith' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqualTo' | 'lessThanOrEqualTo';
|
|
7
|
+
type QueryValue = string | number | boolean | Array<string | number | boolean>;
|
|
8
|
+
export type Query = {
|
|
9
|
+
property: string;
|
|
10
|
+
operator: QueryOperator;
|
|
11
|
+
value: QueryValue;
|
|
12
|
+
};
|
|
13
|
+
export declare const filterWithCustomTargetingScript = "function filterWithCustomTargeting(e,t,n,r){var i={query:t,startDate:n,endDate:r},o=e.date&&new Date(e.date)||new Date;return!(i.startDate&&new Date(i.startDate)>o)&&(!(i.endDate&&new Date(i.endDate)<o)&&(!i.query||!i.query.length||i.query.every((function(t){return objectMatchesQuery(e,t)}))))}function isString(e){return\"string\"==typeof e}function isNumber(e){return\"number\"==typeof e}function objectMatchesQuery(e,t){return function(){var n=t.property,r=t.operator,i=t.value;if(t&&\"urlPath\"===t.property&&t.value&&\"string\"==typeof t.value&&\"/\"!==t.value&&t.value.endsWith(\"/\")&&(i=t.value.slice(0,-1)),!n||!r)return!0;if(Array.isArray(i))return\"isNot\"===r?i.every((function(t){return objectMatchesQuery(e,{property:n,operator:r,value:t})})):!!i.find((function(t){return objectMatchesQuery(e,{property:n,operator:r,value:t})}));var o=e[n];if(Array.isArray(o))return o.includes(i);switch(r){case\"is\":return o===i;case\"isNot\":return o!==i;case\"contains\":return(isString(o)||Array.isArray(o))&&o.includes(String(i));case\"startsWith\":return isString(o)&&o.startsWith(String(i));case\"endsWith\":return isString(o)&&o.endsWith(String(i));case\"greaterThan\":return isNumber(o)&&isNumber(i)&&o>i;case\"lessThan\":return isNumber(o)&&isNumber(i)&&o<i;case\"greaterThanOrEqualTo\":return isNumber(o)&&isNumber(i)&&o>=i;case\"lessThanOrEqualTo\":return isNumber(o)&&isNumber(i)&&o<=i}return!1}()}";
|
|
14
|
+
export declare function filterWithCustomTargeting(userAttributes: UserAttributes, query: Query[], startDate?: string, endDate?: string): boolean;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const get: (obj: any, path: string, defaultValue?: any) => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isDebug(): boolean;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Higher order component for passing Builder.io styles and attributes directly
|
|
4
|
+
* to the component child without wrapping
|
|
5
|
+
*
|
|
6
|
+
* Useful when you need styles etc applied directly to the component without a
|
|
7
|
+
* wrapping element (e.g. div), and you are already forwarding all props and attributes
|
|
8
|
+
* (e.g. <YourComponent {...props} />)
|
|
9
|
+
*
|
|
10
|
+
* 👉 Important: make sure you always add props.className,
|
|
11
|
+
* even if you supply a className too
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
*
|
|
16
|
+
* const MyButton = props => <Button
|
|
17
|
+
* {...props}
|
|
18
|
+
* className={'my-button ' + (props.className || '')}>
|
|
19
|
+
* Hello there!
|
|
20
|
+
* </Button>
|
|
21
|
+
*
|
|
22
|
+
* const ButtonWithBuilderChildren = noWrap(MyButton)
|
|
23
|
+
*
|
|
24
|
+
* Builder.registerComponent(ButtonWithBuilderChildren, {
|
|
25
|
+
* name: 'MyButton',
|
|
26
|
+
* })
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare const noWrap: <P extends object>(Component: React.ComponentType<P>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P & {
|
|
30
|
+
children?: React.ReactNode;
|
|
31
|
+
} & {
|
|
32
|
+
attributes?: any;
|
|
33
|
+
}> & React.RefAttributes<unknown>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const set: (obj: any, _path: string | string[], value: any) => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const shouldForceBrowserRuntimeInNode: () => boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Builder } from '@builder.io/sdk';
|
|
2
|
+
type BuilderEvanFunction = (state: object, event?: Event | undefined | null, block?: any, builder?: Builder, Device?: any, update?: Function | null, _Builder?: typeof Builder, context?: object) => any;
|
|
3
|
+
export declare const api: (state: any) => Builder;
|
|
4
|
+
export declare function stringToFunction(str: string, expression?: boolean, errors?: Error[], logs?: string[]): BuilderEvanFunction;
|
|
5
|
+
export declare const makeFn: (code: string, useReturn: boolean, args?: string[]) => string;
|
|
6
|
+
export declare const getIsolateContext: () => any;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function throttle(func: Function, wait: number, options?: any): (this: any) => any;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
type TraverseCallback = (value: any, update: (newValue: any) => void) => void;
|
|
2
|
+
/**
|
|
3
|
+
* Recursively traverses an object or array, invoking a callback on each value.
|
|
4
|
+
*
|
|
5
|
+
* @param {any} obj - The object or array to traverse. Can also handle primitives, null, or undefined.
|
|
6
|
+
* @param {TraverseCallback} callback - The function to invoke on each value. Receives the current value
|
|
7
|
+
* and an `update` function to modify the value in its parent container.
|
|
8
|
+
* @param {any} [parent=null] - The parent object or array of the current value. Used internally.
|
|
9
|
+
* @param {any} [key=null] - The key or index of the current value in its parent. Used internally.
|
|
10
|
+
* @param {WeakSet} [visited=new WeakSet()] - Tracks visited objects to handle circular references. Used internally.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // Example: Doubling all numbers in an object
|
|
14
|
+
* const obj = { a: 1, b: [2, 3, { c: 4 }] };
|
|
15
|
+
* traverse(obj, (value, update) => {
|
|
16
|
+
* if (typeof value === 'number') {
|
|
17
|
+
* update(value * 2);
|
|
18
|
+
* }
|
|
19
|
+
* });
|
|
20
|
+
* console.log(obj); // { a: 2, b: [4, 6, { c: 8 }] }
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Example: Handling circular references
|
|
24
|
+
* const obj = { a: 1 };
|
|
25
|
+
* obj.self = obj;
|
|
26
|
+
* traverse(obj, (value, update) => {
|
|
27
|
+
* if (typeof value === 'number') {
|
|
28
|
+
* update(value * 2);
|
|
29
|
+
* }
|
|
30
|
+
* });
|
|
31
|
+
* console.log(obj.a); // 2
|
|
32
|
+
*/
|
|
33
|
+
export declare function traverse(obj: any, callback: TraverseCallback, parent?: any, key?: any, visited?: WeakSet<object>): void;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const tryEval: (str?: string, data?: any, errors?: Error[]) => any;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component } from '@builder.io/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Update metadata for a Builder component
|
|
4
|
+
*
|
|
5
|
+
* @param component Builder react component
|
|
6
|
+
* @param fn Updater
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* updatMetadata(TextBlock, current => ({
|
|
10
|
+
* ...current,
|
|
11
|
+
* fields: [
|
|
12
|
+
* ...curent.fields,
|
|
13
|
+
* { name: 'myNewField', type: 'string' }
|
|
14
|
+
* ]
|
|
15
|
+
* }))
|
|
16
|
+
*/
|
|
17
|
+
export declare function updateMetadata(component: Function | string, fn: (currentMetadata: Component | null) => Component | void): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BuilderElement } from '@builder.io/sdk';
|
|
3
|
+
/**
|
|
4
|
+
* Higher order component for passing Builder.io children as React children
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
*
|
|
9
|
+
* const MyButton = props => <Button>
|
|
10
|
+
* {children}
|
|
11
|
+
* </Button>
|
|
12
|
+
*
|
|
13
|
+
* const ButtonWithBuilderChildren = withChildren(MyButton)
|
|
14
|
+
*
|
|
15
|
+
* Builder.registerComponent(ButtonWithBuilderChildren, {
|
|
16
|
+
* name: 'MyButton',
|
|
17
|
+
* defaultChildren: [
|
|
18
|
+
* {
|
|
19
|
+
* '@type': '@builder.io/sdk:Element'
|
|
20
|
+
* }
|
|
21
|
+
* ]
|
|
22
|
+
* })
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare const withChildren: <P extends object>(Component: React.ComponentType<P>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P & {
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
} & {
|
|
28
|
+
builderBlock?: BuilderElement | undefined;
|
|
29
|
+
}> & React.RefAttributes<any>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useIsPreviewing(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SDK_VERSION = "8.0.6-2";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface RequestInfo {
|
|
3
|
+
promise: Promise<any>;
|
|
4
|
+
url?: string;
|
|
5
|
+
}
|
|
6
|
+
export type RequestOrPromise = RequestInfo | Promise<any>;
|
|
7
|
+
export declare const isPromise: (thing: RequestOrPromise) => thing is Promise<any>;
|
|
8
|
+
export declare const isRequestInfo: (thing: RequestOrPromise) => thing is RequestInfo;
|
|
9
|
+
export declare const BuilderAsyncRequestsContext: React.Context<{
|
|
10
|
+
requests: RequestOrPromise[];
|
|
11
|
+
errors: Error[];
|
|
12
|
+
logs: string[];
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const BuilderStoreContext: React.Context<BuilderStore>;
|
|
3
|
+
export interface BuilderStore {
|
|
4
|
+
state: any;
|
|
5
|
+
rootState: any;
|
|
6
|
+
content: any;
|
|
7
|
+
context: any;
|
|
8
|
+
update: (mutator: (state: any) => any) => any;
|
|
9
|
+
renderLink?: (props: React.AnchorHTMLAttributes<any>) => React.ReactNode;
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe conversion to error type. Intended to be used in catch blocks where the
|
|
3
|
+
* value is not guaranteed to be an error.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* try {
|
|
7
|
+
* throw new Error('Something went wrong')
|
|
8
|
+
* }
|
|
9
|
+
* catch (err: unknown) {
|
|
10
|
+
* const error: Error = toError(err)
|
|
11
|
+
* }
|
|
12
|
+
*/
|
|
13
|
+
export declare function toError(err: unknown): Error;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { BuilderElement } from '@builder.io/sdk';
|
|
2
|
+
export declare const el: (options?: Partial<BuilderElement>, useId?: number) => BuilderElement;
|
|
3
|
+
export declare const block: (name: string, options?: any, elOptions?: Partial<BuilderElement>, useId?: number) => BuilderElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|