@builder.io/sdk-react-native 3.0.0 → 3.0.1-1
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/lib/browser/commonjs/blocks/image/component-info.js +2 -1
- package/lib/browser/commonjs/blocks/image/component-info.js.map +1 -1
- package/lib/browser/commonjs/blocks/img/component-info.js +2 -1
- package/lib/browser/commonjs/blocks/img/component-info.js.map +1 -1
- package/lib/browser/commonjs/blocks/video/component-info.js +3 -2
- package/lib/browser/commonjs/blocks/video/component-info.js.map +1 -1
- package/lib/browser/commonjs/components/block/block.helpers.js +17 -6
- package/lib/browser/commonjs/components/block/block.helpers.js.map +1 -1
- package/lib/browser/commonjs/components/block/block.js +3 -2
- package/lib/browser/commonjs/components/block/block.js.map +1 -1
- package/lib/browser/commonjs/components/blocks/blocks.js +46 -11
- package/lib/browser/commonjs/components/blocks/blocks.js.map +1 -1
- package/lib/browser/commonjs/components/content/components/enable-editor.helpers.js +24 -0
- package/lib/browser/commonjs/components/content/components/enable-editor.helpers.js.map +1 -0
- package/lib/browser/commonjs/components/content/components/enable-editor.js +17 -7
- package/lib/browser/commonjs/components/content/components/enable-editor.js.map +1 -1
- package/lib/browser/commonjs/components/content/content.js +37 -54
- package/lib/browser/commonjs/components/content/content.js.map +1 -1
- package/lib/browser/commonjs/constants/file-types.js +9 -0
- package/lib/browser/commonjs/constants/file-types.js.map +1 -0
- package/lib/browser/commonjs/constants/sdk-version.js +1 -1
- package/lib/browser/commonjs/context/builder.context.js +2 -1
- package/lib/browser/commonjs/context/builder.context.js.map +1 -1
- package/lib/browser/commonjs/functions/extract-localized-values.js +45 -0
- package/lib/browser/commonjs/functions/extract-localized-values.js.map +1 -0
- package/lib/browser/commonjs/functions/get-processed-block.js +3 -1
- package/lib/browser/commonjs/functions/get-processed-block.js.map +1 -1
- package/lib/browser/commonjs/functions/register-component.js +4 -1
- package/lib/browser/commonjs/functions/register-component.js.map +1 -1
- package/lib/browser/commonjs/functions/traverse.js +69 -0
- package/lib/browser/commonjs/functions/traverse.js.map +1 -0
- package/lib/browser/module/blocks/image/component-info.js +2 -1
- package/lib/browser/module/blocks/image/component-info.js.map +1 -1
- package/lib/browser/module/blocks/img/component-info.js +2 -1
- package/lib/browser/module/blocks/img/component-info.js.map +1 -1
- package/lib/browser/module/blocks/video/component-info.js +3 -2
- package/lib/browser/module/blocks/video/component-info.js.map +1 -1
- package/lib/browser/module/components/block/block.helpers.js +17 -6
- package/lib/browser/module/components/block/block.helpers.js.map +1 -1
- package/lib/browser/module/components/block/block.js +3 -2
- package/lib/browser/module/components/block/block.js.map +1 -1
- package/lib/browser/module/components/blocks/blocks.js +46 -11
- package/lib/browser/module/components/blocks/blocks.js.map +1 -1
- package/lib/browser/module/components/content/components/enable-editor.helpers.js +17 -0
- package/lib/browser/module/components/content/components/enable-editor.helpers.js.map +1 -0
- package/lib/browser/module/components/content/components/enable-editor.js +17 -7
- package/lib/browser/module/components/content/components/enable-editor.js.map +1 -1
- package/lib/browser/module/components/content/content.js +37 -54
- package/lib/browser/module/components/content/content.js.map +1 -1
- package/lib/browser/module/constants/file-types.js +3 -0
- package/lib/browser/module/constants/file-types.js.map +1 -0
- package/lib/browser/module/constants/sdk-version.js +1 -1
- package/lib/browser/module/context/builder.context.js +2 -1
- package/lib/browser/module/context/builder.context.js.map +1 -1
- package/lib/browser/module/functions/extract-localized-values.js +39 -0
- package/lib/browser/module/functions/extract-localized-values.js.map +1 -0
- package/lib/browser/module/functions/get-processed-block.js +3 -1
- package/lib/browser/module/functions/get-processed-block.js.map +1 -1
- package/lib/browser/module/functions/register-component.js +4 -1
- package/lib/browser/module/functions/register-component.js.map +1 -1
- package/lib/browser/module/functions/traverse.js +63 -0
- package/lib/browser/module/functions/traverse.js.map +1 -0
- package/lib/browser/typescript/blocks/image/component-info.d.ts.map +1 -1
- package/lib/browser/typescript/components/block/block.d.ts.map +1 -1
- package/lib/browser/typescript/components/block/block.helpers.d.ts +6 -3
- package/lib/browser/typescript/components/block/block.helpers.d.ts.map +1 -1
- package/lib/browser/typescript/components/blocks/blocks.d.ts +3 -2
- package/lib/browser/typescript/components/blocks/blocks.d.ts.map +1 -1
- package/lib/browser/typescript/components/content/components/enable-editor.d.ts.map +1 -1
- package/lib/browser/typescript/components/content/components/enable-editor.helpers.d.ts +12 -0
- package/lib/browser/typescript/components/content/components/enable-editor.helpers.d.ts.map +1 -0
- package/lib/browser/typescript/components/content/content.d.ts.map +1 -1
- package/lib/browser/typescript/constants/file-types.d.ts +3 -0
- package/lib/browser/typescript/constants/file-types.d.ts.map +1 -0
- package/lib/browser/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/browser/typescript/context/builder.context.d.ts.map +1 -1
- package/lib/browser/typescript/context/types.d.ts +1 -0
- package/lib/browser/typescript/context/types.d.ts.map +1 -1
- package/lib/browser/typescript/functions/extract-localized-values.d.ts +3 -0
- package/lib/browser/typescript/functions/extract-localized-values.d.ts.map +1 -0
- package/lib/browser/typescript/functions/get-processed-block.d.ts.map +1 -1
- package/lib/browser/typescript/functions/register-component.d.ts.map +1 -1
- package/lib/browser/typescript/functions/traverse.d.ts +35 -0
- package/lib/browser/typescript/functions/traverse.d.ts.map +1 -0
- package/lib/browser/typescript/types/components.d.ts +3 -0
- package/lib/browser/typescript/types/components.d.ts.map +1 -1
- package/lib/edge/commonjs/blocks/image/component-info.js +2 -1
- package/lib/edge/commonjs/blocks/image/component-info.js.map +1 -1
- package/lib/edge/commonjs/blocks/img/component-info.js +2 -1
- package/lib/edge/commonjs/blocks/img/component-info.js.map +1 -1
- package/lib/edge/commonjs/blocks/video/component-info.js +3 -2
- package/lib/edge/commonjs/blocks/video/component-info.js.map +1 -1
- package/lib/edge/commonjs/components/block/block.helpers.js +17 -6
- package/lib/edge/commonjs/components/block/block.helpers.js.map +1 -1
- package/lib/edge/commonjs/components/block/block.js +3 -2
- package/lib/edge/commonjs/components/block/block.js.map +1 -1
- package/lib/edge/commonjs/components/blocks/blocks.js +46 -11
- package/lib/edge/commonjs/components/blocks/blocks.js.map +1 -1
- package/lib/edge/commonjs/components/content/components/enable-editor.helpers.js +24 -0
- package/lib/edge/commonjs/components/content/components/enable-editor.helpers.js.map +1 -0
- package/lib/edge/commonjs/components/content/components/enable-editor.js +17 -7
- package/lib/edge/commonjs/components/content/components/enable-editor.js.map +1 -1
- package/lib/edge/commonjs/components/content/content.js +37 -54
- package/lib/edge/commonjs/components/content/content.js.map +1 -1
- package/lib/edge/commonjs/constants/file-types.js +9 -0
- package/lib/edge/commonjs/constants/file-types.js.map +1 -0
- package/lib/edge/commonjs/constants/sdk-version.js +1 -1
- package/lib/edge/commonjs/context/builder.context.js +2 -1
- package/lib/edge/commonjs/context/builder.context.js.map +1 -1
- package/lib/edge/commonjs/functions/extract-localized-values.js +45 -0
- package/lib/edge/commonjs/functions/extract-localized-values.js.map +1 -0
- package/lib/edge/commonjs/functions/get-processed-block.js +3 -1
- package/lib/edge/commonjs/functions/get-processed-block.js.map +1 -1
- package/lib/edge/commonjs/functions/register-component.js +4 -1
- package/lib/edge/commonjs/functions/register-component.js.map +1 -1
- package/lib/edge/commonjs/functions/traverse.js +69 -0
- package/lib/edge/commonjs/functions/traverse.js.map +1 -0
- package/lib/edge/module/blocks/image/component-info.js +2 -1
- package/lib/edge/module/blocks/image/component-info.js.map +1 -1
- package/lib/edge/module/blocks/img/component-info.js +2 -1
- package/lib/edge/module/blocks/img/component-info.js.map +1 -1
- package/lib/edge/module/blocks/video/component-info.js +3 -2
- package/lib/edge/module/blocks/video/component-info.js.map +1 -1
- package/lib/edge/module/components/block/block.helpers.js +17 -6
- package/lib/edge/module/components/block/block.helpers.js.map +1 -1
- package/lib/edge/module/components/block/block.js +3 -2
- package/lib/edge/module/components/block/block.js.map +1 -1
- package/lib/edge/module/components/blocks/blocks.js +46 -11
- package/lib/edge/module/components/blocks/blocks.js.map +1 -1
- package/lib/edge/module/components/content/components/enable-editor.helpers.js +17 -0
- package/lib/edge/module/components/content/components/enable-editor.helpers.js.map +1 -0
- package/lib/edge/module/components/content/components/enable-editor.js +17 -7
- package/lib/edge/module/components/content/components/enable-editor.js.map +1 -1
- package/lib/edge/module/components/content/content.js +37 -54
- package/lib/edge/module/components/content/content.js.map +1 -1
- package/lib/edge/module/constants/file-types.js +3 -0
- package/lib/edge/module/constants/file-types.js.map +1 -0
- package/lib/edge/module/constants/sdk-version.js +1 -1
- package/lib/edge/module/context/builder.context.js +2 -1
- package/lib/edge/module/context/builder.context.js.map +1 -1
- package/lib/edge/module/functions/extract-localized-values.js +39 -0
- package/lib/edge/module/functions/extract-localized-values.js.map +1 -0
- package/lib/edge/module/functions/get-processed-block.js +3 -1
- package/lib/edge/module/functions/get-processed-block.js.map +1 -1
- package/lib/edge/module/functions/register-component.js +4 -1
- package/lib/edge/module/functions/register-component.js.map +1 -1
- package/lib/edge/module/functions/traverse.js +63 -0
- package/lib/edge/module/functions/traverse.js.map +1 -0
- package/lib/edge/typescript/blocks/image/component-info.d.ts.map +1 -1
- package/lib/edge/typescript/components/block/block.d.ts.map +1 -1
- package/lib/edge/typescript/components/block/block.helpers.d.ts +6 -3
- package/lib/edge/typescript/components/block/block.helpers.d.ts.map +1 -1
- package/lib/edge/typescript/components/blocks/blocks.d.ts +3 -2
- package/lib/edge/typescript/components/blocks/blocks.d.ts.map +1 -1
- package/lib/edge/typescript/components/content/components/enable-editor.d.ts.map +1 -1
- package/lib/edge/typescript/components/content/components/enable-editor.helpers.d.ts +12 -0
- package/lib/edge/typescript/components/content/components/enable-editor.helpers.d.ts.map +1 -0
- package/lib/edge/typescript/components/content/content.d.ts.map +1 -1
- package/lib/edge/typescript/constants/file-types.d.ts +3 -0
- package/lib/edge/typescript/constants/file-types.d.ts.map +1 -0
- package/lib/edge/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/edge/typescript/context/builder.context.d.ts.map +1 -1
- package/lib/edge/typescript/context/types.d.ts +1 -0
- package/lib/edge/typescript/context/types.d.ts.map +1 -1
- package/lib/edge/typescript/functions/extract-localized-values.d.ts +3 -0
- package/lib/edge/typescript/functions/extract-localized-values.d.ts.map +1 -0
- package/lib/edge/typescript/functions/get-processed-block.d.ts.map +1 -1
- package/lib/edge/typescript/functions/register-component.d.ts.map +1 -1
- package/lib/edge/typescript/functions/traverse.d.ts +35 -0
- package/lib/edge/typescript/functions/traverse.d.ts.map +1 -0
- package/lib/edge/typescript/types/components.d.ts +3 -0
- package/lib/edge/typescript/types/components.d.ts.map +1 -1
- package/lib/node/commonjs/blocks/image/component-info.js +2 -1
- package/lib/node/commonjs/blocks/image/component-info.js.map +1 -1
- package/lib/node/commonjs/blocks/img/component-info.js +2 -1
- package/lib/node/commonjs/blocks/img/component-info.js.map +1 -1
- package/lib/node/commonjs/blocks/video/component-info.js +3 -2
- package/lib/node/commonjs/blocks/video/component-info.js.map +1 -1
- package/lib/node/commonjs/components/block/block.helpers.js +17 -6
- package/lib/node/commonjs/components/block/block.helpers.js.map +1 -1
- package/lib/node/commonjs/components/block/block.js +3 -2
- package/lib/node/commonjs/components/block/block.js.map +1 -1
- package/lib/node/commonjs/components/blocks/blocks.js +46 -11
- package/lib/node/commonjs/components/blocks/blocks.js.map +1 -1
- package/lib/node/commonjs/components/content/components/enable-editor.helpers.js +24 -0
- package/lib/node/commonjs/components/content/components/enable-editor.helpers.js.map +1 -0
- package/lib/node/commonjs/components/content/components/enable-editor.js +17 -7
- package/lib/node/commonjs/components/content/components/enable-editor.js.map +1 -1
- package/lib/node/commonjs/components/content/content.js +37 -54
- package/lib/node/commonjs/components/content/content.js.map +1 -1
- package/lib/node/commonjs/constants/file-types.js +9 -0
- package/lib/node/commonjs/constants/file-types.js.map +1 -0
- package/lib/node/commonjs/constants/sdk-version.js +1 -1
- package/lib/node/commonjs/context/builder.context.js +2 -1
- package/lib/node/commonjs/context/builder.context.js.map +1 -1
- package/lib/node/commonjs/functions/extract-localized-values.js +45 -0
- package/lib/node/commonjs/functions/extract-localized-values.js.map +1 -0
- package/lib/node/commonjs/functions/get-processed-block.js +3 -1
- package/lib/node/commonjs/functions/get-processed-block.js.map +1 -1
- package/lib/node/commonjs/functions/register-component.js +4 -1
- package/lib/node/commonjs/functions/register-component.js.map +1 -1
- package/lib/node/commonjs/functions/traverse.js +69 -0
- package/lib/node/commonjs/functions/traverse.js.map +1 -0
- package/lib/node/module/blocks/image/component-info.js +2 -1
- package/lib/node/module/blocks/image/component-info.js.map +1 -1
- package/lib/node/module/blocks/img/component-info.js +2 -1
- package/lib/node/module/blocks/img/component-info.js.map +1 -1
- package/lib/node/module/blocks/video/component-info.js +3 -2
- package/lib/node/module/blocks/video/component-info.js.map +1 -1
- package/lib/node/module/components/block/block.helpers.js +17 -6
- package/lib/node/module/components/block/block.helpers.js.map +1 -1
- package/lib/node/module/components/block/block.js +3 -2
- package/lib/node/module/components/block/block.js.map +1 -1
- package/lib/node/module/components/blocks/blocks.js +46 -11
- package/lib/node/module/components/blocks/blocks.js.map +1 -1
- package/lib/node/module/components/content/components/enable-editor.helpers.js +17 -0
- package/lib/node/module/components/content/components/enable-editor.helpers.js.map +1 -0
- package/lib/node/module/components/content/components/enable-editor.js +17 -7
- package/lib/node/module/components/content/components/enable-editor.js.map +1 -1
- package/lib/node/module/components/content/content.js +37 -54
- package/lib/node/module/components/content/content.js.map +1 -1
- package/lib/node/module/constants/file-types.js +3 -0
- package/lib/node/module/constants/file-types.js.map +1 -0
- package/lib/node/module/constants/sdk-version.js +1 -1
- package/lib/node/module/context/builder.context.js +2 -1
- package/lib/node/module/context/builder.context.js.map +1 -1
- package/lib/node/module/functions/extract-localized-values.js +39 -0
- package/lib/node/module/functions/extract-localized-values.js.map +1 -0
- package/lib/node/module/functions/get-processed-block.js +3 -1
- package/lib/node/module/functions/get-processed-block.js.map +1 -1
- package/lib/node/module/functions/register-component.js +4 -1
- package/lib/node/module/functions/register-component.js.map +1 -1
- package/lib/node/module/functions/traverse.js +63 -0
- package/lib/node/module/functions/traverse.js.map +1 -0
- package/lib/node/typescript/blocks/image/component-info.d.ts.map +1 -1
- package/lib/node/typescript/components/block/block.d.ts.map +1 -1
- package/lib/node/typescript/components/block/block.helpers.d.ts +6 -3
- package/lib/node/typescript/components/block/block.helpers.d.ts.map +1 -1
- package/lib/node/typescript/components/blocks/blocks.d.ts +3 -2
- package/lib/node/typescript/components/blocks/blocks.d.ts.map +1 -1
- package/lib/node/typescript/components/content/components/enable-editor.d.ts.map +1 -1
- package/lib/node/typescript/components/content/components/enable-editor.helpers.d.ts +12 -0
- package/lib/node/typescript/components/content/components/enable-editor.helpers.d.ts.map +1 -0
- package/lib/node/typescript/components/content/content.d.ts.map +1 -1
- package/lib/node/typescript/constants/file-types.d.ts +3 -0
- package/lib/node/typescript/constants/file-types.d.ts.map +1 -0
- package/lib/node/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/node/typescript/context/builder.context.d.ts.map +1 -1
- package/lib/node/typescript/context/types.d.ts +1 -0
- package/lib/node/typescript/context/types.d.ts.map +1 -1
- package/lib/node/typescript/functions/extract-localized-values.d.ts +3 -0
- package/lib/node/typescript/functions/extract-localized-values.d.ts.map +1 -0
- package/lib/node/typescript/functions/get-processed-block.d.ts.map +1 -1
- package/lib/node/typescript/functions/register-component.d.ts.map +1 -1
- package/lib/node/typescript/functions/traverse.d.ts +35 -0
- package/lib/node/typescript/functions/traverse.d.ts.map +1 -0
- package/lib/node/typescript/types/components.d.ts +3 -0
- package/lib/node/typescript/types/components.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/blocks/image/component-info.ts +2 -1
- package/src/blocks/img/component-info.ts +2 -1
- package/src/blocks/video/component-info.ts +3 -2
- package/src/components/block/block.helpers.ts +18 -6
- package/src/components/block/block.tsx +3 -1
- package/src/components/blocks/blocks.tsx +89 -54
- package/src/components/content/components/enable-editor.helpers.ts +18 -0
- package/src/components/content/components/enable-editor.tsx +25 -5
- package/src/components/content/content.tsx +3 -10
- package/src/constants/file-types.ts +2 -0
- package/src/constants/sdk-version.ts +1 -1
- package/src/context/builder.context.ts +1 -0
- package/src/context/types.ts +1 -0
- package/src/functions/extract-localized-values.ts +38 -0
- package/src/functions/get-processed-block.ts +3 -1
- package/src/functions/register-component.ts +4 -1
- package/src/functions/traverse.ts +64 -0
- package/src/types/components.ts +3 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively traverses an object or array, invoking a callback on each value.
|
|
3
|
+
*
|
|
4
|
+
* @param {any} obj - The object or array to traverse. Can also handle primitives, null, or undefined.
|
|
5
|
+
* @param {TraverseCallback} callback - The function to invoke on each value. Receives the current value
|
|
6
|
+
* and an `update` function to modify the value in its parent container.
|
|
7
|
+
* @param {any} [parent=null] - The parent object or array of the current value. Used internally.
|
|
8
|
+
* @param {any} [key=null] - The key or index of the current value in its parent. Used internally.
|
|
9
|
+
* @param {WeakSet} [visited=new WeakSet()] - Tracks visited objects to handle circular references. Used internally.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Example: Doubling all numbers in an object
|
|
13
|
+
* const obj = { a: 1, b: [2, 3, { c: 4 }] };
|
|
14
|
+
* traverse(obj, (value, update) => {
|
|
15
|
+
* if (typeof value === 'number') {
|
|
16
|
+
* update(value * 2);
|
|
17
|
+
* }
|
|
18
|
+
* });
|
|
19
|
+
* console.log(obj); // { a: 2, b: [4, 6, { c: 8 }] }
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // Example: Handling circular references
|
|
23
|
+
* const obj = { a: 1 };
|
|
24
|
+
* obj.self = obj;
|
|
25
|
+
* traverse(obj, (value, update) => {
|
|
26
|
+
* if (typeof value === 'number') {
|
|
27
|
+
* update(value * 2);
|
|
28
|
+
* }
|
|
29
|
+
* });
|
|
30
|
+
* console.log(obj.a); // 2
|
|
31
|
+
*/
|
|
32
|
+
export function traverse(obj, callback, parent = null, key = null, visited = new WeakSet()) {
|
|
33
|
+
if (obj == null || typeof obj !== 'object') {
|
|
34
|
+
callback(obj, newValue => {
|
|
35
|
+
if (parent !== null && key !== null) {
|
|
36
|
+
parent[key] = newValue;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (visited.has(obj)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
visited.add(obj);
|
|
45
|
+
if (Array.isArray(obj)) {
|
|
46
|
+
obj.forEach((item, index) => {
|
|
47
|
+
const update = newValue => {
|
|
48
|
+
obj[index] = newValue;
|
|
49
|
+
};
|
|
50
|
+
callback(item, update);
|
|
51
|
+
traverse(item, callback, obj, index, visited);
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
Object.entries(obj).forEach(([key, value]) => {
|
|
55
|
+
const update = newValue => {
|
|
56
|
+
obj[key] = newValue;
|
|
57
|
+
};
|
|
58
|
+
callback(value, update);
|
|
59
|
+
traverse(value, callback, obj, key, visited);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=traverse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["traverse","obj","callback","parent","key","visited","WeakSet","newValue","has","add","Array","isArray","forEach","item","index","update","Object","entries","value"],"sourceRoot":"../../../../src","sources":["functions/traverse.ts"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,QAAQA,CAACC,GAAQ,EAAEC,QAA0B,EAAEC,MAAW,GAAG,IAAI,EAAEC,GAAQ,GAAG,IAAI,EAAEC,OAAO,GAAG,IAAIC,OAAO,CAAC,CAAC,EAAQ;EACjI,IAAIL,GAAG,IAAI,IAAI,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;IAC1CC,QAAQ,CAACD,GAAG,EAAGM,QAAa,IAAK;MAC/B,IAAIJ,MAAM,KAAK,IAAI,IAAIC,GAAG,KAAK,IAAI,EAAE;QACnCD,MAAM,CAACC,GAAG,CAAC,GAAGG,QAAQ;MACxB;IACF,CAAC,CAAC;IACF;EACF;EACA,IAAIF,OAAO,CAACG,GAAG,CAACP,GAAG,CAAC,EAAE;IACpB;EACF;EACAI,OAAO,CAACI,GAAG,CAACR,GAAG,CAAC;EAChB,IAAIS,KAAK,CAACC,OAAO,CAACV,GAAG,CAAC,EAAE;IACtBA,GAAG,CAACW,OAAO,CAAC,CAACC,IAAI,EAAEC,KAAK,KAAK;MAC3B,MAAMC,MAAM,GAAIR,QAAa,IAAK;QAChCN,GAAG,CAACa,KAAK,CAAC,GAAGP,QAAQ;MACvB,CAAC;MACDL,QAAQ,CAACW,IAAI,EAAEE,MAAM,CAAC;MACtBf,QAAQ,CAACa,IAAI,EAAEX,QAAQ,EAAED,GAAG,EAAEa,KAAK,EAAET,OAAO,CAAC;IAC/C,CAAC,CAAC;EACJ,CAAC,MAAM;IACLW,MAAM,CAACC,OAAO,CAAChB,GAAG,CAAC,CAACW,OAAO,CAAC,CAAC,CAACR,GAAG,EAAEc,KAAK,CAAC,KAAK;MAC5C,MAAMH,MAAM,GAAIR,QAAa,IAAK;QAChCN,GAAG,CAACG,GAAG,CAAC,GAAGG,QAAQ;MACrB,CAAC;MACDL,QAAQ,CAACgB,KAAK,EAAEH,MAAM,CAAC;MACvBf,QAAQ,CAACkB,KAAK,EAAEhB,QAAQ,EAAED,GAAG,EAAEG,GAAG,EAAEC,OAAO,CAAC;IAC9C,CAAC,CAAC;EACJ;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-info.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/image/component-info.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"component-info.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/image/component-info.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,eAAO,MAAM,aAAa,EAAE,aAkI3B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../../../src/components/block/block.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,uBAAuB,CAAC;IACjC,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,aAAa,EAAE,GAAG,CAAC;CACpB,CAAC;AAEF,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAkB9D,iBAAS,KAAK,CAAC,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../../../src/components/block/block.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,uBAAuB,CAAC;IACjC,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,aAAa,EAAE,GAAG,CAAC;CACpB,CAAC;AAEF,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAkB9D,iBAAS,KAAK,CAAC,KAAK,EAAE,UAAU,qBAwM/B;AAED,eAAe,KAAK,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { BuilderContextInterface, RegisteredComponent, RegisteredComponents } from '../../context/types';
|
|
2
2
|
import type { BuilderBlock } from '../../types/builder-block';
|
|
3
3
|
import type { RepeatData } from './types';
|
|
4
|
-
export declare const getComponent: ({ block, registeredComponents }: {
|
|
4
|
+
export declare const getComponent: ({ block, registeredComponents, model }: {
|
|
5
5
|
block: BuilderBlock;
|
|
6
6
|
registeredComponents: RegisteredComponents;
|
|
7
|
+
model: string;
|
|
7
8
|
}) => RegisteredComponent;
|
|
8
9
|
export declare const getRepeatItemData: ({ block, context }: {
|
|
9
10
|
block: BuilderBlock;
|
|
@@ -18,8 +19,10 @@ export declare const provideLinkComponent: (block: RegisteredComponent | null |
|
|
|
18
19
|
} | {
|
|
19
20
|
builderLinkComponent?: undefined;
|
|
20
21
|
};
|
|
21
|
-
export declare const provideRegisteredComponents: (block: RegisteredComponent | null | undefined, registeredComponents: RegisteredComponents) => {
|
|
22
|
-
builderComponents:
|
|
22
|
+
export declare const provideRegisteredComponents: (block: RegisteredComponent | null | undefined, registeredComponents: RegisteredComponents, model: string) => {
|
|
23
|
+
builderComponents: {
|
|
24
|
+
[k: string]: RegisteredComponent;
|
|
25
|
+
};
|
|
23
26
|
} | {
|
|
24
27
|
builderComponents?: undefined;
|
|
25
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.helpers.d.ts","sourceRoot":"","sources":["../../../../../src/components/block/block.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAI9G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"block.helpers.d.ts","sourceRoot":"","sources":["../../../../../src/components/block/block.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAI9G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAM1C,eAAO,MAAM,YAAY;WAKhB,YAAY;0BACG,oBAAoB;WACnC,MAAM;yBAgBd,CAAC;AACF,eAAO,MAAM,iBAAiB;WAIrB,YAAY;aACV,uBAAuB;MAC9B,UAAU,EAAE,GAAG,SAsClB,CAAC;AACF,eAAO,MAAM,kBAAkB;WAItB,YAAY;aACV,uBAAuB;kCAUjC,CAAC;AACF,eAAO,MAAM,oBAAoB,UAAW,mBAAmB,GAAG,IAAI,GAAG,SAAS,iBAAiB,GAAG;;;;CAKrG,CAAC;AACF,eAAO,MAAM,2BAA2B,UAAW,mBAAmB,GAAG,IAAI,GAAG,SAAS,wBAAwB,oBAAoB,SAAS,MAAM;;;;;;CAUnJ,CAAC;AACF,eAAO,MAAM,mBAAmB,UAAW,mBAAmB,GAAG,IAAI,GAAG,SAAS,gBAAgB,YAAY;;;;CAK5G,CAAC;AACF,eAAO,MAAM,qBAAqB,UAAW,mBAAmB,GAAG,IAAI,GAAG,SAAS,WAAW,uBAAuB;;;;CAKpH,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import type { BlocksProps } from "./blocks.types";
|
|
3
3
|
declare function Blocks(props: BlocksProps): React.JSX.Element;
|
|
4
|
-
|
|
4
|
+
declare const _default: React.MemoExoticComponent<typeof Blocks>;
|
|
5
|
+
export default _default;
|
|
5
6
|
//# sourceMappingURL=blocks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../../../src/components/blocks/blocks.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../../../../src/components/blocks/blocks.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAC;AAS9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA4BhD,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,qBAuDjC;;AAGD,wBAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enable-editor.d.ts","sourceRoot":"","sources":["../../../../../../src/components/content/components/enable-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,KAAK,kBAAkB,GAAG,IAAI,CAC5B,YAAY,EACV,kBAAkB,GAClB,YAAY,GACZ,aAAa,GACb,eAAe,GACf,oBAAoB,GACpB,eAAe,CAClB,GAAG;IACF,oBAAoB,EAAE,uBAAuB,CAAC;IAC9C,uBAAuB,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;IAC/C,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,CAAC;AAEF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAuBtE,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"enable-editor.d.ts","sourceRoot":"","sources":["../../../../../../src/components/content/components/enable-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,KAAK,kBAAkB,GAAG,IAAI,CAC5B,YAAY,EACV,kBAAkB,GAClB,YAAY,GACZ,aAAa,GACb,eAAe,GACf,oBAAoB,GACpB,eAAe,CAClB,GAAG;IACF,oBAAoB,EAAE,uBAAuB,CAAC;IAC9C,uBAAuB,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;IAC/C,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,CAAC;AAEF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAuBtE,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,kBAAkB,CAAC;AAI1B,iBAAS,YAAY,CAAC,KAAK,EAAE,kBAAkB,qBAqZ9C;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Target } from '../../../types/targets';
|
|
2
|
+
/**
|
|
3
|
+
* SDKS that use the elementRef approach to enable visual editing.
|
|
4
|
+
* We don't need to render the div for other SDKs as they attach event listeners to the window.
|
|
5
|
+
*/
|
|
6
|
+
export declare const SDKS_USING_ELEMENT_REF_APPROACH: Target[];
|
|
7
|
+
/**
|
|
8
|
+
* We need to attach this div only when content exists or isPreviewing/isEditing even when content is null,
|
|
9
|
+
* as we need to set the elementRef and allow previewing and visual editing
|
|
10
|
+
*/
|
|
11
|
+
export declare const needsElementRefDivForEditing: () => boolean;
|
|
12
|
+
//# sourceMappingURL=enable-editor.helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enable-editor.helpers.d.ts","sourceRoot":"","sources":["../../../../../../src/components/content/components/enable-editor.helpers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,+BAA+B,UAA0C,CAAC;AAEvF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,eAExC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../../../src/components/content/content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAsC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,iBAAS,gBAAgB,CAAC,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../../../src/components/content/content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAsC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,iBAAS,gBAAgB,CAAC,KAAK,EAAE,YAAY,qBAwJ5C;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-types.d.ts","sourceRoot":"","sources":["../../../../src/constants/file-types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,UAA2L,CAAC;AACzN,eAAO,MAAM,gBAAgB,UAAsR,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "3.0.
|
|
1
|
+
export declare const SDK_VERSION = "3.0.1";
|
|
2
2
|
//# sourceMappingURL=sdk-version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.context.d.ts","sourceRoot":"","sources":["../../../../src/context/builder.context.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"builder.context.d.ts","sourceRoot":"","sources":["../../../../src/context/builder.context.ts"],"names":[],"mappings":";;AAEA,wBAcG"}
|
|
@@ -36,6 +36,7 @@ export interface BuilderContextInterface extends Pick<BlocksWrapperProps, 'Block
|
|
|
36
36
|
componentInfos: Dictionary<ComponentInfo>;
|
|
37
37
|
inheritedStyles: Record<string, unknown>;
|
|
38
38
|
nonce: string;
|
|
39
|
+
model: string;
|
|
39
40
|
canTrack?: boolean;
|
|
40
41
|
}
|
|
41
42
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/context/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;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C,CAAC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-localized-values.d.ts","sourceRoot":"","sources":["../../../../src/functions/extract-localized-values.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AA6B3D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,gBAQrF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-processed-block.d.ts","sourceRoot":"","sources":["../../../../src/functions/get-processed-block.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-processed-block.d.ts","sourceRoot":"","sources":["../../../../src/functions/get-processed-block.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAQ3D,wBAAgB,uBAAuB,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAiB1D;AAwDD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAO,EACP,sBAAsB,EACtB,UAAU,EACV,SAAS,EACT,YAAY,EACb,EAAE;IACD,KAAK,EAAE,YAAY,CAAC;IACpB;;;OAGG;IACH,sBAAsB,EAAE,OAAO,CAAC;CACjC,GAAG,IAAI,CAAC,uBAAuB,EAAE,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,cAAc,CAAC,GAAG,YAAY,CAcxG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-component.d.ts","sourceRoot":"","sources":["../../../../src/functions/register-component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,eAAO,MAAM,8BAA8B,SAAU,aAAa;;;CAGhE,CAAC;
|
|
1
|
+
{"version":3,"file":"register-component.d.ts","sourceRoot":"","sources":["../../../../src/functions/register-component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,eAAO,MAAM,8BAA8B,SAAU,aAAa;;;CAGhE,CAAC;AAkBH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,aAAa,OAO9D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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 {};
|
|
35
|
+
//# sourceMappingURL=traverse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traverse.d.ts","sourceRoot":"","sources":["../../../../src/functions/traverse.ts"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,KAAK,IAAI,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,GAAE,GAAU,EAAE,GAAG,GAAE,GAAU,EAAE,OAAO,kBAAgB,GAAG,IAAI,CA8BjI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../../src/types/components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IAC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AAiB,CAAC,EAAE,OAAO,CAAC;QAE5B;;;;WAIG;QACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;KAChC,CAAC;IACF,IAAI,CAAC,EAAE;QACL,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AACD,KAAK,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,GAAG,OAAO,GAAG,QAAQ,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-react-native",
|
|
3
3
|
"description": "Builder.io SDK for React Native",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.1-1",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/builder/tree/main/packages/sdks/output/react-native",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IMAGE_FILE_TYPES } from '../../constants/file-types';
|
|
1
2
|
import type { ComponentInfo } from '../../types/components';
|
|
2
3
|
export const componentInfo: ComponentInfo = {
|
|
3
4
|
name: 'Image',
|
|
@@ -14,7 +15,7 @@ export const componentInfo: ComponentInfo = {
|
|
|
14
15
|
name: 'image',
|
|
15
16
|
type: 'file',
|
|
16
17
|
bubble: true,
|
|
17
|
-
allowedFileTypes:
|
|
18
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
18
19
|
required: true,
|
|
19
20
|
defaultValue: 'https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a',
|
|
20
21
|
onChange: (options: Map<string, any>): void | Promise<void> => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IMAGE_FILE_TYPES } from '../../constants/file-types';
|
|
1
2
|
import type { ComponentInfo } from '../../types/components';
|
|
2
3
|
export const componentInfo: ComponentInfo = {
|
|
3
4
|
// friendlyName?
|
|
@@ -8,7 +9,7 @@ export const componentInfo: ComponentInfo = {
|
|
|
8
9
|
name: 'image',
|
|
9
10
|
bubble: true,
|
|
10
11
|
type: 'file',
|
|
11
|
-
allowedFileTypes:
|
|
12
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
12
13
|
required: true
|
|
13
14
|
}],
|
|
14
15
|
noWrap: true,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IMAGE_FILE_TYPES, VIDEO_FILE_TYPES } from '../../constants/file-types';
|
|
1
2
|
import type { ComponentInfo } from '../../types/components';
|
|
2
3
|
export const componentInfo: ComponentInfo = {
|
|
3
4
|
name: 'Video',
|
|
@@ -10,14 +11,14 @@ export const componentInfo: ComponentInfo = {
|
|
|
10
11
|
inputs: [{
|
|
11
12
|
name: 'video',
|
|
12
13
|
type: 'file',
|
|
13
|
-
allowedFileTypes:
|
|
14
|
+
allowedFileTypes: VIDEO_FILE_TYPES,
|
|
14
15
|
bubble: true,
|
|
15
16
|
defaultValue: 'https://cdn.builder.io/o/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fd27731a526464deba0016216f5f9e570%2Fcompressed?apiKey=YJIGb4i01jvw0SRdL5Bt&token=d27731a526464deba0016216f5f9e570&alt=media&optimized=true',
|
|
16
17
|
required: true
|
|
17
18
|
}, {
|
|
18
19
|
name: 'posterImage',
|
|
19
20
|
type: 'file',
|
|
20
|
-
allowedFileTypes:
|
|
21
|
+
allowedFileTypes: IMAGE_FILE_TYPES,
|
|
21
22
|
helperText: 'Image to show before the video plays'
|
|
22
23
|
}, {
|
|
23
24
|
name: 'autoPlay',
|
|
@@ -4,19 +4,26 @@ import { extractTextStyles } from '../../functions/extract-text-styles';
|
|
|
4
4
|
import { getStyle } from '../../functions/get-style';
|
|
5
5
|
import type { BuilderBlock } from '../../types/builder-block';
|
|
6
6
|
import type { RepeatData } from './types';
|
|
7
|
+
const checkIsComponentRestricted = (component: RegisteredComponent | null | undefined, model: string) => {
|
|
8
|
+
if (!component) return true;
|
|
9
|
+
if (!model) return false;
|
|
10
|
+
return component.models && component.models.length > 0 && !component.models.includes(model);
|
|
11
|
+
};
|
|
7
12
|
export const getComponent = ({
|
|
8
13
|
block,
|
|
9
|
-
registeredComponents
|
|
14
|
+
registeredComponents,
|
|
15
|
+
model
|
|
10
16
|
}: {
|
|
11
17
|
block: BuilderBlock;
|
|
12
18
|
registeredComponents: RegisteredComponents;
|
|
19
|
+
model: string;
|
|
13
20
|
}) => {
|
|
14
21
|
const componentName = block.component?.name;
|
|
15
22
|
if (!componentName) {
|
|
16
23
|
return null;
|
|
17
24
|
}
|
|
18
25
|
const ref = registeredComponents[componentName];
|
|
19
|
-
if (!ref) {
|
|
26
|
+
if (!ref || checkIsComponentRestricted(ref, model)) {
|
|
20
27
|
// TODO: Public doc page with more info about this message
|
|
21
28
|
console.warn(`
|
|
22
29
|
Could not find a registered component named "${componentName}".
|
|
@@ -93,10 +100,15 @@ export const provideLinkComponent = (block: RegisteredComponent | null | undefin
|
|
|
93
100
|
};
|
|
94
101
|
return {};
|
|
95
102
|
};
|
|
96
|
-
export const provideRegisteredComponents = (block: RegisteredComponent | null | undefined, registeredComponents: RegisteredComponents) => {
|
|
97
|
-
if (block?.shouldReceiveBuilderProps?.builderComponents)
|
|
98
|
-
|
|
99
|
-
|
|
103
|
+
export const provideRegisteredComponents = (block: RegisteredComponent | null | undefined, registeredComponents: RegisteredComponents, model: string) => {
|
|
104
|
+
if (block?.shouldReceiveBuilderProps?.builderComponents) {
|
|
105
|
+
const filteredRegisteredComponents = Object.fromEntries(Object.entries(registeredComponents).filter(([_, component]) => {
|
|
106
|
+
return !checkIsComponentRestricted(component, model);
|
|
107
|
+
}));
|
|
108
|
+
return {
|
|
109
|
+
builderComponents: filteredRegisteredComponents
|
|
110
|
+
};
|
|
111
|
+
}
|
|
100
112
|
return {};
|
|
101
113
|
};
|
|
102
114
|
export const provideBuilderBlock = (block: RegisteredComponent | null | undefined, builderBlock: BuilderBlock) => {
|
|
@@ -83,6 +83,7 @@ function Block(props: BlockProps) {
|
|
|
83
83
|
return getComponent({
|
|
84
84
|
block: processedBlock(),
|
|
85
85
|
registeredComponents: props.registeredComponents,
|
|
86
|
+
model: props.context.model,
|
|
86
87
|
});
|
|
87
88
|
}
|
|
88
89
|
|
|
@@ -134,7 +135,8 @@ function Block(props: BlockProps) {
|
|
|
134
135
|
...provideLinkComponent(blockComponent(), props.linkComponent),
|
|
135
136
|
...provideRegisteredComponents(
|
|
136
137
|
blockComponent(),
|
|
137
|
-
props.registeredComponents
|
|
138
|
+
props.registeredComponents,
|
|
139
|
+
props.context.model
|
|
138
140
|
),
|
|
139
141
|
},
|
|
140
142
|
context: {
|
|
@@ -1,61 +1,96 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, {memo, useContext} from 'react';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
StyleSheet,
|
|
7
|
-
Image,
|
|
8
|
-
Text,
|
|
9
|
-
Pressable,
|
|
10
|
-
TextInput,
|
|
11
|
-
TouchableOpacity,
|
|
12
|
-
Button,
|
|
13
|
-
Linking,
|
|
14
|
-
} from "react-native";
|
|
15
|
-
import { useContext } from "react";
|
|
3
|
+
FlatList
|
|
4
|
+
} from "react-native";
|
|
5
|
+
|
|
16
6
|
import BuilderContext from "../../context/builder.context";
|
|
17
7
|
import ComponentsContext from "../../context/components.context";
|
|
18
8
|
import Block from "../block/block";
|
|
19
9
|
import BlocksWrapper from "./blocks-wrapper";
|
|
20
10
|
import type { BlocksProps } from "./blocks.types";
|
|
21
11
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
12
|
+
type RenderBlockProps = {
|
|
13
|
+
item: any; // Replace 'any' with your block type
|
|
14
|
+
linkComponent?: React.ComponentType<any>;
|
|
15
|
+
context?: any; // Replace with your context type
|
|
16
|
+
registeredComponents?: any; // Replace with your components type
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// Moved outside and memoized
|
|
20
|
+
const RenderBlock = memo(({
|
|
21
|
+
item: block,
|
|
22
|
+
linkComponent,
|
|
23
|
+
context,
|
|
24
|
+
registeredComponents
|
|
25
|
+
}: RenderBlockProps) => (
|
|
26
|
+
<Block
|
|
27
|
+
key={block.id}
|
|
28
|
+
block={block}
|
|
29
|
+
linkComponent={linkComponent}
|
|
30
|
+
context={context}
|
|
31
|
+
registeredComponents={registeredComponents}
|
|
32
|
+
/>
|
|
33
|
+
));
|
|
34
|
+
|
|
35
|
+
// Optional: Give the component a display name for better debugging
|
|
36
|
+
RenderBlock.displayName = 'RenderBlock';
|
|
37
|
+
|
|
38
|
+
function Blocks(props: BlocksProps) {
|
|
39
|
+
const builderContext = useContext(BuilderContext);
|
|
40
|
+
const componentsContext = useContext(ComponentsContext);
|
|
41
|
+
|
|
42
|
+
// Memoize renderItem function to prevent unnecessary recreations
|
|
43
|
+
const renderItem = React.useCallback(({ item }: { item: any }) => (
|
|
44
|
+
<RenderBlock
|
|
45
|
+
item={item}
|
|
46
|
+
linkComponent={props.linkComponent}
|
|
47
|
+
context={props.context || builderContext}
|
|
48
|
+
registeredComponents={
|
|
49
|
+
props.registeredComponents || componentsContext?.registeredComponents
|
|
50
|
+
}
|
|
51
|
+
/>
|
|
52
|
+
), [
|
|
53
|
+
props.linkComponent,
|
|
54
|
+
props.context,
|
|
55
|
+
props.registeredComponents,
|
|
56
|
+
builderContext,
|
|
57
|
+
componentsContext?.registeredComponents
|
|
58
|
+
]);
|
|
59
|
+
|
|
60
|
+
// Memoize keyExtractor
|
|
61
|
+
const keyExtractor = React.useCallback((item: any) =>
|
|
62
|
+
item.id.toString()
|
|
63
|
+
, []);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<BlocksWrapper
|
|
67
|
+
blocks={props.blocks}
|
|
68
|
+
parent={props.parent}
|
|
69
|
+
path={props.path}
|
|
70
|
+
styleProp={props.styleProp}
|
|
71
|
+
classNameProp={props.className}
|
|
72
|
+
BlocksWrapper={
|
|
73
|
+
props.context?.BlocksWrapper || builderContext?.BlocksWrapper
|
|
74
|
+
}
|
|
75
|
+
BlocksWrapperProps={
|
|
76
|
+
props.context?.BlocksWrapperProps || builderContext?.BlocksWrapperProps
|
|
77
|
+
}
|
|
78
|
+
>
|
|
79
|
+
{props.blocks ? (
|
|
80
|
+
<FlatList
|
|
81
|
+
data={props.blocks}
|
|
82
|
+
renderItem={renderItem}
|
|
83
|
+
keyExtractor={keyExtractor}
|
|
84
|
+
// Optional: Add these props for better performance
|
|
85
|
+
removeClippedSubviews={true}
|
|
86
|
+
maxToRenderPerBatch={10}
|
|
87
|
+
windowSize={5}
|
|
88
|
+
initialNumToRender={5}
|
|
89
|
+
/>
|
|
90
|
+
) : null}
|
|
91
|
+
</BlocksWrapper>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Memoize the entire Blocks component
|
|
96
|
+
export default memo(Blocks);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TARGET } from '../../../constants/target';
|
|
2
|
+
import { isEditing } from '../../../functions/is-editing';
|
|
3
|
+
import { isPreviewing } from '../../../functions/is-previewing';
|
|
4
|
+
import type { Target } from '../../../types/targets';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* SDKS that use the elementRef approach to enable visual editing.
|
|
8
|
+
* We don't need to render the div for other SDKs as they attach event listeners to the window.
|
|
9
|
+
*/
|
|
10
|
+
export const SDKS_USING_ELEMENT_REF_APPROACH = (['svelte', 'qwik', 'vue'] as Target[]);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* We need to attach this div only when content exists or isPreviewing/isEditing even when content is null,
|
|
14
|
+
* as we need to set the elementRef and allow previewing and visual editing
|
|
15
|
+
*/
|
|
16
|
+
export const needsElementRefDivForEditing = () => {
|
|
17
|
+
return SDKS_USING_ELEMENT_REF_APPROACH.includes(TARGET) && (isEditing() || isPreviewing());
|
|
18
|
+
}
|