@builder.io/sdk-react-nextjs 0.17.7 → 0.18.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 (69) hide show
  1. package/lib/browser/blocks/symbol/symbol.cjs +1 -1
  2. package/lib/browser/blocks/symbol/symbol.mjs +20 -20
  3. package/lib/browser/blocks/video/video.cjs +1 -1
  4. package/lib/browser/blocks/video/video.mjs +54 -17
  5. package/lib/browser/components/block/components/block-styles.cjs +1 -1
  6. package/lib/browser/components/block/components/block-styles.mjs +50 -42
  7. package/lib/browser/components/content/components/enable-editor.cjs +1 -1
  8. package/lib/browser/components/content/components/enable-editor.mjs +48 -45
  9. package/lib/browser/components/content/content.cjs +1 -1
  10. package/lib/browser/components/content/content.mjs +1 -1
  11. package/lib/browser/constants/device-sizes.cjs +1 -1
  12. package/lib/browser/constants/device-sizes.mjs +37 -20
  13. package/lib/browser/constants/sdk-version.cjs +1 -1
  14. package/lib/browser/constants/sdk-version.mjs +1 -1
  15. package/lib/browser/helpers/subscribe-to-editor.cjs +1 -1
  16. package/lib/browser/helpers/subscribe-to-editor.mjs +30 -22
  17. package/lib/browser/scripts/init-editing.cjs +1 -1
  18. package/lib/browser/scripts/init-editing.mjs +16 -13
  19. package/lib/edge/blocks/symbol/symbol.cjs +1 -1
  20. package/lib/edge/blocks/symbol/symbol.mjs +20 -20
  21. package/lib/edge/blocks/video/video.cjs +1 -1
  22. package/lib/edge/blocks/video/video.mjs +54 -17
  23. package/lib/edge/components/block/components/block-styles.cjs +1 -1
  24. package/lib/edge/components/block/components/block-styles.mjs +50 -42
  25. package/lib/edge/components/content/components/enable-editor.cjs +1 -1
  26. package/lib/edge/components/content/components/enable-editor.mjs +48 -45
  27. package/lib/edge/components/content/content.cjs +1 -1
  28. package/lib/edge/components/content/content.mjs +1 -1
  29. package/lib/edge/constants/device-sizes.cjs +1 -1
  30. package/lib/edge/constants/device-sizes.mjs +37 -20
  31. package/lib/edge/constants/sdk-version.cjs +1 -1
  32. package/lib/edge/constants/sdk-version.mjs +1 -1
  33. package/lib/edge/helpers/subscribe-to-editor.cjs +1 -1
  34. package/lib/edge/helpers/subscribe-to-editor.mjs +30 -22
  35. package/lib/edge/scripts/init-editing.cjs +1 -1
  36. package/lib/edge/scripts/init-editing.mjs +16 -13
  37. package/lib/node/blocks/symbol/symbol.cjs +1 -1
  38. package/lib/node/blocks/symbol/symbol.mjs +20 -20
  39. package/lib/node/blocks/video/video.cjs +1 -1
  40. package/lib/node/blocks/video/video.mjs +54 -17
  41. package/lib/node/components/block/components/block-styles.cjs +1 -1
  42. package/lib/node/components/block/components/block-styles.mjs +50 -42
  43. package/lib/node/components/content/components/enable-editor.cjs +1 -1
  44. package/lib/node/components/content/components/enable-editor.mjs +48 -45
  45. package/lib/node/components/content/content.cjs +1 -1
  46. package/lib/node/components/content/content.mjs +1 -1
  47. package/lib/node/constants/device-sizes.cjs +1 -1
  48. package/lib/node/constants/device-sizes.mjs +37 -20
  49. package/lib/node/constants/sdk-version.cjs +1 -1
  50. package/lib/node/constants/sdk-version.mjs +1 -1
  51. package/lib/node/helpers/subscribe-to-editor.cjs +1 -1
  52. package/lib/node/helpers/subscribe-to-editor.mjs +30 -22
  53. package/lib/node/scripts/init-editing.cjs +1 -1
  54. package/lib/node/scripts/init-editing.mjs +16 -13
  55. package/package.json +1 -1
  56. package/types/cjs/components/content-variants/content-variants.types.d.ts +2 -2
  57. package/types/cjs/constants/device-sizes.d.ts +3 -2
  58. package/types/cjs/constants/sdk-version.d.ts +1 -1
  59. package/types/cjs/helpers/subscribe-to-editor.d.ts +13 -13
  60. package/types/cjs/scripts/init-editing.d.ts +3 -1
  61. package/types/cjs/types/builder-block.d.ts +0 -1
  62. package/types/cjs/types/builder-content.d.ts +1 -0
  63. package/types/esm/components/content-variants/content-variants.types.d.ts +2 -2
  64. package/types/esm/constants/device-sizes.d.ts +3 -2
  65. package/types/esm/constants/sdk-version.d.ts +1 -1
  66. package/types/esm/helpers/subscribe-to-editor.d.ts +13 -13
  67. package/types/esm/scripts/init-editing.d.ts +3 -1
  68. package/types/esm/types/builder-block.d.ts +0 -1
  69. package/types/esm/types/builder-content.d.ts +1 -0
@@ -1,7 +1,12 @@
1
- import { fastClone as l } from "../functions/fast-clone.mjs";
1
+ import { fastClone as r } from "../functions/fast-clone.mjs";
2
2
  const o = {
3
+ xsmall: {
4
+ min: 0,
5
+ default: 160,
6
+ max: 320
7
+ },
3
8
  small: {
4
- min: 320,
9
+ min: 321,
5
10
  default: 321,
6
11
  max: 640
7
12
  },
@@ -15,34 +20,46 @@ const o = {
15
20
  default: 991,
16
21
  max: 1200
17
22
  }
18
- }, s = (a, e = o) => `@media (max-width: ${e[a].max}px)`, x = ({
19
- small: a,
20
- medium: e
21
- }) => {
22
- const m = l(o);
23
- if (!a || !e)
23
+ }, d = (a, m = o) => `@media (max-width: ${m[a].max}px)`, f = (a) => {
24
+ const m = r(o);
25
+ if (!a)
26
+ return m;
27
+ const {
28
+ xsmall: l,
29
+ small: e,
30
+ medium: t
31
+ } = a;
32
+ if (l) {
33
+ const x = Math.floor(l / 2);
34
+ m.xsmall = {
35
+ max: l,
36
+ min: x,
37
+ default: x + 1
38
+ };
39
+ }
40
+ if (!e || !t)
24
41
  return m;
25
- const t = Math.floor(a / 2);
42
+ const i = l ? m.xsmall.max + 1 : Math.floor(e / 2);
26
43
  m.small = {
27
- max: a,
28
- min: t,
29
- default: t + 1
30
- };
31
- const i = m.small.max + 1;
32
- m.medium = {
33
44
  max: e,
34
45
  min: i,
35
46
  default: i + 1
36
47
  };
37
- const n = m.medium.max + 1;
48
+ const n = m.small.max + 1;
49
+ m.medium = {
50
+ max: t,
51
+ min: n,
52
+ default: n + 1
53
+ };
54
+ const s = m.medium.max + 1;
38
55
  return m.large = {
39
56
  max: 2e3,
40
57
  // TODO: decide upper limit
41
- min: n,
42
- default: n + 1
58
+ min: s,
59
+ default: s + 1
43
60
  }, m;
44
61
  };
45
62
  export {
46
- s as getMaxWidthQueryForSize,
47
- x as getSizesForBreakpoints
63
+ d as getMaxWidthQueryForSize,
64
+ f as getSizesForBreakpoints
48
65
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.17.7";exports.SDK_VERSION=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.18.0";exports.SDK_VERSION=e;
@@ -1,4 +1,4 @@
1
- const o = "0.17.7";
1
+ const o = "0.18.0";
2
2
  export {
3
3
  o as SDK_VERSION
4
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../functions/is-browser.cjs"),u=require("../functions/is-from-trusted-host.cjs"),g=require("../scripts/init-editing.cjs"),b=require("./logger.cjs"),o=({model:n,trustedHosts:i,callbacks:e})=>t=>{if(!u.isFromTrustedHost(i,t))return;const{data:r}=t;if(r)switch(r.type){case"builder.configureSdk":{e.configureSdk(r.data);break}case"builder.triggerAnimation":{e.animation(r.data);break}case"builder.contentUpdate":{const s=r.data,a=s.key||s.alias||s.entry||s.modelName,d=s.data;a===n&&e.contentUpdate(d);break}}},m=(n,i,e)=>{if(!c.isBrowser)return b.logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};g.setupBrowserForEditing();const t=o({callbacks:{contentUpdate:i,animation:()=>{},configureSdk:()=>{}},model:n,trustedHosts:e==null?void 0:e.trustedHosts});return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}};exports.createEditorListener=o;exports.subscribeToEditor=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../functions/is-browser.cjs"),u=require("../functions/is-from-trusted-host.cjs"),g=require("../scripts/init-editing.cjs"),b=require("./logger.cjs"),s=({model:n,trustedHosts:o,callbacks:t})=>i=>{if(!u.isFromTrustedHost(o,i))return;const{data:e}=i;if(e)switch(e.type){case"builder.configureSdk":{t.configureSdk(e.data);break}case"builder.triggerAnimation":{t.animation(e.data);break}case"builder.contentUpdate":{const r=e.data,a=r.key||r.alias||r.entry||r.modelName,d=r.data;a===n&&t.contentUpdate(d);break}}},m=({model:n,apiKey:o,callback:t,trustedHosts:i})=>{if(!c.isBrowser)return b.logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};g.setupBrowserForEditing({modelName:n,apiKey:o});const e=s({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:n,trustedHosts:i});return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}};exports.createEditorListener=s;exports.subscribeToEditor=m;
@@ -3,52 +3,60 @@ import { isFromTrustedHost as c } from "../functions/is-from-trusted-host.mjs";
3
3
  import { setupBrowserForEditing as m } from "../scripts/init-editing.mjs";
4
4
  import { logger as u } from "./logger.mjs";
5
5
  const g = ({
6
- model: o,
7
- trustedHosts: s,
8
- callbacks: e
9
- }) => (t) => {
10
- if (!c(s, t))
6
+ model: n,
7
+ trustedHosts: i,
8
+ callbacks: t
9
+ }) => (o) => {
10
+ if (!c(i, o))
11
11
  return;
12
12
  const {
13
- data: r
14
- } = t;
15
- if (r)
16
- switch (r.type) {
13
+ data: e
14
+ } = o;
15
+ if (e)
16
+ switch (e.type) {
17
17
  case "builder.configureSdk": {
18
- e.configureSdk(r.data);
18
+ t.configureSdk(e.data);
19
19
  break;
20
20
  }
21
21
  case "builder.triggerAnimation": {
22
- e.animation(r.data);
22
+ t.animation(e.data);
23
23
  break;
24
24
  }
25
25
  case "builder.contentUpdate": {
26
- const n = r.data, i = n.key || n.alias || n.entry || n.modelName, a = n.data;
27
- i === o && e.contentUpdate(a);
26
+ const r = e.data, s = r.key || r.alias || r.entry || r.modelName, a = r.data;
27
+ s === n && t.contentUpdate(a);
28
28
  break;
29
29
  }
30
30
  }
31
- }, l = (o, s, e) => {
31
+ }, k = ({
32
+ model: n,
33
+ apiKey: i,
34
+ callback: t,
35
+ trustedHosts: o
36
+ }) => {
32
37
  if (!d)
33
38
  return u.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."), () => {
34
39
  };
35
- m();
36
- const t = g({
40
+ m({
41
+ modelName: n,
42
+ apiKey: i
43
+ });
44
+ const e = g({
37
45
  callbacks: {
38
- contentUpdate: s,
46
+ contentUpdate: t,
39
47
  animation: () => {
40
48
  },
41
49
  configureSdk: () => {
42
50
  }
43
51
  },
44
- model: o,
45
- trustedHosts: e == null ? void 0 : e.trustedHosts
52
+ model: n,
53
+ trustedHosts: o
46
54
  });
47
- return window.addEventListener("message", t), () => {
48
- window.removeEventListener("message", t);
55
+ return window.addEventListener("message", e), () => {
56
+ window.removeEventListener("message", e);
49
57
  };
50
58
  };
51
59
  export {
52
60
  g as createEditorListener,
53
- l as subscribeToEditor
61
+ k as subscribeToEditor
54
62
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../constants/sdk-version.cjs"),y=require("../constants/target.cjs"),b=require("../functions/is-browser.cjs"),M=require("../functions/is-from-trusted-host.cjs"),B=require("../functions/register.cjs"),E=()=>{B.register("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let c=!1;const v=(o={})=>{var a,i;c||(c=!0,b.isBrowser()&&((a=window.parent)==null||a.postMessage({type:"builder.sdkInfo",data:{target:y.TARGET,version:f.SDK_VERSION,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0,blockLevelPersonalization:!0}},"*"),(i=window.parent)==null||i.postMessage({type:"builder.updateContent",data:{options:o}},"*"),window.addEventListener("message",u=>{var d,l;if(!M.isFromTrustedHost(o.trustedHosts,u))return;const{data:e}=u;if(e!=null&&e.type)switch(e.type){case"builder.evaluate":{const g=e.data.text,m=e.data.arguments||[],r=e.data.id,w=new Function(g);let t,s=null;try{t=w.apply(null,m)}catch(n){s=n}s?(d=window.parent)==null||d.postMessage({type:"builder.evaluateError",data:{id:r,error:s.message}},"*"):t&&typeof t.then=="function"?t.then(n=>{var p;(p=window.parent)==null||p.postMessage({type:"builder.evaluateResult",data:{id:r,result:n}},"*")}).catch(console.error):(l=window.parent)==null||l.postMessage({type:"builder.evaluateResult",data:{result:t,id:r}},"*");break}}})))};exports.registerInsertMenu=E;exports.setupBrowserForEditing=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../constants/sdk-version.cjs"),y=require("../constants/target.cjs"),b=require("../functions/is-browser.cjs"),B=require("../functions/is-from-trusted-host.cjs"),M=require("../functions/register.cjs"),E=()=>{M.register("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let c=!1;const S=r=>{var o,i;c||(c=!0,b.isBrowser()&&((o=window.parent)==null||o.postMessage({type:"builder.sdkInfo",data:{target:y.TARGET,version:f.SDK_VERSION,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0,modelName:r.modelName,apiKey:r.apiKey,supportsXSmallBreakpoint:!0,blockLevelPersonalization:!0}},"*"),(i=window.parent)==null||i.postMessage({type:"builder.updateContent",data:{options:r}},"*"),window.addEventListener("message",u=>{var d,l;if(!B.isFromTrustedHost(r.trustedHosts,u))return;const{data:e}=u;if(e!=null&&e.type)switch(e.type){case"builder.evaluate":{const m=e.data.text,g=e.data.arguments||[],s=e.data.id,w=new Function(m);let t,a=null;try{t=w.apply(null,g)}catch(n){a=n}a?(d=window.parent)==null||d.postMessage({type:"builder.evaluateError",data:{id:s,error:a.message}},"*"):t&&typeof t.then=="function"?t.then(n=>{var p;(p=window.parent)==null||p.postMessage({type:"builder.evaluateResult",data:{id:s,result:n}},"*")}).catch(console.error):(l=window.parent)==null||l.postMessage({type:"builder.evaluateResult",data:{result:t,id:s}},"*");break}}})))};exports.registerInsertMenu=E;exports.setupBrowserForEditing=S;
@@ -1,10 +1,10 @@
1
1
  import { SDK_VERSION as w } from "../constants/sdk-version.mjs";
2
2
  import { TARGET as y } from "../constants/target.mjs";
3
3
  import { isBrowser as b } from "../functions/is-browser.mjs";
4
- import { isFromTrustedHost as C } from "../functions/is-from-trusted-host.mjs";
5
- import { register as E } from "../functions/register.mjs";
6
- const x = () => {
7
- E("insertMenu", {
4
+ import { isFromTrustedHost as B } from "../functions/is-from-trusted-host.mjs";
5
+ import { register as C } from "../functions/register.mjs";
6
+ const S = () => {
7
+ C("insertMenu", {
8
8
  name: "_default",
9
9
  default: !0,
10
10
  items: [{
@@ -27,7 +27,7 @@ const x = () => {
27
27
  });
28
28
  };
29
29
  let m = !1;
30
- const S = (a = {}) => {
30
+ const x = (r) => {
31
31
  var n, i;
32
32
  m || (m = !0, b() && ((n = window.parent) == null || n.postMessage({
33
33
  type: "builder.sdkInfo",
@@ -39,16 +39,19 @@ const S = (a = {}) => {
39
39
  // scope our '+ add block' button styling
40
40
  supportsAddBlockScoping: !0,
41
41
  supportsCustomBreakpoints: !0,
42
+ modelName: r.modelName,
43
+ apiKey: r.apiKey,
44
+ supportsXSmallBreakpoint: !0,
42
45
  blockLevelPersonalization: !0
43
46
  }
44
47
  }, "*"), (i = window.parent) == null || i.postMessage({
45
48
  type: "builder.updateContent",
46
49
  data: {
47
- options: a
50
+ options: r
48
51
  }
49
52
  }, "*"), window.addEventListener("message", (u) => {
50
53
  var p, d;
51
- if (!C(a.trustedHosts, u))
54
+ if (!B(r.trustedHosts, u))
52
55
  return;
53
56
  const {
54
57
  data: e
@@ -56,7 +59,7 @@ const S = (a = {}) => {
56
59
  if (e != null && e.type)
57
60
  switch (e.type) {
58
61
  case "builder.evaluate": {
59
- const c = e.data.text, f = e.data.arguments || [], r = e.data.id, g = new Function(c);
62
+ const c = e.data.text, f = e.data.arguments || [], a = e.data.id, g = new Function(c);
60
63
  let t, s = null;
61
64
  try {
62
65
  t = g.apply(null, f);
@@ -66,7 +69,7 @@ const S = (a = {}) => {
66
69
  s ? (p = window.parent) == null || p.postMessage({
67
70
  type: "builder.evaluateError",
68
71
  data: {
69
- id: r,
72
+ id: a,
70
73
  error: s.message
71
74
  }
72
75
  }, "*") : t && typeof t.then == "function" ? t.then((o) => {
@@ -74,7 +77,7 @@ const S = (a = {}) => {
74
77
  (l = window.parent) == null || l.postMessage({
75
78
  type: "builder.evaluateResult",
76
79
  data: {
77
- id: r,
80
+ id: a,
78
81
  result: o
79
82
  }
80
83
  }, "*");
@@ -82,7 +85,7 @@ const S = (a = {}) => {
82
85
  type: "builder.evaluateResult",
83
86
  data: {
84
87
  result: t,
85
- id: r
88
+ id: a
86
89
  }
87
90
  }, "*");
88
91
  break;
@@ -91,6 +94,6 @@ const S = (a = {}) => {
91
94
  })));
92
95
  };
93
96
  export {
94
- x as registerInsertMenu,
95
- S as setupBrowserForEditing
97
+ S as registerInsertMenu,
98
+ x as setupBrowserForEditing
96
99
  };
@@ -1 +1 @@
1
- "use strict";const s=require("react/jsx-runtime"),y=require("../../components/content-variants/content-variants.cjs"),C=require("../../functions/get-class-prop-name.cjs"),x=require("./symbol.helpers.cjs");async function k(e){var n,i,o,l,a;const u=function(){return"div"},d=function(){return"div"},m=function(){var r,b;return[e.attributes[C.getClassPropName()],"builder-symbol",(r=e.symbol)!=null&&r.inline?"builder-inline-symbol":void 0,(b=e.symbol)!=null&&b.dynamic||e.dynamic?"builder-dynamic-symbol":void 0].filter(Boolean).join(" ")},t=((n=e.symbol)==null?void 0:n.content)||await x.fetchSymbolContent({symbol:e.symbol,builderContextValue:e.builderContext});return s.jsx("div",{...e.attributes,className:m(),children:s.jsx(y,{nonce:e.builderContext.nonce,isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:{...e.builderContext.context,symbolId:(i=e.builderBlock)==null?void 0:i.id},customComponents:Object.values(e.builderComponents),data:{...(o=e.symbol)==null?void 0:o.data,...e.builderContext.localState,...(l=t==null?void 0:t.data)==null?void 0:l.state},canTrack:e.builderContext.canTrack,model:(a=e.symbol)==null?void 0:a.model,content:t,linkComponent:e.builderLinkComponent,blocksWrapper:u(),contentWrapper:d()})})}module.exports=k;
1
+ "use strict";const u=require("react/jsx-runtime"),C=require("../../components/content-variants/content-variants.cjs"),x=require("../../functions/get-class-prop-name.cjs"),k=require("./symbol.helpers.cjs");async function f(e){var n,i,o,l,a,c;const d=function(){return"div"},m=function(){return"div"},y=function(){var b,s;return[e.attributes[x.getClassPropName()],"builder-symbol",(b=e.symbol)!=null&&b.inline?"builder-inline-symbol":void 0,(s=e.symbol)!=null&&s.dynamic||e.dynamic?"builder-dynamic-symbol":void 0].filter(Boolean).join(" ")},t=((n=e.symbol)==null?void 0:n.content)||await k.fetchSymbolContent({symbol:e.symbol,builderContextValue:e.builderContext});return u.jsx("div",{...e.attributes,className:y(),children:u.jsx(C,{nonce:e.builderContext.nonce,isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:{...e.builderContext.context,symbolId:(i=e.builderBlock)==null?void 0:i.id},customComponents:Object.values(e.builderComponents),data:{...(o=e.symbol)==null?void 0:o.data,...e.builderContext.localState,...(l=t==null?void 0:t.data)==null?void 0:l.state},canTrack:e.builderContext.canTrack,model:(c=(a=e.symbol)==null?void 0:a.model)!=null?c:"",content:t,linkComponent:e.builderLinkComponent,blocksWrapper:d(),contentWrapper:m()})})}module.exports=f;
@@ -1,27 +1,27 @@
1
- import { jsx as b } from "react/jsx-runtime";
2
- import y from "../../components/content-variants/content-variants.mjs";
3
- import { getClassPropName as C } from "../../functions/get-class-prop-name.mjs";
4
- import { fetchSymbolContent as x } from "./symbol.helpers.mjs";
5
- async function N(e) {
6
- var n, o, i, l, a;
7
- const d = function() {
8
- return "div";
9
- }, u = function() {
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import C from "../../components/content-variants/content-variants.mjs";
3
+ import { getClassPropName as x } from "../../functions/get-class-prop-name.mjs";
4
+ import { fetchSymbolContent as f } from "./symbol.helpers.mjs";
5
+ async function V(e) {
6
+ var n, o, i, l, a, r;
7
+ const u = function() {
10
8
  return "div";
11
9
  }, s = function() {
12
- var c, m;
10
+ return "div";
11
+ }, y = function() {
12
+ var m, b;
13
13
  return [
14
- e.attributes[C()],
14
+ e.attributes[x()],
15
15
  "builder-symbol",
16
- (c = e.symbol) != null && c.inline ? "builder-inline-symbol" : void 0,
17
- (m = e.symbol) != null && m.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
16
+ (m = e.symbol) != null && m.inline ? "builder-inline-symbol" : void 0,
17
+ (b = e.symbol) != null && b.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
18
18
  ].filter(Boolean).join(" ");
19
- }, t = ((n = e.symbol) == null ? void 0 : n.content) || await x({
19
+ }, t = ((n = e.symbol) == null ? void 0 : n.content) || await f({
20
20
  symbol: e.symbol,
21
21
  builderContextValue: e.builderContext
22
22
  });
23
- return /* @__PURE__ */ b("div", { ...e.attributes, className: s(), children: /* @__PURE__ */ b(
24
- y,
23
+ return /* @__PURE__ */ d("div", { ...e.attributes, className: y(), children: /* @__PURE__ */ d(
24
+ C,
25
25
  {
26
26
  nonce: e.builderContext.nonce,
27
27
  isNestedRender: !0,
@@ -38,14 +38,14 @@ async function N(e) {
38
38
  ...(l = t == null ? void 0 : t.data) == null ? void 0 : l.state
39
39
  },
40
40
  canTrack: e.builderContext.canTrack,
41
- model: (a = e.symbol) == null ? void 0 : a.model,
41
+ model: (r = (a = e.symbol) == null ? void 0 : a.model) != null ? r : "",
42
42
  content: t,
43
43
  linkComponent: e.builderLinkComponent,
44
- blocksWrapper: d(),
45
- contentWrapper: u()
44
+ blocksWrapper: u(),
45
+ contentWrapper: s()
46
46
  }
47
47
  ) });
48
48
  }
49
49
  export {
50
- N as default
50
+ V as default
51
51
  };
@@ -1 +1 @@
1
- "use client";"use strict";const t=require("react/jsx-runtime");function s(e){var i,l,n,o,d,u,c;function a(){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 r(){return{...a()}}return t.jsxs("div",{style:{position:"relative"},children:[t.jsx("video",{className:"builder-video",...r(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(i=e.attributes)==null?void 0:i.style,objectFit:e.fit,objectPosition:e.position,borderRadius:"1px",...e.aspectRatio?{position:"absolute"}:null},src:e.video||"no-src",poster:e.posterImage,children:e.lazyLoad?null:t.jsx("source",{type:"video/mp4",src:e.video})}),e.aspectRatio&&!(e.fitContent&&((n=(l=e.builderBlock)==null?void 0:l.children)!=null&&n.length))?t.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}}):null,(d=(o=e.builderBlock)==null?void 0:o.children)!=null&&d.length&&e.fitContent?t.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children}):null,(c=(u=e.builderBlock)==null?void 0:u.children)!=null&&c.length&&!e.fitContent?t.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]})}module.exports=s;
1
+ "use client";"use strict";const i=require("react/jsx-runtime"),n=require("react");function j(e){var a,d,s,u,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 x(){return{...m()}}const[c,g]=n.useState(()=>{});return n.useEffect(()=>{if(e.lazyLoad){const o=new IntersectionObserver(function(E){E.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),g(o)}},[]),n.useEffect(()=>()=>{c&&c.disconnect()},[]),i.jsxs("div",{style:{position:"relative"},children:[i.jsx("video",{className:"builder-video",...x(),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&&((s=(d=e.builderBlock)==null?void 0:d.children)!=null&&s.length))?i.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}}):null,(f=(u=e.builderBlock)==null?void 0:u.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]})}module.exports=j;
@@ -1,8 +1,10 @@
1
1
  "use client";
2
- import { jsxs as s, jsx as t } from "react/jsx-runtime";
3
- function f(e) {
4
- var i, l, n, o, d, u, a;
5
- function c() {
2
+ import { jsxs as z, jsx as i } from "react/jsx-runtime";
3
+ import { useRef as I, useState as R, useEffect as m } from "react";
4
+ function j(e) {
5
+ var a, c, d, u, s, f, h;
6
+ const n = I(null);
7
+ function b() {
6
8
  return {
7
9
  ...e.autoPlay === !0 ? {
8
10
  autoPlay: !0
@@ -21,28 +23,54 @@ function f(e) {
21
23
  } : {}
22
24
  };
23
25
  }
24
- function r() {
26
+ function g() {
25
27
  return {
26
- ...c()
28
+ ...b()
27
29
  };
28
30
  }
29
- return /* @__PURE__ */ s(
31
+ const [r, x] = R(() => {
32
+ });
33
+ return m(() => {
34
+ if (e.lazyLoad) {
35
+ const l = new IntersectionObserver(function(E) {
36
+ E.forEach(function(v) {
37
+ if (!v.isIntersecting)
38
+ return;
39
+ const o = v.target;
40
+ try {
41
+ Array.from(o.children).filter(
42
+ (t) => t instanceof HTMLElement && t.tagName === "SOURCE"
43
+ ).forEach((t) => {
44
+ const y = t.dataset.src;
45
+ y && (t.src = y);
46
+ }), o.load(), l.unobserve(o);
47
+ } catch (t) {
48
+ console.error("Error loading lazy video:", t);
49
+ }
50
+ });
51
+ });
52
+ n.current && l.observe(n.current), x(l);
53
+ }
54
+ }, []), m(() => () => {
55
+ r && r.disconnect();
56
+ }, []), /* @__PURE__ */ z(
30
57
  "div",
31
58
  {
32
59
  style: {
33
60
  position: "relative"
34
61
  },
35
62
  children: [
36
- /* @__PURE__ */ t(
63
+ /* @__PURE__ */ i(
37
64
  "video",
38
65
  {
39
66
  className: "builder-video",
40
- ...r(),
41
- preload: e.preload || "metadata",
67
+ ...g(),
68
+ ref: n,
69
+ preload: e.lazyLoad ? "none" : e.preload || "metadata",
42
70
  style: {
43
71
  width: "100%",
44
72
  height: "100%",
45
- ...(i = e.attributes) == null ? void 0 : i.style,
73
+ ...(a = e.attributes) == null ? void 0 : a.style,
46
74
  objectFit: e.fit,
47
75
  objectPosition: e.position,
48
76
  // Hack to get object fit to work as expected and
@@ -52,12 +80,21 @@ function f(e) {
52
80
  position: "absolute"
53
81
  } : null
54
82
  },
55
- src: e.video || "no-src",
56
83
  poster: e.posterImage,
57
- children: e.lazyLoad ? null : /* @__PURE__ */ t("source", { type: "video/mp4", src: e.video })
84
+ children: /* @__PURE__ */ i(
85
+ "source",
86
+ {
87
+ type: "video/mp4",
88
+ ...e.lazyLoad ? {
89
+ "data-src": e.video
90
+ } : {
91
+ src: e.video
92
+ }
93
+ }
94
+ )
58
95
  }
59
96
  ),
60
- e.aspectRatio && !(e.fitContent && ((n = (l = e.builderBlock) == null ? void 0 : l.children) != null && n.length)) ? /* @__PURE__ */ t(
97
+ e.aspectRatio && !(e.fitContent && ((d = (c = e.builderBlock) == null ? void 0 : c.children) != null && d.length)) ? /* @__PURE__ */ i(
61
98
  "div",
62
99
  {
63
100
  style: {
@@ -68,7 +105,7 @@ function f(e) {
68
105
  }
69
106
  }
70
107
  ) : null,
71
- (d = (o = e.builderBlock) == null ? void 0 : o.children) != null && d.length && e.fitContent ? /* @__PURE__ */ t(
108
+ (s = (u = e.builderBlock) == null ? void 0 : u.children) != null && s.length && e.fitContent ? /* @__PURE__ */ i(
72
109
  "div",
73
110
  {
74
111
  style: {
@@ -79,7 +116,7 @@ function f(e) {
79
116
  children: e.children
80
117
  }
81
118
  ) : null,
82
- (a = (u = e.builderBlock) == null ? void 0 : u.children) != null && a.length && !e.fitContent ? /* @__PURE__ */ t(
119
+ (h = (f = e.builderBlock) == null ? void 0 : f.children) != null && h.length && !e.fitContent ? /* @__PURE__ */ i(
83
120
  "div",
84
121
  {
85
122
  style: {
@@ -101,5 +138,5 @@ function f(e) {
101
138
  );
102
139
  }
103
140
  export {
104
- f as default
141
+ j as default
105
142
  };
@@ -1 +1 @@
1
- "use strict";const o=require("react/jsx-runtime"),a=require("../../../constants/device-sizes.cjs"),j=require("../../../functions/camel-to-kebab-case.cjs"),c=require("../../../helpers/css.cjs"),b=require("../../../helpers/nullable.cjs"),z=require("../../inlined-styles.cjs");function F(i){const f=function(){const e=i.block;return b.checkIsDefined(e.hide)?!e.hide:b.checkIsDefined(e.show)?e.show:!0},u=function(){var C,k,g;const e=i.block,s=e.responsiveStyles,r=i.context.content,d=a.getSizesForBreakpoints(((C=r==null?void 0:r.meta)==null?void 0:C.breakpoints)||{}),m=s==null?void 0:s.large,y=s==null?void 0:s.medium,h=s==null?void 0:s.small,n=e.id;if(!n)return"";const v=m?c.createCssClass({className:n,styles:m}):"",B=y?c.createCssClass({className:n,styles:y,mediaQuery:a.getMaxWidthQueryForSize("medium",d)}):"",q=h?c.createCssClass({className:n,styles:h,mediaQuery:a.getMaxWidthQueryForSize("small",d)}):"",t=e.animations&&e.animations.find(l=>l.trigger==="hover");let S="";if(t){const l=((g=(k=t.steps)==null?void 0:k[1])==null?void 0:g.styles)||{};S=c.createCssClass({className:`${n}:hover`,styles:{...l,transition:`all ${t.duration}s ${j.camelToKebabCase(t.easing)}`,transitionDelay:t.delay?`${t.delay}s`:"0s"}})||""}return[v,B,q,S].join(" ")};return o.jsx(o.Fragment,{children:u()&&f()?o.jsx(o.Fragment,{children:o.jsx(z,{id:"builderio-block",styles:u(),nonce:i.context.nonce})}):null})}module.exports=F;
1
+ "use strict";const a=require("react/jsx-runtime"),r=require("../../../constants/device-sizes.cjs"),$=require("../../../functions/camel-to-kebab-case.cjs"),o=require("../../../helpers/css.cjs"),B=require("../../../helpers/nullable.cjs"),w=require("../../inlined-styles.cjs");function W(i){const v=function(){const s=i.block;return B.checkIsDefined(s.hide)?!s.hide:B.checkIsDefined(s.show)?s.show:!0},u=function(){var k,x,g,b,f;const s=i.block,e=s.responsiveStyles,t=i.context.content,c=r.getSizesForBreakpoints(((k=t==null?void 0:t.meta)==null?void 0:k.breakpoints)||{}),z=!!((g=(x=t==null?void 0:t.meta)==null?void 0:x.breakpoints)!=null&&g.xsmall),d=e==null?void 0:e.large,y=e==null?void 0:e.medium,S=e==null?void 0:e.small,h=e==null?void 0:e.xsmall,n=s.id;if(!n)return"";const F=d?o.createCssClass({className:n,styles:d}):"",Q=y?o.createCssClass({className:n,styles:y,mediaQuery:r.getMaxWidthQueryForSize("medium",c)}):"",j=S?o.createCssClass({className:n,styles:S,mediaQuery:r.getMaxWidthQueryForSize("small",c)}):"",p=h&&z?o.createCssClass({className:n,styles:h,mediaQuery:r.getMaxWidthQueryForSize("xsmall",c)}):"",l=s.animations&&s.animations.find(m=>m.trigger==="hover");let C="";if(l){const m=((f=(b=l.steps)==null?void 0:b[1])==null?void 0:f.styles)||{};C=o.createCssClass({className:`${n}:hover`,styles:{...m,transition:`all ${l.duration}s ${$.camelToKebabCase(l.easing)}`,transitionDelay:l.delay?`${l.delay}s`:"0s"}})||""}return[F,Q,j,p,C].join(" ")};return a.jsx(a.Fragment,{children:u()&&v()?a.jsx(a.Fragment,{children:a.jsx(w,{id:"builderio-block",styles:u(),nonce:i.context.nonce})}):null})}module.exports=W;
@@ -1,68 +1,76 @@
1
- import { jsx as a, Fragment as g } from "react/jsx-runtime";
2
- import { getSizesForBreakpoints as $, getMaxWidthQueryForSize as p } from "../../../constants/device-sizes.mjs";
3
- import { camelToKebabCase as z } from "../../../functions/camel-to-kebab-case.mjs";
4
- import { createCssClass as i } from "../../../helpers/css.mjs";
5
- import { checkIsDefined as b } from "../../../helpers/nullable.mjs";
6
- import F from "../../inlined-styles.mjs";
7
- function A(n) {
8
- const B = function() {
9
- const e = n.block;
10
- return b(e.hide) ? !e.hide : b(e.show) ? e.show : !0;
11
- }, c = function() {
12
- var h, S, k;
13
- const e = n.block, s = e.responsiveStyles, l = n.context.content, m = $(
14
- ((h = l == null ? void 0 : l.meta) == null ? void 0 : h.breakpoints) || {}
15
- ), d = s == null ? void 0 : s.large, u = s == null ? void 0 : s.medium, y = s == null ? void 0 : s.small, o = e.id;
1
+ import { jsx as c, Fragment as b } from "react/jsx-runtime";
2
+ import { getSizesForBreakpoints as D, getMaxWidthQueryForSize as m } from "../../../constants/device-sizes.mjs";
3
+ import { camelToKebabCase as I } from "../../../functions/camel-to-kebab-case.mjs";
4
+ import { createCssClass as n } from "../../../helpers/css.mjs";
5
+ import { checkIsDefined as C } from "../../../helpers/nullable.mjs";
6
+ import N from "../../inlined-styles.mjs";
7
+ function U(a) {
8
+ const v = function() {
9
+ const e = a.block;
10
+ return C(e.hide) ? !e.hide : C(e.show) ? e.show : !0;
11
+ }, d = function() {
12
+ var k, p, x, g, B;
13
+ const e = a.block, s = e.responsiveStyles, t = a.context.content, i = D(
14
+ ((k = t == null ? void 0 : t.meta) == null ? void 0 : k.breakpoints) || {}
15
+ ), Q = !!((x = (p = t == null ? void 0 : t.meta) == null ? void 0 : p.breakpoints) != null && x.xsmall), u = s == null ? void 0 : s.large, y = s == null ? void 0 : s.medium, S = s == null ? void 0 : s.small, f = s == null ? void 0 : s.xsmall, o = e.id;
16
16
  if (!o)
17
17
  return "";
18
- const v = d ? i({
18
+ const $ = u ? n({
19
19
  className: o,
20
- styles: d
21
- }) : "", x = u ? i({
20
+ styles: u
21
+ }) : "", z = y ? n({
22
22
  className: o,
23
- styles: u,
24
- mediaQuery: p(
23
+ styles: y,
24
+ mediaQuery: m(
25
25
  "medium",
26
- m
26
+ i
27
27
  )
28
- }) : "", w = y ? i({
28
+ }) : "", F = S ? n({
29
29
  className: o,
30
- styles: y,
31
- mediaQuery: p(
30
+ styles: S,
31
+ mediaQuery: m(
32
32
  "small",
33
- m
33
+ i
34
+ )
35
+ }) : "", j = f && Q ? n({
36
+ className: o,
37
+ styles: f,
38
+ mediaQuery: m(
39
+ "xsmall",
40
+ i
34
41
  )
35
- }) : "", t = e.animations && e.animations.find((r) => r.trigger === "hover");
36
- let f = "";
37
- if (t) {
38
- const r = ((k = (S = t.steps) == null ? void 0 : S[1]) == null ? void 0 : k.styles) || {};
39
- f = i({
42
+ }) : "", l = e.animations && e.animations.find((r) => r.trigger === "hover");
43
+ let h = "";
44
+ if (l) {
45
+ const r = ((B = (g = l.steps) == null ? void 0 : g[1]) == null ? void 0 : B.styles) || {};
46
+ h = n({
40
47
  className: `${o}:hover`,
41
48
  styles: {
42
49
  ...r,
43
- transition: `all ${t.duration}s ${z(
44
- t.easing
50
+ transition: `all ${l.duration}s ${I(
51
+ l.easing
45
52
  )}`,
46
- transitionDelay: t.delay ? `${t.delay}s` : "0s"
53
+ transitionDelay: l.delay ? `${l.delay}s` : "0s"
47
54
  }
48
55
  }) || "";
49
56
  }
50
57
  return [
51
- v,
52
- x,
53
- w,
54
- f
58
+ $,
59
+ z,
60
+ F,
61
+ j,
62
+ h
55
63
  ].join(" ");
56
64
  };
57
- return /* @__PURE__ */ a(g, { children: c() && B() ? /* @__PURE__ */ a(g, { children: /* @__PURE__ */ a(
58
- F,
65
+ return /* @__PURE__ */ c(b, { children: d() && v() ? /* @__PURE__ */ c(b, { children: /* @__PURE__ */ c(
66
+ N,
59
67
  {
60
68
  id: "builderio-block",
61
- styles: c(),
62
- nonce: n.context.nonce
69
+ styles: d(),
70
+ nonce: a.context.nonce
63
71
  }
64
72
  ) }) : null });
65
73
  }
66
74
  export {
67
- A as default
75
+ U as default
68
76
  };