@builder.io/sdk-react-nextjs 0.17.1 → 0.17.3
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/blocks/columns/columns.cjs +2 -2
- package/lib/browser/blocks/columns/columns.mjs +2 -2
- package/lib/browser/blocks/image/image.cjs +3 -3
- package/lib/browser/blocks/image/image.mjs +8 -8
- package/lib/browser/blocks/text/text.cjs +1 -1
- package/lib/browser/blocks/text/text.mjs +6 -24
- package/lib/browser/components/awaiter.cjs +1 -1
- package/lib/browser/components/block/block.cjs +1 -1
- package/lib/browser/components/block/block.mjs +27 -28
- package/lib/browser/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/browser/components/blocks/blocks-wrapper.mjs +2 -2
- package/lib/browser/components/content/components/enable-editor.cjs +1 -1
- package/lib/browser/components/content/components/enable-editor.mjs +102 -96
- package/lib/browser/constants/sdk-version.cjs +1 -1
- package/lib/browser/constants/sdk-version.mjs +1 -1
- package/lib/browser/functions/get-block-component-options.cjs +1 -1
- package/lib/browser/functions/get-block-component-options.mjs +21 -5
- package/lib/browser/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/browser/functions/get-content/generate-content-url.mjs +60 -40
- package/lib/browser/functions/get-processed-block.cjs +1 -1
- package/lib/browser/functions/get-processed-block.mjs +18 -19
- package/lib/browser/helpers/flatten.cjs +1 -1
- package/lib/browser/helpers/flatten.mjs +28 -15
- package/lib/edge/blocks/columns/columns.cjs +2 -2
- package/lib/edge/blocks/columns/columns.mjs +2 -2
- package/lib/edge/blocks/image/image.cjs +3 -3
- package/lib/edge/blocks/image/image.mjs +8 -8
- package/lib/edge/blocks/text/text.cjs +1 -1
- package/lib/edge/blocks/text/text.mjs +6 -24
- package/lib/edge/components/awaiter.cjs +1 -1
- package/lib/edge/components/block/block.cjs +1 -1
- package/lib/edge/components/block/block.mjs +27 -28
- package/lib/edge/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/edge/components/blocks/blocks-wrapper.mjs +2 -2
- package/lib/edge/components/content/components/enable-editor.cjs +1 -1
- package/lib/edge/components/content/components/enable-editor.mjs +102 -96
- package/lib/edge/constants/sdk-version.cjs +1 -1
- package/lib/edge/constants/sdk-version.mjs +1 -1
- package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.cjs +5 -5
- package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.mjs +25 -28
- package/lib/edge/functions/get-block-component-options.cjs +1 -1
- package/lib/edge/functions/get-block-component-options.mjs +21 -5
- package/lib/edge/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/edge/functions/get-content/generate-content-url.mjs +60 -40
- package/lib/edge/functions/get-processed-block.cjs +1 -1
- package/lib/edge/functions/get-processed-block.mjs +18 -19
- package/lib/edge/helpers/flatten.cjs +1 -1
- package/lib/edge/helpers/flatten.mjs +28 -15
- package/lib/node/blocks/columns/columns.cjs +2 -2
- package/lib/node/blocks/columns/columns.mjs +2 -2
- package/lib/node/blocks/image/image.cjs +3 -3
- package/lib/node/blocks/image/image.mjs +8 -8
- package/lib/node/blocks/text/text.cjs +1 -1
- package/lib/node/blocks/text/text.mjs +6 -24
- package/lib/node/components/awaiter.cjs +1 -1
- package/lib/node/components/block/block.cjs +1 -1
- package/lib/node/components/block/block.mjs +27 -28
- package/lib/node/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/node/components/blocks/blocks-wrapper.mjs +2 -2
- package/lib/node/components/content/components/enable-editor.cjs +1 -1
- package/lib/node/components/content/components/enable-editor.mjs +102 -96
- package/lib/node/constants/sdk-version.cjs +1 -1
- package/lib/node/constants/sdk-version.mjs +1 -1
- package/lib/node/functions/get-block-component-options.cjs +1 -1
- package/lib/node/functions/get-block-component-options.mjs +21 -5
- package/lib/node/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/node/functions/get-content/generate-content-url.mjs +60 -40
- package/lib/node/functions/get-processed-block.cjs +1 -1
- package/lib/node/functions/get-processed-block.mjs +18 -19
- package/lib/node/helpers/flatten.cjs +1 -1
- package/lib/node/helpers/flatten.mjs +28 -15
- package/package.json +1 -1
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/functions/get-block-component-options.d.ts +2 -1
- package/types/cjs/functions/get-processed-block.d.ts +1 -6
- package/types/cjs/helpers/flatten.d.ts +6 -0
- package/types/cjs/server-index.d.ts +1 -1
- package/types/cjs/types/builder-content.d.ts +1 -0
- package/types/cjs/types/input.d.ts +10 -0
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/functions/get-block-component-options.d.ts +2 -1
- package/types/esm/functions/get-processed-block.d.ts +1 -6
- package/types/esm/helpers/flatten.d.ts +6 -0
- package/types/esm/server-index.d.ts +1 -1
- package/types/esm/types/builder-content.d.ts +1 -0
- package/types/esm/types/input.d.ts +10 -0
|
@@ -5,16 +5,16 @@ import { resolveLocalizedValues as f } from "./extract-localized-values.mjs";
|
|
|
5
5
|
import { fastClone as u } from "./fast-clone.mjs";
|
|
6
6
|
import { set as y } from "./set.mjs";
|
|
7
7
|
import { transformBlock as g } from "./transform-block.mjs";
|
|
8
|
-
function
|
|
8
|
+
function s(e) {
|
|
9
9
|
if (e === null || typeof e != "object")
|
|
10
10
|
return e;
|
|
11
11
|
if (Array.isArray(e))
|
|
12
|
-
return e.map((t) =>
|
|
12
|
+
return e.map((t) => s(t));
|
|
13
13
|
if (e["@type"] === "@builder.io/sdk:Element")
|
|
14
14
|
return e;
|
|
15
15
|
const r = {};
|
|
16
16
|
for (const t in e)
|
|
17
|
-
t !== "meta" && Object.prototype.hasOwnProperty.call(e, t) && (r[t] =
|
|
17
|
+
t !== "meta" && Object.prototype.hasOwnProperty.call(e, t) && (r[t] = s(e[t]));
|
|
18
18
|
return r;
|
|
19
19
|
}
|
|
20
20
|
const C = ["svelte", "vue", "angular", "qwik", "solid"].includes(l), v = (e) => {
|
|
@@ -30,7 +30,7 @@ const C = ["svelte", "vue", "angular", "qwik", "solid"].includes(l), v = (e) =>
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
} else {
|
|
33
|
-
const r =
|
|
33
|
+
const r = s(m(e, "children", "meta"));
|
|
34
34
|
return {
|
|
35
35
|
...r,
|
|
36
36
|
properties: {
|
|
@@ -47,42 +47,41 @@ const C = ["svelte", "vue", "angular", "qwik", "solid"].includes(l), v = (e) =>
|
|
|
47
47
|
block: e,
|
|
48
48
|
context: r,
|
|
49
49
|
localState: t,
|
|
50
|
-
rootState:
|
|
51
|
-
rootSetState:
|
|
50
|
+
rootState: i,
|
|
51
|
+
rootSetState: o
|
|
52
52
|
}) => {
|
|
53
53
|
if (!e.bindings)
|
|
54
54
|
return e;
|
|
55
|
-
const
|
|
56
|
-
for (const
|
|
57
|
-
const p = e.bindings[
|
|
55
|
+
const n = v(e);
|
|
56
|
+
for (const c in e.bindings) {
|
|
57
|
+
const p = e.bindings[c], a = d({
|
|
58
58
|
code: p,
|
|
59
59
|
localState: t,
|
|
60
|
-
rootState:
|
|
61
|
-
rootSetState:
|
|
60
|
+
rootState: i,
|
|
61
|
+
rootSetState: o,
|
|
62
62
|
context: r
|
|
63
63
|
});
|
|
64
|
-
y(
|
|
64
|
+
y(n, c, a);
|
|
65
65
|
}
|
|
66
|
-
return
|
|
66
|
+
return n;
|
|
67
67
|
};
|
|
68
68
|
function P({
|
|
69
69
|
block: e,
|
|
70
70
|
context: r,
|
|
71
|
-
|
|
72
|
-
localState: s,
|
|
71
|
+
localState: t,
|
|
73
72
|
rootState: i,
|
|
74
73
|
rootSetState: o
|
|
75
74
|
}) {
|
|
76
75
|
let n = f(e, i.locale);
|
|
77
|
-
return n = g(n),
|
|
76
|
+
return n = g(n), O({
|
|
78
77
|
block: n,
|
|
79
|
-
localState:
|
|
78
|
+
localState: t,
|
|
80
79
|
rootState: i,
|
|
81
80
|
rootSetState: o,
|
|
82
81
|
context: r
|
|
83
|
-
})
|
|
82
|
+
});
|
|
84
83
|
}
|
|
85
84
|
export {
|
|
86
|
-
|
|
85
|
+
s as deepCloneWithConditions,
|
|
87
86
|
P as getProcessedBlock
|
|
88
87
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(l,s=null,o="."){return Object.keys(l).reduce((n,t)=>{const e=l[t],r=[s,t].filter(Boolean).join(o);return[typeof e=="object",e!==null,!(Array.isArray(e)&&e.length===0)].every(Boolean)?{...n,...i(e,r,o)}:{...n,[r]:e}},{})}function u(l,s,o={}){for(const n in l){const t=l[n],e=s?s+"."+n:n;t&&typeof t=="object"&&!Array.isArray(t)&&!Object.keys(t).find(r=>r.startsWith("$"))?u(t,e,o):o[e]=t}return o}function c(l){const s={};for(const o in l){const n=o.split(".");let t=s;for(let e=0;e<n.length;e++){const r=n[e];e===n.length-1?t[r]=l[o]:(t[r]=t[r]||{},t=t[r])}}return s}exports.flatten=i;exports.flattenMongoQuery=u;exports.unflatten=c;
|
|
@@ -1,23 +1,36 @@
|
|
|
1
|
-
function
|
|
2
|
-
return Object.keys(
|
|
3
|
-
const
|
|
4
|
-
return [typeof
|
|
5
|
-
...
|
|
6
|
-
...
|
|
1
|
+
function c(l, s = null, o = ".") {
|
|
2
|
+
return Object.keys(l).reduce((n, t) => {
|
|
3
|
+
const e = l[t], r = [s, t].filter(Boolean).join(o);
|
|
4
|
+
return [typeof e == "object", e !== null, !(Array.isArray(e) && e.length === 0)].every(Boolean) ? {
|
|
5
|
+
...n,
|
|
6
|
+
...c(e, r, o)
|
|
7
7
|
} : {
|
|
8
|
-
...
|
|
9
|
-
[
|
|
8
|
+
...n,
|
|
9
|
+
[r]: e
|
|
10
10
|
};
|
|
11
11
|
}, {});
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
for (const
|
|
15
|
-
const
|
|
16
|
-
|
|
13
|
+
function i(l, s, o = {}) {
|
|
14
|
+
for (const n in l) {
|
|
15
|
+
const t = l[n], e = s ? s + "." + n : n;
|
|
16
|
+
t && typeof t == "object" && !Array.isArray(t) && !Object.keys(t).find((r) => r.startsWith("$")) ? i(t, e, o) : o[e] = t;
|
|
17
17
|
}
|
|
18
|
-
return
|
|
18
|
+
return o;
|
|
19
|
+
}
|
|
20
|
+
function u(l) {
|
|
21
|
+
const s = {};
|
|
22
|
+
for (const o in l) {
|
|
23
|
+
const n = o.split(".");
|
|
24
|
+
let t = s;
|
|
25
|
+
for (let e = 0; e < n.length; e++) {
|
|
26
|
+
const r = n[e];
|
|
27
|
+
e === n.length - 1 ? t[r] = l[o] : (t[r] = t[r] || {}, t = t[r]);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return s;
|
|
19
31
|
}
|
|
20
32
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
33
|
+
c as flatten,
|
|
34
|
+
i as flattenMongoQuery,
|
|
35
|
+
u as unflatten
|
|
23
36
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-react-nextjs",
|
|
3
3
|
"description": "Builder.io RSC SDK for NextJS App Directory",
|
|
4
|
-
"version": "0.17.
|
|
4
|
+
"version": "0.17.3",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/builder/tree/main/packages/sdks/output/nextjs",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.17.
|
|
1
|
+
export declare const SDK_VERSION = "0.17.3";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import type { BuilderContextInterface } from '../context/types.js';
|
|
1
2
|
import type { BuilderBlock } from '../types/builder-block.js';
|
|
2
|
-
export declare function getBlockComponentOptions(block: BuilderBlock): any;
|
|
3
|
+
export declare function getBlockComponentOptions(block: BuilderBlock, context: Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'>): any;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { BuilderContextInterface } from '../context/types.js';
|
|
2
2
|
import type { BuilderBlock } from '../types/builder-block.js';
|
|
3
3
|
export declare function deepCloneWithConditions<T = any>(obj: T): T;
|
|
4
|
-
export declare function getProcessedBlock({ block, context,
|
|
4
|
+
export declare function getProcessedBlock({ block, context, localState, rootState, rootSetState }: {
|
|
5
5
|
block: BuilderBlock;
|
|
6
|
-
/**
|
|
7
|
-
* In some cases, we want to avoid evaluating bindings and only want framework-specific block transformation. It is
|
|
8
|
-
* also sometimes too early to consider bindings, e.g. when we might be looking at a repeated block.
|
|
9
|
-
*/
|
|
10
|
-
shouldEvaluateBindings: boolean;
|
|
11
6
|
} & Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'>): BuilderBlock;
|
|
@@ -14,3 +14,9 @@ export declare function flatten<T extends Record<string, any>>(object: T, path?:
|
|
|
14
14
|
export declare function flattenMongoQuery(obj: any, _current?: any, _res?: any): {
|
|
15
15
|
[key: string]: string;
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Unflatten a flat object with dot-separated keys back into a nested object.
|
|
19
|
+
*
|
|
20
|
+
* { 'foo.bar': 'baz' } -> { foo: { bar: 'baz' }}
|
|
21
|
+
*/
|
|
22
|
+
export declare function unflatten(obj: any): any;
|
|
@@ -15,7 +15,7 @@ export type { ContentVariantsPrps as ContentProps } from './components/content-v
|
|
|
15
15
|
/**
|
|
16
16
|
* General Builder types
|
|
17
17
|
*/
|
|
18
|
-
export type { RegisteredComponent } from './context/types.js';
|
|
18
|
+
export type { BuilderContextInterface, RegisteredComponent, RegisteredComponents } from './context/types.js';
|
|
19
19
|
export type { BuilderBlock } from './types/builder-block.js';
|
|
20
20
|
export type { BuilderContent } from './types/builder-content.js';
|
|
21
21
|
export type { ComponentInfo } from './types/components.js';
|
|
@@ -19,6 +19,16 @@ export interface Input {
|
|
|
19
19
|
/** @hidden */
|
|
20
20
|
autoFocus?: boolean;
|
|
21
21
|
subFields?: Input[];
|
|
22
|
+
/**
|
|
23
|
+
* When input is of `type` `object`, use this field to collapse multiple inputs
|
|
24
|
+
* in the Visual Editor by default and preserve screen space.
|
|
25
|
+
*/
|
|
26
|
+
folded?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* When input is of `type` `object`, provide guidance in the Visual Editor
|
|
29
|
+
* on how to edit this object's contents.
|
|
30
|
+
*/
|
|
31
|
+
keysHelperText?: string;
|
|
22
32
|
/**
|
|
23
33
|
* Additional text to render in the UI to give guidance on how to use this
|
|
24
34
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.17.
|
|
1
|
+
export declare const SDK_VERSION = "0.17.3";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import type { BuilderContextInterface } from '../context/types.js';
|
|
1
2
|
import type { BuilderBlock } from '../types/builder-block.js';
|
|
2
|
-
export declare function getBlockComponentOptions(block: BuilderBlock): any;
|
|
3
|
+
export declare function getBlockComponentOptions(block: BuilderBlock, context: Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'>): any;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { BuilderContextInterface } from '../context/types.js';
|
|
2
2
|
import type { BuilderBlock } from '../types/builder-block.js';
|
|
3
3
|
export declare function deepCloneWithConditions<T = any>(obj: T): T;
|
|
4
|
-
export declare function getProcessedBlock({ block, context,
|
|
4
|
+
export declare function getProcessedBlock({ block, context, localState, rootState, rootSetState }: {
|
|
5
5
|
block: BuilderBlock;
|
|
6
|
-
/**
|
|
7
|
-
* In some cases, we want to avoid evaluating bindings and only want framework-specific block transformation. It is
|
|
8
|
-
* also sometimes too early to consider bindings, e.g. when we might be looking at a repeated block.
|
|
9
|
-
*/
|
|
10
|
-
shouldEvaluateBindings: boolean;
|
|
11
6
|
} & Pick<BuilderContextInterface, 'localState' | 'context' | 'rootState' | 'rootSetState'>): BuilderBlock;
|
|
@@ -14,3 +14,9 @@ export declare function flatten<T extends Record<string, any>>(object: T, path?:
|
|
|
14
14
|
export declare function flattenMongoQuery(obj: any, _current?: any, _res?: any): {
|
|
15
15
|
[key: string]: string;
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Unflatten a flat object with dot-separated keys back into a nested object.
|
|
19
|
+
*
|
|
20
|
+
* { 'foo.bar': 'baz' } -> { foo: { bar: 'baz' }}
|
|
21
|
+
*/
|
|
22
|
+
export declare function unflatten(obj: any): any;
|
|
@@ -15,7 +15,7 @@ export type { ContentVariantsPrps as ContentProps } from './components/content-v
|
|
|
15
15
|
/**
|
|
16
16
|
* General Builder types
|
|
17
17
|
*/
|
|
18
|
-
export type { RegisteredComponent } from './context/types.js';
|
|
18
|
+
export type { BuilderContextInterface, RegisteredComponent, RegisteredComponents } from './context/types.js';
|
|
19
19
|
export type { BuilderBlock } from './types/builder-block.js';
|
|
20
20
|
export type { BuilderContent } from './types/builder-content.js';
|
|
21
21
|
export type { ComponentInfo } from './types/components.js';
|
|
@@ -19,6 +19,16 @@ export interface Input {
|
|
|
19
19
|
/** @hidden */
|
|
20
20
|
autoFocus?: boolean;
|
|
21
21
|
subFields?: Input[];
|
|
22
|
+
/**
|
|
23
|
+
* When input is of `type` `object`, use this field to collapse multiple inputs
|
|
24
|
+
* in the Visual Editor by default and preserve screen space.
|
|
25
|
+
*/
|
|
26
|
+
folded?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* When input is of `type` `object`, provide guidance in the Visual Editor
|
|
29
|
+
* on how to edit this object's contents.
|
|
30
|
+
*/
|
|
31
|
+
keysHelperText?: string;
|
|
22
32
|
/**
|
|
23
33
|
* Additional text to render in the UI to give guidance on how to use this
|
|
24
34
|
*
|