@builder.io/sdk-react 0.11.0 → 0.11.2
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/index.cjs +2 -2
- package/lib/browser/index.mjs +54 -50
- package/lib/edge/index.cjs +13 -13
- package/lib/edge/index.mjs +24 -20
- package/lib/node/index.cjs +2 -2
- package/lib/node/index.mjs +24 -20
- package/package.json +1 -1
- package/types/components/block/components/interactive-element.d.ts +3 -2
- package/types/constants/sdk-version.d.ts +1 -1
package/lib/browser/index.cjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
${_e(n)}
|
|
8
8
|
}`;return e?`${e} {
|
|
9
9
|
${i}
|
|
10
|
-
}`:i};function _(e){return a.jsx("style",{dangerouslySetInnerHTML:{__html:e.styles},id:e.id})}function G(e){function t(){const i=$({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0});return d.checkIsDefined(i.hide)?!i.hide:d.checkIsDefined(i.show)?i.show:!0}function n(){var S;const i=$({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0}),o=i.responsiveStyles,r=e.context.content,c=fe(((S=r==null?void 0:r.meta)==null?void 0:S.breakpoints)||{}),l=o==null?void 0:o.large,s=o==null?void 0:o.medium,u=o==null?void 0:o.small,f=i.id;if(!f)return"";const b=l?U({className:f,styles:l}):"",v=s?U({className:f,styles:s,mediaQuery:te("medium",c)}):"",R=u?U({className:f,styles:u,mediaQuery:te("small",c)}):"";return[b,v,R].join(" ")}return a.jsx(a.Fragment,{children:n()&&t()?a.jsx(a.Fragment,{children:a.jsx(_,{styles:n()})}):null})}function Me(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Le=e=>`on${Me(e)}`,De=(e,t)=>n=>W({code:e,context:t.context,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,event:n,isExpression:!1});function H(e){var i;const t={},n=(i=e.block.actions)!=null?i:{};for(const o in n){if(!n.hasOwnProperty(o))continue;const r=n[o];let c=Le(o);if(e.stripPrefix)switch(d.TARGET){case"vue":c=c.replace("v-on:","");break;case"svelte":c=c.replace("on:","");break}t[c]=De(r,e)}return t}function Oe({properties:e}){return e.className=e.class,delete e.class,e}const Ue=e=>({href:e.href});function N({block:e,context:t}){var i;const n={...Ue(e),...e.properties,"builder-id":e.id,style:e.style?Ke(e.style):void 0,class:[e.id,"builder-block",e.class,(i=e.properties)==null?void 0:i.class].filter(Boolean).join(" ")};return Oe({properties:n,context:t,block:e})}function Ke(e){switch(d.TARGET){case"svelte":case"vue":case"solid":return ge(e).join(" ");case"qwik":case"reactNative":case"react":case"rsc":return e}}function ne(e){return a.jsxs(a.Fragment,{children:[" ",e.hasChildren?a.jsx(a.Fragment,{children:a.jsxs(e.Wrapper,{...N({block:e.block,context:e.context}),...H({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0}),children:[" ",e.children," "]})}):a.jsx(a.Fragment,{children:a.jsx(e.Wrapper,{...N({block:e.block,context:e.context}),...H({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0})})})," "]})}function He(e){return a.jsx(e.Wrapper,{...e.wrapperProps,attributes:{...N({block:e.block,context:e.context}),...H({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context})},children:e.children})}const ze=({componentOptions:e,builderBlock:t,context:n,componentRef:i,includeBlockProps:o,isInteractive:r,contextValue:c})=>
|
|
10
|
+
}`:i};function _(e){return a.jsx("style",{dangerouslySetInnerHTML:{__html:e.styles},id:e.id})}function G(e){function t(){const i=$({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0});return d.checkIsDefined(i.hide)?!i.hide:d.checkIsDefined(i.show)?i.show:!0}function n(){var S;const i=$({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0}),o=i.responsiveStyles,r=e.context.content,c=fe(((S=r==null?void 0:r.meta)==null?void 0:S.breakpoints)||{}),l=o==null?void 0:o.large,s=o==null?void 0:o.medium,u=o==null?void 0:o.small,f=i.id;if(!f)return"";const b=l?U({className:f,styles:l}):"",v=s?U({className:f,styles:s,mediaQuery:te("medium",c)}):"",R=u?U({className:f,styles:u,mediaQuery:te("small",c)}):"";return[b,v,R].join(" ")}return a.jsx(a.Fragment,{children:n()&&t()?a.jsx(a.Fragment,{children:a.jsx(_,{styles:n()})}):null})}function Me(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Le=e=>`on${Me(e)}`,De=(e,t)=>n=>W({code:e,context:t.context,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,event:n,isExpression:!1});function H(e){var i;const t={},n=(i=e.block.actions)!=null?i:{};for(const o in n){if(!n.hasOwnProperty(o))continue;const r=n[o];let c=Le(o);if(e.stripPrefix)switch(d.TARGET){case"vue":c=c.replace("v-on:","");break;case"svelte":c=c.replace("on:","");break}t[c]=De(r,e)}return t}function Oe({properties:e}){return e.className=e.class,delete e.class,e}const Ue=e=>({href:e.href});function N({block:e,context:t}){var i;const n={...Ue(e),...e.properties,"builder-id":e.id,style:e.style?Ke(e.style):void 0,class:[e.id,"builder-block",e.class,(i=e.properties)==null?void 0:i.class].filter(Boolean).join(" ")};return Oe({properties:n,context:t,block:e})}function Ke(e){switch(d.TARGET){case"svelte":case"vue":case"solid":return ge(e).join(" ");case"qwik":case"reactNative":case"react":case"rsc":return e}}function ne(e){return a.jsxs(a.Fragment,{children:[" ",e.hasChildren?a.jsx(a.Fragment,{children:a.jsxs(e.Wrapper,{...N({block:e.block,context:e.context}),...H({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0}),children:[" ",e.children," "]})}):a.jsx(a.Fragment,{children:a.jsx(e.Wrapper,{...N({block:e.block,context:e.context}),...H({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0})})})," "]})}function He(e){return a.jsx(e.Wrapper,{...e.wrapperProps,attributes:e.includeBlockProps?{...N({block:e.block,context:e.context}),...H({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context})}:{},children:e.children})}const ze=({componentOptions:e,builderBlock:t,context:n,componentRef:i,includeBlockProps:o,isInteractive:r,contextValue:c})=>{const l={...e,...o?{attributes:N({block:t,context:c})}:{}};return r?{Wrapper:i,block:t,context:n,wrapperProps:e,includeBlockProps:o}:l};function ie(e){var i,o;const[t,n]=m.useState(()=>e.isInteractive?He:e.componentRef);return a.jsx(a.Fragment,{children:e.componentRef?a.jsx(a.Fragment,{children:a.jsxs(t,{...ze({componentOptions:e.componentOptions,builderBlock:e.builderBlock,context:e.context,componentRef:e.componentRef,includeBlockProps:e.includeBlockProps,isInteractive:e.isInteractive,contextValue:e.context}),children:[(i=e.blockChildren)==null?void 0:i.map(r=>a.jsx(M,{block:r,context:e.context,registeredComponents:e.registeredComponents},"block-"+r.id)),(o=e.blockChildren)==null?void 0:o.map(r=>a.jsx(G,{block:r,context:e.context},"block-style-"+r.id))]})}):null})}function qe(e){const[t,n]=m.useState(()=>e.repeatContext);return a.jsx(q.Provider,{value:t,children:a.jsx(M,{block:e.block,context:t,registeredComponents:e.registeredComponents})})}function M(e){var f,b,v,R;function t(){return Ve({block:e.block,context:e.context,registeredComponents:e.registeredComponents})}function n(){return $e({block:e.block,context:e.context})}function i(){var S;return(S=e.block.repeat)!=null&&S.collection?e.block:$({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0})}function o(){return e.block.tagName||"div"}function r(){var w,T;if((w=e.block.repeat)!=null&&w.collection)return!!((T=n==null?void 0:n())!=null&&T.length);const S="hide"in i()?i().hide:!1;return("show"in i()?i().show:!0)&&!S}function c(){var k,w;return!((k=t==null?void 0:t())!=null&&k.component)&&!n()?(w=i().children)!=null?w:[]:[]}function l(){var S,k,w,T,I,p;return{blockChildren:(S=i().children)!=null?S:[],componentRef:(k=t==null?void 0:t())==null?void 0:k.component,componentOptions:{...Ee(i()),builderContext:e.context,...((w=t==null?void 0:t())==null?void 0:w.name)==="Symbol"||((T=t==null?void 0:t())==null?void 0:T.name)==="Columns"?{builderComponents:e.registeredComponents}:{}},context:s,registeredComponents:e.registeredComponents,builderBlock:i(),includeBlockProps:((I=t==null?void 0:t())==null?void 0:I.noWrap)===!0,isInteractive:!((p=t==null?void 0:t())!=null&&p.isRSC)}}const[s,u]=m.useState(()=>e.context);return a.jsx(a.Fragment,{children:r()?a.jsx(a.Fragment,{children:(f=t==null?void 0:t())!=null&&f.noWrap?a.jsx(a.Fragment,{children:a.jsx(ie,{componentRef:l().componentRef,componentOptions:l().componentOptions,blockChildren:l().blockChildren,context:l().context,registeredComponents:l().registeredComponents,builderBlock:l().builderBlock,includeBlockProps:l().includeBlockProps,isInteractive:l().isInteractive})}):a.jsxs(a.Fragment,{children:[O(o())?a.jsx(a.Fragment,{children:a.jsx(ne,{Wrapper:o(),block:i(),context:e.context,hasChildren:!1})}):null,!O(o())&&n()?a.jsx(a.Fragment,{children:(b=n())==null?void 0:b.map((S,k)=>a.jsx(qe,{repeatContext:S.context,block:S.block,registeredComponents:e.registeredComponents},k))}):null,!O(o())&&!n()?a.jsx(a.Fragment,{children:a.jsxs(ne,{Wrapper:o(),block:i(),context:e.context,hasChildren:!0,children:[a.jsx(ie,{componentRef:l().componentRef,componentOptions:l().componentOptions,blockChildren:l().blockChildren,context:l().context,registeredComponents:l().registeredComponents,builderBlock:l().builderBlock,includeBlockProps:l().includeBlockProps,isInteractive:l().isInteractive}),(v=c())==null?void 0:v.map(S=>a.jsx(M,{block:S,context:s,registeredComponents:e.registeredComponents},"block-"+S.id)),(R=c())==null?void 0:R.map(S=>a.jsx(G,{block:S,context:s},"block-style-"+S.id))]})}):null]})}):null})}function Ge(e){function t(){var o;return"builder-blocks"+((o=e.blocks)!=null&&o.length?"":" no-blocks")}function n(){var o,r;d.isEditing()&&!((o=e.blocks)!=null&&o.length)&&((r=window.parent)==null||r.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function i(){var o,r;d.isEditing()&&!((o=e.blocks)!=null&&o.length)&&((r=window.parent)==null||r.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return a.jsxs(a.Fragment,{children:[a.jsx(e.BlocksWrapper,{className:t()+" props-blocks-wrapper-4f2c12d8","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:o=>n(),onMouseEnter:o=>i(),onKeyPress:o=>n(),...e.BlocksWrapperProps,children:e.children}),a.jsx("style",{children:`.props-blocks-wrapper-4f2c12d8 {
|
|
11
11
|
display: flex;
|
|
12
12
|
flex-direction: column;
|
|
13
13
|
align-items: stretch;
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"${t}",${JSON.stringify(e)}, ${Ce}
|
|
157
157
|
)`,yt=({contentId:e,variationId:t})=>`window.${ke}(
|
|
158
158
|
"${t}", "${e}", ${Ce}
|
|
159
|
-
)`;function z(e){return a.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},id:e.id||""})}function re(e){return Math.round(e*1e3)/1e3}const pt=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let i=n?e:e.parentElement;do{if(!i)return null;if(t(i))return i}while(i=i.parentElement);return null},vt=e=>pt(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),ce=({event:e,target:t})=>{const n=t.getBoundingClientRect(),i=e.clientX-n.left,o=e.clientY-n.top,r=re(i/n.width),c=re(o/n.height);return{x:r,y:c}},kt=e=>{const t=e.target,n=t&&vt(t),i=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:i||void 0,metadata:{targetOffset:t?ce({event:e,target:t}):void 0,builderTargetOffset:n?ce({event:e,target:n}):void 0,builderElementIndex:n&&i?[].slice.call(document.getElementsByClassName(i)).indexOf(n):void 0}}},Ct="0.11.
|
|
159
|
+
)`;function z(e){return a.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},id:e.id||""})}function re(e){return Math.round(e*1e3)/1e3}const pt=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let i=n?e:e.parentElement;do{if(!i)return null;if(t(i))return i}while(i=i.parentElement);return null},vt=e=>pt(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),ce=({event:e,target:t})=>{const n=t.getBoundingClientRect(),i=e.clientX-n.left,o=e.clientY-n.top,r=re(i/n.width),c=re(o/n.height);return{x:r,y:c}},kt=e=>{const t=e.target,n=t&&vt(t),i=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:i||void 0,metadata:{targetOffset:t?ce({event:e,target:t}):void 0,builderTargetOffset:n?ce({event:e,target:n}):void 0,builderElementIndex:n&&i?[].slice.call(document.getElementsByClassName(i)).indexOf(n):void 0}}},Ct="0.11.2",wt=()=>{d.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 le=!1;const It=(e={})=>{var t,n;le||(le=!0,d.isBrowser()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:d.TARGET,version:Ct,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",({data:i})=>{var o,r;if(i!=null&&i.type)switch(i.type){case"builder.evaluate":{const c=i.data.text,l=i.data.arguments||[],s=i.data.id,u=new Function(c);let f,b=null;try{f=u.apply(null,l)}catch(v){b=v}b?(o=window.parent)==null||o.postMessage({type:"builder.evaluateError",data:{id:s,error:b.message}},"*"):f&&typeof f.then=="function"?f.then(v=>{var R;(R=window.parent)==null||R.postMessage({type:"builder.evaluateResult",data:{id:s,result:v}},"*")}).catch(console.error):(r=window.parent)==null||r.postMessage({type:"builder.evaluateResult",data:{result:f,id:s}},"*");break}}})))};function Et(e){var B,F,D,Q,J,X,Z;const t=m.useRef(null),[n,i]=m.useState(()=>0);function o(g){var x,y,C,E,A;const h={...e.builderContextSignal.content,...g,data:{...(x=e.builderContextSignal.content)==null?void 0:x.data,...g==null?void 0:g.data},meta:{...(y=e.builderContextSignal.content)==null?void 0:y.meta,...g==null?void 0:g.meta,breakpoints:((C=g==null?void 0:g.meta)==null?void 0:C.breakpoints)||((A=(E=e.builderContextSignal.content)==null?void 0:E.meta)==null?void 0:A.breakpoints)}};e.setBuilderContextSignal(Ie=>({...Ie,content:h}))}m.useState(()=>0);const[r,c]=m.useState(()=>!1),[l,s]=m.useState(()=>e.contentWrapper||"div");function u(g){var x;const{data:h}=g;if(h)switch(h.type){case"builder.configureSdk":{const y=h.data,{breakpoints:C,contentId:E}=y;if(!E||E!==((x=e.builderContextSignal.content)==null?void 0:x.id))return;C&&o({meta:{breakpoints:C}}),i(n+1);break}case"builder.contentUpdate":{const y=h.data,C=y.key||y.alias||y.entry||y.modelName,E=y.data;C===e.model&&(o(E),i(n+1));break}}}function f(){var h,x;const g=(x=(h=e.builderContextSignal.content)==null?void 0:h.data)==null?void 0:x.jsCode;g&&W({code:g,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})}const[b,v]=m.useState(()=>({})),[R,S]=m.useState(()=>!1);function k(g){var h,x;if(e.builderContextSignal.content){const y=(h=e.builderContextSignal.content)==null?void 0:h.testVariationId,C=(x=e.builderContextSignal.content)==null?void 0:x.id;d._track({type:"click",canTrack:d.getDefaultCanTrack(e.canTrack),contentId:C,apiKey:e.apiKey,variationId:y!==C?y:void 0,...kt(g),unique:!R})}R||S(!0)}function w(g){return g.replace(/{{([^}]+)}}/g,(h,x)=>W({code:x,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState}))}function T({url:g,key:h}){d.fetch(g).then(x=>x.json()).then(x=>{var C,E;const y={...e.builderContextSignal.rootState,[h]:x};(E=(C=e.builderContextSignal).rootSetState)==null||E.call(C,y),b[h]=!0}).catch(x=>{console.error("error fetching dynamic data",g,x)})}function I(){var h,x,y;const g=(y=(x=(h=e.builderContextSignal.content)==null?void 0:h.data)==null?void 0:x.httpRequests)!=null?y:{};Object.entries(g).forEach(([C,E])=>{if(E&&(!b[C]||d.isEditing())){const A=w(E);T({url:A,key:C})}})}function p(){d.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:d.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function j(g){i(n+1),window.addEventListener("message",u),wt(),It({...e.locale?{locale:e.locale}:{},...e.includeRefs?{includeRefs:e.includeRefs}:{},...e.enrich?{enrich:e.enrich}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(h=>{var y;const x=d.createRegisterComponentMessage(h);(y=window.parent)==null||y.postMessage(x,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",p)}function P(g){const h=new URL(location.href).searchParams,x=h.get("builder.preview"),y=h.get(`builder.preview.${x}`),C=h.get("apiKey")||h.get("builder.space");x===e.model&&C===e.apiKey&&(!e.content||y===e.content.id)&&d.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(E=>{E&&o(E)})}return m.useEffect(()=>{var g;return(g=t.current)==null||g.addEventListener("initeditingbldr",j),()=>{var h;return(h=t.current)==null?void 0:h.removeEventListener("initeditingbldr",j)}},[]),m.useEffect(()=>{var g;return(g=t.current)==null||g.addEventListener("initpreviewingbldr",P),()=>{var h;return(h=t.current)==null?void 0:h.removeEventListener("initpreviewingbldr",P)}},[]),m.useEffect(()=>{var g,h;if(d.isBrowser()){if(d.isEditing()&&t.current&&t.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&d.getDefaultCanTrack(e.canTrack)){const y=(g=e.builderContextSignal.content)==null?void 0:g.testVariationId,C=(h=e.builderContextSignal.content)==null?void 0:h.id,E=e.apiKey;d._track({type:"impression",canTrack:!0,contentId:C,apiKey:E,variationId:y!==C?y:void 0})}d.isPreviewing()&&t.current&&t.current.dispatchEvent(new CustomEvent("initpreviewingbldr"))}},[]),m.useEffect(()=>{e.apiKey||d.logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."),f(),I(),p()},[]),m.useEffect(()=>{e.content&&o(e.content)},[e.content]),m.useEffect(()=>{},[r]),m.useEffect(()=>{f()},[(F=(B=e.builderContextSignal.content)==null?void 0:B.data)==null?void 0:F.jsCode,e.builderContextSignal.rootState]),m.useEffect(()=>{I()},[(Q=(D=e.builderContextSignal.content)==null?void 0:D.data)==null?void 0:Q.httpRequests]),m.useEffect(()=>{p()},[e.builderContextSignal.rootState]),m.useEffect(()=>()=>{d.isBrowser()&&(window.removeEventListener("message",u),window.removeEventListener("builder:component:stateChangeListenerActivated",p))},[]),a.jsx(q.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?a.jsx(a.Fragment,{children:m.createElement(l,{key:n,ref:t,onClick:g=>k(g),"builder-content-id":(J=e.builderContextSignal.content)==null?void 0:J.id,"builder-model":e.model,...e.showContent?{}:{hidden:!0,"aria-hidden":!0},...e.contentWrapperProps,className:`variant-${((X=e.content)==null?void 0:X.testVariationId)||((Z=e.content)==null?void 0:Z.id)}`},e.children)}):null})}const Tt=e=>{var r,c;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],i=(c=e.fileUrl)!=null?c:(r=e==null?void 0:e.files)==null?void 0:r.regular;let o="";if(i&&t&&n&&(o+=`
|
|
160
160
|
@font-face {
|
|
161
161
|
font-family: "${t}";
|
|
162
162
|
src: local("${n}"), url('${i}') format('woff2');
|
package/lib/browser/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as R, Fragment as f, jsx as l } from "react/jsx-runtime";
|
|
3
3
|
import { createContext as Ce, useState as S, useContext as se, createElement as we, useRef as ee, useEffect as W } from "react";
|
|
4
|
-
import { i as
|
|
4
|
+
import { i as V, j as $, k as Ne, l as U, m as te, n as J, T as L, r as Fe, o as D, p as de, a as _e, c as Le, b as Ie, q as je, u as ue, v as me, w as Me } from "./server-entry-f978b3a5.js";
|
|
5
5
|
import { _ as un, h as mn, f as fn, g as hn, e as gn, d as bn, s as xn, t as yn } from "./server-entry-f978b3a5.js";
|
|
6
6
|
function Ue(e) {
|
|
7
7
|
return /* @__PURE__ */ R(f, { children: [
|
|
@@ -66,7 +66,7 @@ const Oe = ({
|
|
|
66
66
|
context: t,
|
|
67
67
|
event: n
|
|
68
68
|
}), Ke = () => ({
|
|
69
|
-
isEditing:
|
|
69
|
+
isEditing: V(),
|
|
70
70
|
isBrowser: $(),
|
|
71
71
|
isServer: !$(),
|
|
72
72
|
getUserAttributes: () => Ne()
|
|
@@ -473,7 +473,7 @@ function lt(e) {
|
|
|
473
473
|
e.Wrapper,
|
|
474
474
|
{
|
|
475
475
|
...e.wrapperProps,
|
|
476
|
-
attributes: {
|
|
476
|
+
attributes: e.includeBlockProps ? {
|
|
477
477
|
...K({
|
|
478
478
|
block: e.block,
|
|
479
479
|
context: e.context
|
|
@@ -485,7 +485,7 @@ function lt(e) {
|
|
|
485
485
|
localState: e.context.localState,
|
|
486
486
|
context: e.context.context
|
|
487
487
|
})
|
|
488
|
-
},
|
|
488
|
+
} : {},
|
|
489
489
|
children: e.children
|
|
490
490
|
}
|
|
491
491
|
);
|
|
@@ -498,23 +498,27 @@ const ct = ({
|
|
|
498
498
|
includeBlockProps: a,
|
|
499
499
|
isInteractive: o,
|
|
500
500
|
contextValue: r
|
|
501
|
-
}) =>
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
501
|
+
}) => {
|
|
502
|
+
const c = {
|
|
503
|
+
...e,
|
|
504
|
+
/**
|
|
505
|
+
* If `noWrap` is set to `true`, then the block's props/attributes are provided to the
|
|
506
|
+
* component itself directly. Otherwise, they are provided to the wrapper element.
|
|
507
|
+
*/
|
|
508
|
+
...a ? {
|
|
509
|
+
attributes: K({
|
|
510
|
+
block: t,
|
|
511
|
+
context: r
|
|
512
|
+
})
|
|
513
|
+
} : {}
|
|
514
|
+
};
|
|
515
|
+
return o ? {
|
|
516
|
+
Wrapper: i,
|
|
517
|
+
block: t,
|
|
518
|
+
context: n,
|
|
519
|
+
wrapperProps: e,
|
|
520
|
+
includeBlockProps: a
|
|
521
|
+
} : c;
|
|
518
522
|
};
|
|
519
523
|
function be(e) {
|
|
520
524
|
var i, a;
|
|
@@ -707,7 +711,7 @@ function dt(e) {
|
|
|
707
711
|
}
|
|
708
712
|
function n() {
|
|
709
713
|
var a, o;
|
|
710
|
-
|
|
714
|
+
V() && !((a = e.blocks) != null && a.length) && ((o = window.parent) == null || o.postMessage(
|
|
711
715
|
{
|
|
712
716
|
type: "builder.clickEmptyBlocks",
|
|
713
717
|
data: {
|
|
@@ -720,7 +724,7 @@ function dt(e) {
|
|
|
720
724
|
}
|
|
721
725
|
function i() {
|
|
722
726
|
var a, o;
|
|
723
|
-
|
|
727
|
+
V() && !((a = e.blocks) != null && a.length) && ((o = window.parent) == null || o.postMessage(
|
|
724
728
|
{
|
|
725
729
|
type: "builder.hoverEmptyBlocks",
|
|
726
730
|
data: {
|
|
@@ -827,17 +831,17 @@ function ut(e) {
|
|
|
827
831
|
};
|
|
828
832
|
}
|
|
829
833
|
function x(I) {
|
|
830
|
-
const p = I === 0 ? 0 : t, B = s(I),
|
|
834
|
+
const p = I === 0 ? 0 : t, B = s(I), A = `${p}px`, N = "100%", F = 0;
|
|
831
835
|
return {
|
|
832
836
|
width: B,
|
|
833
|
-
["marginLeft"]:
|
|
837
|
+
["marginLeft"]: A,
|
|
834
838
|
"--column-width-mobile": u({
|
|
835
839
|
stackedStyle: N,
|
|
836
840
|
desktopStyle: B
|
|
837
841
|
}),
|
|
838
842
|
"--column-margin-left-mobile": u({
|
|
839
843
|
stackedStyle: F,
|
|
840
|
-
desktopStyle:
|
|
844
|
+
desktopStyle: A
|
|
841
845
|
}),
|
|
842
846
|
"--column-width-tablet": d({
|
|
843
847
|
stackedStyle: N,
|
|
@@ -845,14 +849,14 @@ function ut(e) {
|
|
|
845
849
|
}),
|
|
846
850
|
"--column-margin-left-tablet": d({
|
|
847
851
|
stackedStyle: F,
|
|
848
|
-
desktopStyle:
|
|
852
|
+
desktopStyle: A
|
|
849
853
|
})
|
|
850
854
|
};
|
|
851
855
|
}
|
|
852
856
|
function k(I) {
|
|
853
|
-
var B,
|
|
857
|
+
var B, A;
|
|
854
858
|
return Ee(
|
|
855
|
-
((
|
|
859
|
+
((A = (B = e.builderContext.content) == null ? void 0 : B.meta) == null ? void 0 : A.breakpoints) || {}
|
|
856
860
|
)[I].max;
|
|
857
861
|
}
|
|
858
862
|
function w() {
|
|
@@ -1546,7 +1550,7 @@ function Et(e) {
|
|
|
1546
1550
|
src: e.imgSrc || e.image,
|
|
1547
1551
|
...e.attributes
|
|
1548
1552
|
},
|
|
1549
|
-
|
|
1553
|
+
V() && e.imgSrc || "default-key"
|
|
1550
1554
|
);
|
|
1551
1555
|
}
|
|
1552
1556
|
const Pt = {
|
|
@@ -1640,7 +1644,7 @@ const Pt = {
|
|
|
1640
1644
|
textAlign: "center"
|
|
1641
1645
|
}
|
|
1642
1646
|
};
|
|
1643
|
-
function
|
|
1647
|
+
function At(e) {
|
|
1644
1648
|
var t;
|
|
1645
1649
|
return /* @__PURE__ */ l(
|
|
1646
1650
|
"div",
|
|
@@ -1653,7 +1657,7 @@ function Vt(e) {
|
|
|
1653
1657
|
}
|
|
1654
1658
|
);
|
|
1655
1659
|
}
|
|
1656
|
-
const
|
|
1660
|
+
const Vt = {
|
|
1657
1661
|
name: "Video",
|
|
1658
1662
|
canHaveChildren: !0,
|
|
1659
1663
|
defaultStyles: {
|
|
@@ -1864,11 +1868,11 @@ const ye = () => [{
|
|
|
1864
1868
|
component: nn,
|
|
1865
1869
|
...Wt
|
|
1866
1870
|
}, {
|
|
1867
|
-
component:
|
|
1871
|
+
component: At,
|
|
1868
1872
|
...Bt
|
|
1869
1873
|
}, {
|
|
1870
1874
|
component: $t,
|
|
1871
|
-
...
|
|
1875
|
+
...Vt
|
|
1872
1876
|
}], Nt = `function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
1873
1877
|
function getAndSetVariantId() {
|
|
1874
1878
|
function setCookie(name, value, days) {
|
|
@@ -1966,17 +1970,17 @@ const ye = () => [{
|
|
|
1966
1970
|
})), _t = ({
|
|
1967
1971
|
canTrack: e,
|
|
1968
1972
|
content: t
|
|
1969
|
-
}) => !(!(M(t).length > 0) || !e || $()), Lt = (e) => e === "react" || e === "reactNative",
|
|
1973
|
+
}) => !(!(M(t).length > 0) || !e || $()), Lt = (e) => e === "react" || e === "reactNative", Ae = Lt(L), jt = () => `
|
|
1970
1974
|
window.${We} = ${Nt}
|
|
1971
1975
|
window.${Be} = ${Ft}
|
|
1972
1976
|
`, Mt = (e, t) => `
|
|
1973
1977
|
window.${We}(
|
|
1974
|
-
"${t}",${JSON.stringify(e)}, ${
|
|
1978
|
+
"${t}",${JSON.stringify(e)}, ${Ae}
|
|
1975
1979
|
)`, Ut = ({
|
|
1976
1980
|
contentId: e,
|
|
1977
1981
|
variationId: t
|
|
1978
1982
|
}) => `window.${Be}(
|
|
1979
|
-
"${t}", "${e}", ${
|
|
1983
|
+
"${t}", "${e}", ${Ae}
|
|
1980
1984
|
)`;
|
|
1981
1985
|
function Z(e) {
|
|
1982
1986
|
return /* @__PURE__ */ l(
|
|
@@ -2029,7 +2033,7 @@ const Dt = (e, t, n = !0) => {
|
|
|
2029
2033
|
builderElementIndex: n && i ? [].slice.call(document.getElementsByClassName(i)).indexOf(n) : void 0
|
|
2030
2034
|
}
|
|
2031
2035
|
};
|
|
2032
|
-
}, Ht = "0.11.
|
|
2036
|
+
}, Ht = "0.11.2", zt = () => {
|
|
2033
2037
|
Fe("insertMenu", {
|
|
2034
2038
|
name: "_default",
|
|
2035
2039
|
default: !0,
|
|
@@ -2220,7 +2224,7 @@ function Yt(e) {
|
|
|
2220
2224
|
var h, b, y;
|
|
2221
2225
|
const m = (y = (b = (h = e.builderContextSignal.content) == null ? void 0 : h.data) == null ? void 0 : b.httpRequests) != null ? y : {};
|
|
2222
2226
|
Object.entries(m).forEach(([C, T]) => {
|
|
2223
|
-
if (T && (!g[C] ||
|
|
2227
|
+
if (T && (!g[C] || V())) {
|
|
2224
2228
|
const j = w(T);
|
|
2225
2229
|
E({
|
|
2226
2230
|
url: j,
|
|
@@ -2230,7 +2234,7 @@ function Yt(e) {
|
|
|
2230
2234
|
});
|
|
2231
2235
|
}
|
|
2232
2236
|
function p() {
|
|
2233
|
-
|
|
2237
|
+
V() && window.dispatchEvent(
|
|
2234
2238
|
new CustomEvent(
|
|
2235
2239
|
"builder:component:stateChange",
|
|
2236
2240
|
{
|
|
@@ -2266,7 +2270,7 @@ function Yt(e) {
|
|
|
2266
2270
|
p
|
|
2267
2271
|
);
|
|
2268
2272
|
}
|
|
2269
|
-
function
|
|
2273
|
+
function A(m) {
|
|
2270
2274
|
const h = new URL(location.href).searchParams, b = h.get("builder.preview"), y = h.get(
|
|
2271
2275
|
`builder.preview.${b}`
|
|
2272
2276
|
), C = h.get("apiKey") || h.get("builder.space");
|
|
@@ -2294,18 +2298,18 @@ function Yt(e) {
|
|
|
2294
2298
|
var m;
|
|
2295
2299
|
return (m = t.current) == null || m.addEventListener(
|
|
2296
2300
|
"initpreviewingbldr",
|
|
2297
|
-
|
|
2301
|
+
A
|
|
2298
2302
|
), () => {
|
|
2299
2303
|
var h;
|
|
2300
2304
|
return (h = t.current) == null ? void 0 : h.removeEventListener(
|
|
2301
2305
|
"initpreviewingbldr",
|
|
2302
|
-
|
|
2306
|
+
A
|
|
2303
2307
|
);
|
|
2304
2308
|
};
|
|
2305
2309
|
}, []), W(() => {
|
|
2306
2310
|
var m, h;
|
|
2307
2311
|
if ($()) {
|
|
2308
|
-
if (
|
|
2312
|
+
if (V() && t.current && t.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && D(e.canTrack)) {
|
|
2309
2313
|
const y = (m = e.builderContextSignal.content) == null ? void 0 : m.testVariationId, C = (h = e.builderContextSignal.content) == null ? void 0 : h.id, T = e.apiKey;
|
|
2310
2314
|
de({
|
|
2311
2315
|
type: "impression",
|
|
@@ -2566,7 +2570,7 @@ function ke(e) {
|
|
|
2566
2570
|
}
|
|
2567
2571
|
);
|
|
2568
2572
|
}
|
|
2569
|
-
function
|
|
2573
|
+
function Ve(e) {
|
|
2570
2574
|
var r, c;
|
|
2571
2575
|
const [t, n] = S(
|
|
2572
2576
|
() => _t({
|
|
@@ -2703,7 +2707,7 @@ function nn(e) {
|
|
|
2703
2707
|
}, []), W(() => {
|
|
2704
2708
|
a();
|
|
2705
2709
|
}, [e.symbol]), /* @__PURE__ */ l("div", { ...e.attributes, className: t(), children: /* @__PURE__ */ l(
|
|
2706
|
-
|
|
2710
|
+
Ve,
|
|
2707
2711
|
{
|
|
2708
2712
|
__isNestedRender: !0,
|
|
2709
2713
|
apiVersion: e.builderContext.apiVersion,
|
|
@@ -2720,19 +2724,19 @@ function nn(e) {
|
|
|
2720
2724
|
}
|
|
2721
2725
|
) });
|
|
2722
2726
|
}
|
|
2723
|
-
const ln = ae, cn =
|
|
2727
|
+
const ln = ae, cn = Ve;
|
|
2724
2728
|
export {
|
|
2725
2729
|
ae as Blocks,
|
|
2726
2730
|
Ue as Button,
|
|
2727
2731
|
ut as Columns,
|
|
2728
|
-
|
|
2732
|
+
Ve as Content,
|
|
2729
2733
|
mt as Fragment,
|
|
2730
2734
|
gt as Image,
|
|
2731
2735
|
ln as RenderBlocks,
|
|
2732
2736
|
cn as RenderContent,
|
|
2733
2737
|
bt as Section,
|
|
2734
2738
|
nn as Symbol,
|
|
2735
|
-
|
|
2739
|
+
At as Text,
|
|
2736
2740
|
$t as Video,
|
|
2737
2741
|
un as _processContentResult,
|
|
2738
2742
|
Le as createRegisterComponentMessage,
|
|
@@ -2742,7 +2746,7 @@ export {
|
|
|
2742
2746
|
hn as getAllContent,
|
|
2743
2747
|
gn as getBuilderSearchParams,
|
|
2744
2748
|
bn as getContent,
|
|
2745
|
-
|
|
2749
|
+
V as isEditing,
|
|
2746
2750
|
_e as isPreviewing,
|
|
2747
2751
|
Fe as register,
|
|
2748
2752
|
xn as setEditorSettings,
|