@builder.io/sdk-react 3.0.7 → 4.0.0

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 (73) hide show
  1. package/lib/browser/blocks-exports.cjs +32 -32
  2. package/lib/browser/blocks-exports.mjs +946 -908
  3. package/lib/browser/index.cjs +1 -1
  4. package/lib/browser/index.mjs +1 -1
  5. package/lib/browser/{server-entry-20c79b90.js → server-entry-422fad84.js} +26 -16
  6. package/lib/browser/server-entry-916191b4.cjs +2 -0
  7. package/lib/browser/server-entry.cjs +1 -1
  8. package/lib/browser/server-entry.mjs +1 -1
  9. package/lib/edge/{accordion-071aa4f9.cjs → accordion-2f83fc75.cjs} +1 -1
  10. package/lib/edge/{accordion-22c2c037.js → accordion-e1b77652.js} +1 -1
  11. package/lib/edge/{blocks-2989e629.js → blocks-0885e182.js} +2 -2
  12. package/lib/edge/{blocks-d3f37507.cjs → blocks-5165c164.cjs} +1 -1
  13. package/lib/edge/blocks-exports.cjs +1 -1
  14. package/lib/edge/blocks-exports.mjs +2 -2
  15. package/lib/edge/{button-a2cc6565.cjs → button-d7197e96.cjs} +1 -1
  16. package/lib/edge/{button-2b5270c4.js → button-d878f35c.js} +2 -2
  17. package/lib/edge/{columns-b7240242.cjs → columns-46729516.cjs} +1 -1
  18. package/lib/edge/{columns-21b9be25.js → columns-b365c86a.js} +3 -3
  19. package/lib/edge/{content-variants-88f4dc64.js → content-variants-1594c868.js} +281 -279
  20. package/lib/edge/content-variants-c6cab1c3.cjs +134 -0
  21. package/lib/edge/{form-77687883.cjs → form-9844766c.cjs} +1 -1
  22. package/lib/edge/{form-d29f3cc0.js → form-b66c20a3.js} +3 -3
  23. package/lib/edge/{get-class-prop-name-f597545d.cjs → get-class-prop-name-0b992cfb.cjs} +1 -1
  24. package/lib/edge/{get-class-prop-name-dbc5d99c.js → get-class-prop-name-dac81472.js} +1 -1
  25. package/lib/edge/{img-fed70928.js → img-c4a772a8.js} +1 -1
  26. package/lib/edge/{img-03f9002b.cjs → img-fb35350a.cjs} +1 -1
  27. package/lib/edge/index.cjs +1 -1
  28. package/lib/edge/index.mjs +1 -1
  29. package/lib/edge/{input-1e548fd0.cjs → input-122768ac.cjs} +1 -1
  30. package/lib/edge/{input-083c3c35.js → input-57c5b097.js} +1 -1
  31. package/lib/edge/{personalization-container-bcff3433.js → personalization-container-7e63edce.js} +4 -4
  32. package/lib/edge/{personalization-container-dde10a09.cjs → personalization-container-a17ae615.cjs} +1 -1
  33. package/lib/edge/{select-9f22c2ba.js → select-3d4324ef.js} +1 -1
  34. package/lib/edge/{select-21e33225.cjs → select-7f750b70.cjs} +1 -1
  35. package/lib/edge/server-entry-77166102.cjs +2 -0
  36. package/lib/edge/{server-entry-43a6f5be.js → server-entry-c1673af2.js} +28 -18
  37. package/lib/edge/server-entry.cjs +1 -1
  38. package/lib/edge/server-entry.mjs +1 -1
  39. package/lib/edge/{slot-ca171e8c.js → slot-05ef18a0.js} +3 -3
  40. package/lib/edge/{slot-a9f5d6c0.cjs → slot-123c0993.cjs} +1 -1
  41. package/lib/edge/symbol-ee314d5a.cjs +1 -0
  42. package/lib/edge/{symbol-8f6ff028.js → symbol-f488bea0.js} +25 -25
  43. package/lib/edge/{tabs-6b67fca2.js → tabs-244d53fa.js} +3 -3
  44. package/lib/edge/{tabs-880c9088.cjs → tabs-edb82022.cjs} +1 -1
  45. package/lib/edge/{video-a3f10439.js → video-52df64e2.js} +54 -17
  46. package/lib/edge/video-cc58dd83.cjs +1 -0
  47. package/lib/node/blocks-exports.cjs +32 -32
  48. package/lib/node/blocks-exports.mjs +781 -743
  49. package/lib/node/index.cjs +1 -1
  50. package/lib/node/index.mjs +3 -3
  51. package/lib/node/init.cjs +1 -1
  52. package/lib/node/init.mjs +3 -3
  53. package/lib/node/{server-entry-6626257d.js → server-entry-4df60fc5.js} +26 -16
  54. package/lib/node/server-entry-8ab8c78b.cjs +2 -0
  55. package/lib/node/server-entry.cjs +1 -1
  56. package/lib/node/server-entry.mjs +1 -1
  57. package/lib/node/{setIvm-5cb298bf.js → setIvm-0edfc727.js} +1 -1
  58. package/lib/node/{setIvm-49abbae6.cjs → setIvm-6405aa63.cjs} +1 -1
  59. package/lib/node/setIvm.cjs +1 -1
  60. package/lib/node/setIvm.mjs +2 -2
  61. package/lib/node/{should-force-browser-runtime-in-node-11e8399e.cjs → should-force-browser-runtime-in-node-6d4dbff9.cjs} +1 -1
  62. package/lib/node/{should-force-browser-runtime-in-node-94f1a5b3.js → should-force-browser-runtime-in-node-7a39b073.js} +1 -1
  63. package/package.json +1 -1
  64. package/types/components/content-variants/content-variants.types.d.ts +2 -2
  65. package/types/constants/sdk-version.d.ts +1 -1
  66. package/types/helpers/subscribe-to-editor.d.ts +13 -13
  67. package/types/scripts/init-editing.d.ts +3 -1
  68. package/lib/browser/server-entry-762e29e0.cjs +0 -2
  69. package/lib/edge/content-variants-fdd5ee50.cjs +0 -134
  70. package/lib/edge/server-entry-ac35a5c8.cjs +0 -2
  71. package/lib/edge/symbol-a2015c7e.cjs +0 -1
  72. package/lib/edge/video-4ecfd08b.cjs +0 -1
  73. package/lib/node/server-entry-0b433783.cjs +0 -2
@@ -1,15 +1,15 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { useState as s, useEffect as u } from "react";
3
- import { Content as C } from "./blocks-exports.mjs";
4
- import { getClassPropName as v } from "./get-class-prop-name-dbc5d99c.js";
5
- import { fetchOneEntry as k, logger as h } from "./server-entry-43a6f5be.js";
6
- const x = async ({
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { useState as C, useEffect as f } from "react";
3
+ import { Content as v } from "./blocks-exports.mjs";
4
+ import { getClassPropName as k } from "./get-class-prop-name-dac81472.js";
5
+ import { fetchOneEntry as h, logger as x } from "./server-entry-c1673af2.js";
6
+ const K = async ({
7
7
  builderContextValue: e,
8
8
  symbol: t
9
9
  }) => {
10
10
  if (t != null && t.model && // This is a hack, we should not need to check for this, but it is needed for Svelte.
11
11
  (e != null && e.apiKey))
12
- return k({
12
+ return h({
13
13
  model: t.model,
14
14
  apiKey: e.apiKey,
15
15
  apiVersion: e.apiVersion,
@@ -19,43 +19,43 @@ const x = async ({
19
19
  }
20
20
  }
21
21
  }).catch((o) => {
22
- h.error("Could not fetch symbol content: ", o);
22
+ x.error("Could not fetch symbol content: ", o);
23
23
  });
24
24
  };
25
- function j(e) {
26
- var r, a, c, d;
25
+ function B(e) {
26
+ var r, a, c, d, l;
27
27
  function t() {
28
28
  return "div";
29
29
  }
30
30
  function o() {
31
31
  return "div";
32
32
  }
33
- function f() {
34
- var n, l;
33
+ function b() {
34
+ var n, m;
35
35
  return [
36
- e.attributes[v()],
36
+ e.attributes[k()],
37
37
  "builder-symbol",
38
38
  (n = e.symbol) != null && n.inline ? "builder-inline-symbol" : void 0,
39
- (l = e.symbol) != null && l.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
39
+ (m = e.symbol) != null && m.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
40
40
  ].filter(Boolean).join(" ");
41
41
  }
42
- const [i, b] = s(() => {
42
+ const [i, y] = C(() => {
43
43
  var n;
44
44
  return (n = e.symbol) == null ? void 0 : n.content;
45
45
  });
46
- function y() {
47
- i || x({
46
+ function s() {
47
+ i || K({
48
48
  symbol: e.symbol,
49
49
  builderContextValue: e.builderContext
50
50
  }).then((n) => {
51
- n && b(n);
51
+ n && y(n);
52
52
  });
53
53
  }
54
- return u(() => {
55
- }, []), u(() => {
56
- y();
57
- }, [e.symbol]), /* @__PURE__ */ m("div", { ...e.attributes, className: f(), children: /* @__PURE__ */ m(
58
- C,
54
+ return f(() => {
55
+ }, []), f(() => {
56
+ s();
57
+ }, [e.symbol]), /* @__PURE__ */ u("div", { ...e.attributes, className: b(), children: /* @__PURE__ */ u(
58
+ v,
59
59
  {
60
60
  nonce: e.builderContext.nonce,
61
61
  isNestedRender: !0,
@@ -72,7 +72,7 @@ function j(e) {
72
72
  ...(c = i == null ? void 0 : i.data) == null ? void 0 : c.state
73
73
  },
74
74
  canTrack: e.builderContext.canTrack,
75
- model: (d = e.symbol) == null ? void 0 : d.model,
75
+ model: (l = (d = e.symbol) == null ? void 0 : d.model) != null ? l : "",
76
76
  content: i,
77
77
  linkComponent: e.builderLinkComponent,
78
78
  blocksWrapper: t(),
@@ -81,5 +81,5 @@ function j(e) {
81
81
  ) });
82
82
  }
83
83
  export {
84
- j as default
84
+ B as default
85
85
  };
@@ -1,9 +1,9 @@
1
1
  import { jsxs as u, jsx as i } from "react/jsx-runtime";
2
2
  import { useState as d } from "react";
3
- import { Blocks as c } from "./blocks-2989e629.js";
3
+ import { Blocks as c } from "./blocks-0885e182.js";
4
4
  import "./blocks-exports.mjs";
5
- import "./server-entry-43a6f5be.js";
6
- import "./get-class-prop-name-dbc5d99c.js";
5
+ import "./server-entry-c1673af2.js";
6
+ import "./get-class-prop-name-dac81472.js";
7
7
  import "./dynamic-renderer-8b343325.js";
8
8
  function y(t) {
9
9
  var b;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),u=require("react"),b=require("./blocks-d3f37507.cjs");require("./blocks-exports.cjs");require("./server-entry-ac35a5c8.cjs");require("./get-class-prop-name-f597545d.cjs");require("./dynamic-renderer-b29b45ca.cjs");function s(e){var o;const[t,a]=u.useState(()=>e.defaultActiveTab?e.defaultActiveTab-1:0);function c(n){return e.tabs&&e.tabs[n].content}function r(n){n===t&&e.collapsible?a(-1):a(n)}return l.jsxs("div",{children:[l.jsx("div",{className:"builder-tabs-wrap",style:{display:"flex",flexDirection:"row",justifyContent:e.tabHeaderLayout||"flex-start",overflow:"auto"},children:(o=e.tabs)==null?void 0:o.map((n,i)=>l.jsx("span",{className:`builder-tab-wrap ${t===i?"builder-tab-active":""}`,style:{...t===i?e.activeTabStyle:{}},onClick:d=>r(i),children:l.jsx(b.Blocks,{parent:e.builderBlock.id,path:`tabs.${i}.label`,blocks:n.label,context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent})},i))}),c(t)?l.jsx("div",{children:l.jsx(b.Blocks,{parent:e.builderBlock.id,path:`tabs.${t}.content`,blocks:c(t),context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent})}):null]})}exports.default=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),u=require("react"),b=require("./blocks-5165c164.cjs");require("./blocks-exports.cjs");require("./server-entry-77166102.cjs");require("./get-class-prop-name-0b992cfb.cjs");require("./dynamic-renderer-b29b45ca.cjs");function s(e){var o;const[t,a]=u.useState(()=>e.defaultActiveTab?e.defaultActiveTab-1:0);function c(n){return e.tabs&&e.tabs[n].content}function r(n){n===t&&e.collapsible?a(-1):a(n)}return l.jsxs("div",{children:[l.jsx("div",{className:"builder-tabs-wrap",style:{display:"flex",flexDirection:"row",justifyContent:e.tabHeaderLayout||"flex-start",overflow:"auto"},children:(o=e.tabs)==null?void 0:o.map((n,i)=>l.jsx("span",{className:`builder-tab-wrap ${t===i?"builder-tab-active":""}`,style:{...t===i?e.activeTabStyle:{}},onClick:d=>r(i),children:l.jsx(b.Blocks,{parent:e.builderBlock.id,path:`tabs.${i}.label`,blocks:n.label,context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent})},i))}),c(t)?l.jsx("div",{children:l.jsx(b.Blocks,{parent:e.builderBlock.id,path:`tabs.${t}.content`,blocks:c(t),context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent})}):null]})}exports.default=s;
@@ -1,7 +1,9 @@
1
- import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
- function f(e) {
3
- var i, l, n, o, d, u, a;
4
- function c() {
1
+ import { jsxs as z, jsx as i } from "react/jsx-runtime";
2
+ import { useRef as I, useState as R, useEffect as m } from "react";
3
+ function j(e) {
4
+ var a, c, d, u, s, f, h;
5
+ const n = I(null);
6
+ function b() {
5
7
  return {
6
8
  ...e.autoPlay === !0 ? {
7
9
  autoPlay: !0
@@ -20,28 +22,54 @@ function f(e) {
20
22
  } : {}
21
23
  };
22
24
  }
23
- function r() {
25
+ function g() {
24
26
  return {
25
- ...c()
27
+ ...b()
26
28
  };
27
29
  }
28
- return /* @__PURE__ */ s(
30
+ const [r, x] = R(() => {
31
+ });
32
+ return m(() => {
33
+ if (e.lazyLoad) {
34
+ const l = new IntersectionObserver(function(E) {
35
+ E.forEach(function(v) {
36
+ if (!v.isIntersecting)
37
+ return;
38
+ const o = v.target;
39
+ try {
40
+ Array.from(o.children).filter(
41
+ (t) => t instanceof HTMLElement && t.tagName === "SOURCE"
42
+ ).forEach((t) => {
43
+ const y = t.dataset.src;
44
+ y && (t.src = y);
45
+ }), o.load(), l.unobserve(o);
46
+ } catch (t) {
47
+ console.error("Error loading lazy video:", t);
48
+ }
49
+ });
50
+ });
51
+ n.current && l.observe(n.current), x(l);
52
+ }
53
+ }, []), m(() => () => {
54
+ r && r.disconnect();
55
+ }, []), /* @__PURE__ */ z(
29
56
  "div",
30
57
  {
31
58
  style: {
32
59
  position: "relative"
33
60
  },
34
61
  children: [
35
- /* @__PURE__ */ t(
62
+ /* @__PURE__ */ i(
36
63
  "video",
37
64
  {
38
65
  className: "builder-video",
39
- ...r(),
40
- preload: e.preload || "metadata",
66
+ ...g(),
67
+ ref: n,
68
+ preload: e.lazyLoad ? "none" : e.preload || "metadata",
41
69
  style: {
42
70
  width: "100%",
43
71
  height: "100%",
44
- ...(i = e.attributes) == null ? void 0 : i.style,
72
+ ...(a = e.attributes) == null ? void 0 : a.style,
45
73
  objectFit: e.fit,
46
74
  objectPosition: e.position,
47
75
  // Hack to get object fit to work as expected and
@@ -51,12 +79,21 @@ function f(e) {
51
79
  position: "absolute"
52
80
  } : null
53
81
  },
54
- src: e.video || "no-src",
55
82
  poster: e.posterImage,
56
- children: e.lazyLoad ? null : /* @__PURE__ */ t("source", { type: "video/mp4", src: e.video })
83
+ children: /* @__PURE__ */ i(
84
+ "source",
85
+ {
86
+ type: "video/mp4",
87
+ ...e.lazyLoad ? {
88
+ "data-src": e.video
89
+ } : {
90
+ src: e.video
91
+ }
92
+ }
93
+ )
57
94
  }
58
95
  ),
59
- e.aspectRatio && !(e.fitContent && ((n = (l = e.builderBlock) == null ? void 0 : l.children) != null && n.length)) ? /* @__PURE__ */ t(
96
+ e.aspectRatio && !(e.fitContent && ((d = (c = e.builderBlock) == null ? void 0 : c.children) != null && d.length)) ? /* @__PURE__ */ i(
60
97
  "div",
61
98
  {
62
99
  style: {
@@ -67,7 +104,7 @@ function f(e) {
67
104
  }
68
105
  }
69
106
  ) : null,
70
- (d = (o = e.builderBlock) == null ? void 0 : o.children) != null && d.length && e.fitContent ? /* @__PURE__ */ t(
107
+ (s = (u = e.builderBlock) == null ? void 0 : u.children) != null && s.length && e.fitContent ? /* @__PURE__ */ i(
71
108
  "div",
72
109
  {
73
110
  style: {
@@ -78,7 +115,7 @@ function f(e) {
78
115
  children: e.children
79
116
  }
80
117
  ) : null,
81
- (a = (u = e.builderBlock) == null ? void 0 : u.children) != null && a.length && !e.fitContent ? /* @__PURE__ */ t(
118
+ (h = (f = e.builderBlock) == null ? void 0 : f.children) != null && h.length && !e.fitContent ? /* @__PURE__ */ i(
82
119
  "div",
83
120
  {
84
121
  style: {
@@ -100,5 +137,5 @@ function f(e) {
100
137
  );
101
138
  }
102
139
  export {
103
- f as default
140
+ j as default
104
141
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),n=require("react");function E(e){var a,d,u,s,f,h,v;const l=n.useRef(null);function m(){return{...e.autoPlay===!0?{autoPlay:!0}:{},...e.muted===!0?{muted:!0}:{},...e.controls===!0?{controls:!0}:{},...e.loop===!0?{loop:!0}:{},...e.playsInline===!0?{playsInline:!0}:{}}}function g(){return{...m()}}const[c,x]=n.useState(()=>{});return n.useEffect(()=>{if(e.lazyLoad){const o=new IntersectionObserver(function(j){j.forEach(function(y){if(!y.isIntersecting)return;const r=y.target;try{Array.from(r.children).filter(t=>t instanceof HTMLElement&&t.tagName==="SOURCE").forEach(t=>{const b=t.dataset.src;b&&(t.src=b)}),r.load(),o.unobserve(r)}catch(t){console.error("Error loading lazy video:",t)}})});l.current&&o.observe(l.current),x(o)}},[]),n.useEffect(()=>()=>{c&&c.disconnect()},[]),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("video",{className:"builder-video",...g(),ref:l,preload:e.lazyLoad?"none":e.preload||"metadata",style:{width:"100%",height:"100%",...(a=e.attributes)==null?void 0:a.style,objectFit:e.fit,objectPosition:e.position,borderRadius:"1px",...e.aspectRatio?{position:"absolute"}:null},poster:e.posterImage,children:i.jsx("source",{type:"video/mp4",...e.lazyLoad?{"data-src":e.video}:{src:e.video}})}),e.aspectRatio&&!(e.fitContent&&((u=(d=e.builderBlock)==null?void 0:d.children)!=null&&u.length))?i.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}}):null,(f=(s=e.builderBlock)==null?void 0:s.children)!=null&&f.length&&e.fitContent?i.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children}):null,(v=(h=e.builderBlock)==null?void 0:h.children)!=null&&v.length&&!e.fitContent?i.jsx("div",{style:{pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"stretch",position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},children:e.children}):null]})}exports.default=E;