@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.
Files changed (86) hide show
  1. package/lib/browser/blocks/columns/columns.cjs +2 -2
  2. package/lib/browser/blocks/columns/columns.mjs +2 -2
  3. package/lib/browser/blocks/image/image.cjs +3 -3
  4. package/lib/browser/blocks/image/image.mjs +8 -8
  5. package/lib/browser/blocks/text/text.cjs +1 -1
  6. package/lib/browser/blocks/text/text.mjs +6 -24
  7. package/lib/browser/components/awaiter.cjs +1 -1
  8. package/lib/browser/components/block/block.cjs +1 -1
  9. package/lib/browser/components/block/block.mjs +27 -28
  10. package/lib/browser/components/blocks/blocks-wrapper.cjs +1 -1
  11. package/lib/browser/components/blocks/blocks-wrapper.mjs +2 -2
  12. package/lib/browser/components/content/components/enable-editor.cjs +1 -1
  13. package/lib/browser/components/content/components/enable-editor.mjs +102 -96
  14. package/lib/browser/constants/sdk-version.cjs +1 -1
  15. package/lib/browser/constants/sdk-version.mjs +1 -1
  16. package/lib/browser/functions/get-block-component-options.cjs +1 -1
  17. package/lib/browser/functions/get-block-component-options.mjs +21 -5
  18. package/lib/browser/functions/get-content/generate-content-url.cjs +1 -1
  19. package/lib/browser/functions/get-content/generate-content-url.mjs +60 -40
  20. package/lib/browser/functions/get-processed-block.cjs +1 -1
  21. package/lib/browser/functions/get-processed-block.mjs +18 -19
  22. package/lib/browser/helpers/flatten.cjs +1 -1
  23. package/lib/browser/helpers/flatten.mjs +28 -15
  24. package/lib/edge/blocks/columns/columns.cjs +2 -2
  25. package/lib/edge/blocks/columns/columns.mjs +2 -2
  26. package/lib/edge/blocks/image/image.cjs +3 -3
  27. package/lib/edge/blocks/image/image.mjs +8 -8
  28. package/lib/edge/blocks/text/text.cjs +1 -1
  29. package/lib/edge/blocks/text/text.mjs +6 -24
  30. package/lib/edge/components/awaiter.cjs +1 -1
  31. package/lib/edge/components/block/block.cjs +1 -1
  32. package/lib/edge/components/block/block.mjs +27 -28
  33. package/lib/edge/components/blocks/blocks-wrapper.cjs +1 -1
  34. package/lib/edge/components/blocks/blocks-wrapper.mjs +2 -2
  35. package/lib/edge/components/content/components/enable-editor.cjs +1 -1
  36. package/lib/edge/components/content/components/enable-editor.mjs +102 -96
  37. package/lib/edge/constants/sdk-version.cjs +1 -1
  38. package/lib/edge/constants/sdk-version.mjs +1 -1
  39. package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.cjs +5 -5
  40. package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.mjs +25 -28
  41. package/lib/edge/functions/get-block-component-options.cjs +1 -1
  42. package/lib/edge/functions/get-block-component-options.mjs +21 -5
  43. package/lib/edge/functions/get-content/generate-content-url.cjs +1 -1
  44. package/lib/edge/functions/get-content/generate-content-url.mjs +60 -40
  45. package/lib/edge/functions/get-processed-block.cjs +1 -1
  46. package/lib/edge/functions/get-processed-block.mjs +18 -19
  47. package/lib/edge/helpers/flatten.cjs +1 -1
  48. package/lib/edge/helpers/flatten.mjs +28 -15
  49. package/lib/node/blocks/columns/columns.cjs +2 -2
  50. package/lib/node/blocks/columns/columns.mjs +2 -2
  51. package/lib/node/blocks/image/image.cjs +3 -3
  52. package/lib/node/blocks/image/image.mjs +8 -8
  53. package/lib/node/blocks/text/text.cjs +1 -1
  54. package/lib/node/blocks/text/text.mjs +6 -24
  55. package/lib/node/components/awaiter.cjs +1 -1
  56. package/lib/node/components/block/block.cjs +1 -1
  57. package/lib/node/components/block/block.mjs +27 -28
  58. package/lib/node/components/blocks/blocks-wrapper.cjs +1 -1
  59. package/lib/node/components/blocks/blocks-wrapper.mjs +2 -2
  60. package/lib/node/components/content/components/enable-editor.cjs +1 -1
  61. package/lib/node/components/content/components/enable-editor.mjs +102 -96
  62. package/lib/node/constants/sdk-version.cjs +1 -1
  63. package/lib/node/constants/sdk-version.mjs +1 -1
  64. package/lib/node/functions/get-block-component-options.cjs +1 -1
  65. package/lib/node/functions/get-block-component-options.mjs +21 -5
  66. package/lib/node/functions/get-content/generate-content-url.cjs +1 -1
  67. package/lib/node/functions/get-content/generate-content-url.mjs +60 -40
  68. package/lib/node/functions/get-processed-block.cjs +1 -1
  69. package/lib/node/functions/get-processed-block.mjs +18 -19
  70. package/lib/node/helpers/flatten.cjs +1 -1
  71. package/lib/node/helpers/flatten.mjs +28 -15
  72. package/package.json +1 -1
  73. package/types/cjs/constants/sdk-version.d.ts +1 -1
  74. package/types/cjs/functions/get-block-component-options.d.ts +2 -1
  75. package/types/cjs/functions/get-processed-block.d.ts +1 -6
  76. package/types/cjs/helpers/flatten.d.ts +6 -0
  77. package/types/cjs/server-index.d.ts +1 -1
  78. package/types/cjs/types/builder-content.d.ts +1 -0
  79. package/types/cjs/types/input.d.ts +10 -0
  80. package/types/esm/constants/sdk-version.d.ts +1 -1
  81. package/types/esm/functions/get-block-component-options.d.ts +2 -1
  82. package/types/esm/functions/get-processed-block.d.ts +1 -6
  83. package/types/esm/helpers/flatten.d.ts +6 -0
  84. package/types/esm/server-index.d.ts +1 -1
  85. package/types/esm/types/builder-content.d.ts +1 -0
  86. 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 c(e) {
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) => c(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] = c(e[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 = c(m(e, "children", "meta"));
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: s,
51
- rootSetState: i
50
+ rootState: i,
51
+ rootSetState: o
52
52
  }) => {
53
53
  if (!e.bindings)
54
54
  return e;
55
- const o = v(e);
56
- for (const n in e.bindings) {
57
- const p = e.bindings[n], a = d({
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: s,
61
- rootSetState: i,
60
+ rootState: i,
61
+ rootSetState: o,
62
62
  context: r
63
63
  });
64
- y(o, n, a);
64
+ y(n, c, a);
65
65
  }
66
- return o;
66
+ return n;
67
67
  };
68
68
  function P({
69
69
  block: e,
70
70
  context: r,
71
- shouldEvaluateBindings: t,
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), t ? O({
76
+ return n = g(n), O({
78
77
  block: n,
79
- localState: s,
78
+ localState: t,
80
79
  rootState: i,
81
80
  rootSetState: o,
82
81
  context: r
83
- }) : n;
82
+ });
84
83
  }
85
84
  export {
86
- c as deepCloneWithConditions,
85
+ s as deepCloneWithConditions,
87
86
  P as getProcessedBlock
88
87
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function s(r,l=null,n="."){return Object.keys(r).reduce((o,e)=>{const t=r[e],i=[l,e].filter(Boolean).join(n);return[typeof t=="object",t!==null,!(Array.isArray(t)&&t.length===0)].every(Boolean)?{...o,...s(t,i,n)}:{...o,[i]:t}},{})}function u(r,l,n={}){for(const o in r){const e=r[o],t=l?l+"."+o:o;e&&typeof e=="object"&&!Array.isArray(e)&&!Object.keys(e).find(i=>i.startsWith("$"))?u(e,t,n):n[t]=e}return n}exports.flatten=s;exports.flattenMongoQuery=u;
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 s(r, l = null, n = ".") {
2
- return Object.keys(r).reduce((o, e) => {
3
- const t = r[e], i = [l, e].filter(Boolean).join(n);
4
- return [typeof t == "object", t !== null, !(Array.isArray(t) && t.length === 0)].every(Boolean) ? {
5
- ...o,
6
- ...s(t, i, n)
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
- ...o,
9
- [i]: t
8
+ ...n,
9
+ [r]: e
10
10
  };
11
11
  }, {});
12
12
  }
13
- function c(r, l, n = {}) {
14
- for (const o in r) {
15
- const e = r[o], t = l ? l + "." + o : o;
16
- e && typeof e == "object" && !Array.isArray(e) && !Object.keys(e).find((i) => i.startsWith("$")) ? c(e, t, n) : n[t] = e;
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 n;
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
- s as flatten,
22
- c as flattenMongoQuery
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.1",
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";
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, shouldEvaluateBindings, localState, rootState, rootSetState }: {
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';
@@ -33,6 +33,7 @@ export interface BuilderContent extends BuilderContentVariation {
33
33
  published?: 'published' | 'draft' | 'archived';
34
34
  modelId?: string;
35
35
  priority?: number;
36
+ firstPublished?: number;
36
37
  lastUpdated?: number;
37
38
  startDate?: number;
38
39
  endDate?: number;
@@ -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";
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, shouldEvaluateBindings, localState, rootState, rootSetState }: {
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';
@@ -33,6 +33,7 @@ export interface BuilderContent extends BuilderContentVariation {
33
33
  published?: 'published' | 'draft' | 'archived';
34
34
  modelId?: string;
35
35
  priority?: number;
36
+ firstPublished?: number;
36
37
  lastUpdated?: number;
37
38
  startDate?: number;
38
39
  endDate?: number;
@@ -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
  *