@sitecore-feaas/clientside 0.6.3-alpha.13 → 0.6.3-alpha.14
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/build/ui/react.js +2 -0
- package/build/ui/react.js.map +1 -1
- package/dist/browser/react.cjs +1 -1
- package/dist/browser/react.cjs.map +2 -2
- package/dist/browser/react.esm.js +1 -1
- package/dist/browser/react.esm.js.map +1 -1
- package/dist/node/react.cjs +1 -1
- package/dist/node/react.cjs.map +2 -2
- package/dist/node/react.esm.js +1 -1
- package/dist/node/react.esm.js.map +2 -2
- package/package.json +1 -1
- package/react.cjs +1 -1
- package/react.cjs.map +2 -2
- package/react.js +1 -1
- package/react.js.map +2 -2
- package/src/ui/react.tsx +2 -0
- package/types/ui/react.d.ts.map +1 -1
|
@@ -74,5 +74,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
74
74
|
`;let u=s.contentWindow.document.createElement("style");u.textContent=`
|
|
75
75
|
body, html { padding: 0; margin: 0; overflow: hidden }
|
|
76
76
|
`,s.contentWindow.document.head.appendChild(d),s.contentWindow.document.head.appendChild(u);let h=Qt({template:r,data:n},null,!1);h.classList.add(...t,"-feaas--preview","-emulate--"+e.details.slug),s.contentWindow.document.body.appendChild(h)})}async function Ie(t,e,r){let n=e?e.getThumbnailURL():t.getThumbnailURL(),i=new Date(Math.max(Number(t.modifiedAt),Number(t.library.stylesheet.modifiedAt)));try{await t.sdk.uploadBlob("thumbnails",n.split(/\/thumbnails\//)[1],r,{headers:{"x-ms-blob-content-type":"image/jpg","x-ms-blob-cache-control":"public,max-age=31536000,immutable","x-ms-meta-versionId":e?e.id:null,"x-ms-meta-versionRevision":e?e.revision.toString():null,"x-ms-meta-componentId":t.id,"x-ms-meta-componentRenderedAt":i.toUTCString(),"x-ms-meta-componentModifiedAt":t.modifiedAt.toUTCString(),"x-ms-meta-componentCreatedAt":t.createdAt.toUTCString(),"x-ms-meta-modifiedAt":t.modifiedAt.toUTCString()}}),fetch(n,{cache:"no-cache"}).then(()=>{t.sdk.log("FEAAS: Thumbnail uploaded",n)})}catch(o){t.sdk.log("FEAAS: Thumbnail failed to upload",n,o)}return n}import{registerDatasource as Rr,registerComponent as _r,getComponent as Fr,customizeDataSettings as Or}from"@sitecore/byoc";var te;typeof window!="undefined"&&(window.FEAASReactElement=nt,(te=window.FEAASLoading)!==null&&te!==void 0||(window.FEAASLoading=Promise.resolve()));function Be(t){let e=[];if(t){let r=t.ownerDocument.defaultView,n,i;for(;r!==window.top;){n=r.parent;for(let o=0;o<n.frames.length;o++)if(n.frames[o]===r){for(let s of n.document.getElementsByTagName("iframe"))if(s.contentWindow===r){i=s.getBoundingClientRect();let a=s.contentWindow.getComputedStyle(s);e.push({left:i.left+parseInt(a.borderLeftWidth),top:i.top+parseInt(a.borderTopWidth)})}r=n;break}}}return e.reduce((r,n)=>({left:r.left+n.left,top:r.top+n.top}),{left:0,top:0})}function Ue(t){var e;return{context:HTMLElement,frontend:t==null?void 0:t.getContextAttribute("frontend"),src:(e=t==null?void 0:t.getAttribute("src"))!==null&&e!==void 0?e:"/editor.js",library:t==null?void 0:t.getAttribute("library"),component:t==null?void 0:t.getAttribute("component"),version:t==null?void 0:t.getAttribute("version"),instance:t==null?void 0:t.getAttribute("instance"),forked:t==null?void 0:t.getAttribute("forked"),revision:(t==null?void 0:t.getAttribute("revision"))||"saved",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,for:t==null?void 0:t.getAttribute("for"),state:(t==null?void 0:t.getAttribute("state"))||"idle",changed:(t==null?void 0:t.getAttribute("changed"))!=null}}var xt=class extends E{constructor(){super(...arguments),this.framePoint={top:0,left:0},this.wrapperRect={top:0,left:0,width:0,height:0},this.bodyRect={top:0,left:0,width:0,height:0},this.defaultProps={hidden:!1},this.setTarget=(e,r={component:e.getAttribute("component"),version:e.getAttribute("version"),revision:e.getAttribute("revision"),instance:e.getAttribute("instance")})=>{if(!this.closing&&(!this.target||e==null))return this.set(r),this.target=e,!0},this.onChromeMeasureElement=(e,r=e.getBoundingClientRect())=>e.ownerDocument==document?{left:r.left-this.bodyRect.left,top:r.top-this.bodyRect.top,width:r.width,height:r.height}:{left:r.left+this.framePoint.left-this.bodyRect.left,top:r.top+this.framePoint.top-this.bodyRect.top,width:r.width,height:r.height},this.onBeforeMeasure=e=>{e.memoized.focusable&&(this.framePoint=Be(e.memoized.focusable)),this.chrome&&(this.wrapperRect=this.chrome.positionable.getBoundingClientRect(),this.bodyRect=this.chrome.positionable.ownerDocument.body.parentElement.getBoundingClientRect())},this.onMeasure=()=>{},this.onPosition=({focusable:e,root:r})=>{!this.chrome||this.props.hidden||(e?(this.chrome.wrapper.style.width=e.width+16*2+"px",this.chrome.wrapper.style.height=e.height+16*1+64+"px",this.chrome.wrapper.style.left=e.left-16+"px",this.chrome.wrapper.style.top=e.top-64+"px",this.chrome.wrapper.style.opacity="1",this.chrome.absolute=this.querySelector(".ui.overlays"),this.chrome.absolute&&(this.chrome.absolute.style.left=r.left+"px",this.chrome.absolute.style.top=r.top+"px")):(this.chrome.wrapper.style.opacity="0",this.chrome.wrapper.style.left="-1000px",this.chrome.wrapper.style.top="-1000px"))},this.onWindowMessage=e=>{var r;switch((r=e.data)===null||r===void 0?void 0:r.type){case"feaasEdit":let n=this.getPlaceholder();this.setTarget(n.editable,e.data)&&(this.loader=n.loader,document.body.appendChild(n.clipper),this.editedUID=e.data.id,this.setPlaceholder(),this.open());break;case"feaasMeasurements":this.measurements=e.data.measurements,this.props.hidden||this.setPlaceholder();break}},this.onContentChange=()=>{this.setAttribute("changed","changed"),requestAnimationFrame(()=>{this.setIframeComponentContent()})},this.onClose=()=>{var e;this.setAttribute("hidden","hidden"),this.placeholder&&(this.placeholder.positionable.style.opacity="0",this.placeholder.positionable.style.pointerEvents="none"),this.chrome&&(this.chrome.wrapper.style.opacity="0"),!((e=this.target)===null||e===void 0)&&e.parentNode&&(this.target.outerHTML=this.target.outerHTML),this.setTarget(null,{component:null,version:null,instance:null,revision:null}),this.setEditorContext({isFocused:!1})},this.onVersionStateChange=(e,r)=>{this.versionContext=e,this.setVersionContext=r},this.onEditorStateChange=(e,r)=>{this.editorContext=e,this.setEditorContext=r,e.editor&&this.props.state=="loading"&&!this.props.hidden&&(this.setAttribute("state","ready"),this.ownerDocument.fonts.ready.then(()=>setTimeout(()=>{this.setReadyState(),this.setIframeComponentContent()},100)))}}getProps(){return Ue(this)}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}showLoader(){this.loader||(this.loader=document.createElement("feaas-loader"),this.loader.setAttribute("opacity","0.6"),this.loader.style.zIndex="1000",this.target.appendChild(this.loader),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative"))}hideLoader(){this.loader&&(this.loader.setAttribute("hidden","hidden"),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative",this.target.style.position=""))}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this.onWindowMessage)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.onWindowMessage)}setIframe(e){this.iframe=e}setIframeComponentContent(){this.placeholder&&this.iframe&&this.placeholder.editable.innerHTML&&this.iframe.contentWindow.postMessage({type:"feaasUpdate",id:this.editedUID,content:this.placeholder.editable.innerHTML})}setPlaceholder(){if(!this.iframe)return;let e=this.iframe.clientWidth,r=this.iframe.clientHeight,n=this.iframe.getBoundingClientRect(),i=this.getPlaceholder(),o=document.body.getBoundingClientRect(),s=this.measurements[this.editedUID];s&&(Object.assign(i.clipper.style,{position:"absolute",top:n.top+this.iframe.clientTop-o.top+"px",left:n.left+this.iframe.clientLeft-o.left+"px",width:e+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(i.positionable.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(i.loader.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",height:s.height+"px",filter:"opacity(0.6)",zIndex:3,pointerEvents:"none"}),document.dispatchEvent(new Event("feaasRefresh",{bubbles:!0})))}getPlaceholder(){return this.placeholder?this.placeholder:(this.placeholder={clipper:document.createElement("div"),positionable:document.createElement("div"),editable:Object.assign(document.createElement("div"),{className:"-feaas"}),loader:document.createElement("feaas-loader")},this.placeholder.clipper.appendChild(this.placeholder.positionable),this.placeholder.positionable.appendChild(this.placeholder.editable),this.placeholder.clipper.appendChild(this.placeholder.loader),this.placeholder)}attributeChangedCallback(e,r,n){r!==n&&(e=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),n?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(e,r,n))}open(){clearTimeout(this.closing),this.removeAttribute("hidden"),this.removeAttribute("changed"),this.setLoadingState()}shouldFork(e){return e.forkOriginId==null&&this.props.instance!=null}cleanup(){var e;this.placeholder&&((e=this.placeholder.clipper)===null||e===void 0||e.remove(),this.placeholder=null)}close(){console.log("Editor is not ready")}unfork(){console.log("Editor is not ready")}discard(){console.log("Editor is not ready")}save(){console.log("Editor is not ready")}setVersionContext(e){console.log("Editor is not ready")}setEditorContext(e){console.log("Editor is not ready")}setLoadingState(){this.showLoader(),this.setAttribute("state","loading")}setReadyState(){this.hideLoader(),this.setEditorContext({activeVersionId:this.component.versions[0].id}),this.setAttribute("state","ready")}render({children:e,component:r,version:n,instance:i},{Editor:o,VersionStatusList:s,VersionStatusButton:a,Version:l,VersionMenu:c,EditorUIUndo:d,EditorUIMode:u,React:{useEffect:h,useMemo:p,useState:f,useContext:m},Chakra:{HStack:g,Box:b,Button:D,MenuItem:L},Chrome:tt,ReactDOM:St,useSDK:k,useLibrary:B,useSlots:S,useModelObserver:ot,ConfirmationContext:V,VersionContext:A}){if(!this.payload)return;let{React:y}=this.payload,Rt=k(),st=B(),[C,$]=f(),{setConfirm:U}=m(V),at=i||n;C&&(this.component=C),h(()=>{if(this.props.hidden)return;let R=st.components.getItem(r).clone();return R.versions.search({ids:[n,i].filter(Boolean),componentIds:[r]}).then(J=>{R.versions.setItems(J);let P=R.findVersion(i,["staged","published"]),ct=R.findVersion(n,["staged","published"]);if(P)P.deletedAt?(P.getDraft().changeAndNotify(ct.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",P.id));else if(this.removeAttribute("forked"),this.shouldFork(ct)){console.error("FEAAS Editor: Forking");let It=ct.fork(i).id;this.setAttribute("instance",It)}else console.error("FEAAS Editor: Regular");$(R)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),$(null)},400)}},[n,this.props.hidden]);let ne=ot(C==null?void 0:C.versions,[]).filter(R=>R.id==at),lt=ne[0];lt&&!this.props.hidden&&(this.version=lt),h(()=>(this.unfork=()=>{U({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let R=C.findVersion(n,["staged","published"]);C.findVersion(i).unstage().unpublish().changeAndNotify(R.toProperties()),C.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(C.findVersion(at).revert(),C.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{U({title:"Component has unsaved changes",button:"Discard",body:"Are you sure to close editor and discard changes?",bypass:!this.props.changed,action:()=>{this.discard(),requestAnimationFrame(this.onClose)}})},this.save=()=>{U({bypass:!!this.props.forked,title:"Customizing component",button:"Save",body:"Changes to the component will only be visible on that page. Changes to component done in Component Builder will not be reflected here. It will be possible to revert the customization.",action:()=>{var R,J;(J=(R=C.findVersion(at).commitData({view:this.editorContext.editor.getData({rootName:at}),model:""}))===null||R===void 0?void 0:R.stage())===null||J===void 0||J.publish(),this.removeAttribute("changed"),this.setAttribute("forked",at),C.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[C]);let Ke=p(()=>this.target,[C]);return p(()=>C&&S(e,({picker:R,children:J})=>y.createElement(b,{ref:P=>{this.chrome=P?{positionable:P,wrapper:P.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},y.createElement(b,{className:"editor-wrapper",position:"absolute",left:0,top:0},y.createElement(o,{datasources:Rt.datasources,sdk:Rt,library:st,component:C,versions:ne,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:J,chrome:({editor:P})=>P&&y.createElement(tt,null),children:({isArchivedDisplayed:P,editor:ct,status:It})=>y.createElement(b,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},y.createElement(b,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),y.createElement(b,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),y.createElement(b,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),y.createElement(b,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),lt&&y.createElement(l,{version:lt,node:Ke,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:y.createElement(g,{justifyContent:"space-between"},y.createElement(d,{size:"sm",editor:It=="ready"?ct:null}),y.createElement(u,{size:"sm"})),middle:(Mr,Lr)=>[!1],right:y.createElement(y.Fragment,null,y.createElement(D,{variant:"secondary",size:"sm",onClick:this.close},"Close"),y.createElement(D,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),y.createElement(c,{isDisabled:!this.props.forked&&!this.props.changed},y.createElement(L,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),y.createElement(L,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[lt,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};xt.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];xt.register("feaas-editor");function We(t){var e,r;return{part:(t==null?void 0:t.getAttribute("part"))||"picker",slot:(t==null?void 0:t.getAttribute("part"))||"picker",mode:t==null?void 0:t.getAttribute("mode"),dialog:t==null?void 0:t.getAttribute("dialog"),placeholder:(t==null?void 0:t.getAttribute("placeholder"))||"No theme",frontend:(e=t==null?void 0:t.getContextAttribute("frontend"))!==null&&e!==void 0?e:"https://components.sitecorecloud.io",src:(r=t==null?void 0:t.getAttribute("src"))!==null&&r!==void 0?r:"/picker.js",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,variant:t==null?void 0:t.getAttribute("variant"),context:void 0,onClose:void 0,setAttribute:void 0,getAttribute:void 0}}var wt=class extends E{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return We(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){this.setAttribute("feaas-role","ui"),super.connectedCallback()}render({placeholder:e,context:r,mode:n,dialog:i,children:o,variant:s},{Picker:a,React:l,useContext:c,EnvironmentContext:d,useLibrary:u,useSDK:h,BYOC:p}){var f,m,g;let[b,D]=l.useReducer(C=>C+1,0),L=h(),tt=c(d),St=u("collections"),k=u("components"),B=h("datasources"),S=u(),ot=((m=(f=S==null?void 0:S.stylesheets)===null||f===void 0?void 0:f.first)===null||m===void 0?void 0:m.rules)||((g=S==null?void 0:S.stylesheet)===null||g===void 0?void 0:g.styles),V=h("renderingHost.expandedComponents");var A=r==null?void 0:r.getAttribute("data");if(A)try{A=JSON.parse(A)}catch(C){}if(r)var y=L.ExternalComponent.getDefinition(r),Rt=y&&!y.getConfiguration(r),st=(y==null?void 0:y.type)=="feaas"?k.find(C=>C.id==r.getAttribute("component")):p==null?void 0:p.getComponent(String(r.getAttribute("data-external-id")));return l.createElement(a,{cdn:tt.cdn,rules:ot,collections:St,themeContext:r,placeholder:e,embed:st,externalComponents:V,datasources:B,data:A,versionId:r==null?void 0:r.getAttribute("version"),mode:n||(Rt?"library":st?"context":null),setAttribute:(C,$,U)=>{$=="data"&&U&&(U=JSON.stringify(U)),this.props.setAttribute(C,$,U),D()},getAttribute:(C,$)=>r==null?void 0:r.getAttribute($),dialog:i,context:r,variant:s,onModeChange:(C,$)=>{this.set({mode:C,dialog:$})}},o)}};wt.observedAttributes=["library","mode","frontend","src","hidden","variant","dialog"];wt.register("feaas-picker");function He(t){var e,r,n,i,o;return{library:t==null?void 0:t.getAttribute("library"),src:(e=t==null?void 0:t.getAttribute("src"))!==null&&e!==void 0?e:"/context.js",environment:(r=t==null?void 0:t.getAttribute("environment"))!==null&&r!==void 0?r:void 0,frontend:(n=t==null?void 0:t.getAttribute("frontend"))!==null&&n!==void 0?n:"https://components.sitecorecloud.io",backend:(i=t==null?void 0:t.getAttribute("backend"))!==null&&i!==void 0?i:"https://components.sitecorecloud.io/api",cdn:(o=t==null?void 0:t.getAttribute("cdn"))!==null&&o!==void 0?o:"https://feaas.blob.core.windows.net",auth:null,isolate:(t==null?void 0:t.getAttribute("isolate"))==null||(t==null?void 0:t.getAttribute("isolate"))=="true"}}var Z=class extends E{constructor(){super(...arguments),this.defaultProps={isolate:!0},this.onStatusChange=(e,r)=>{e=="ready"&&(this.whenSDKReady.resolve(r),this.dispatchEvent(new CustomEvent("feaasReady",{bubbles:!0,composed:!0,detail:r})))},this.whenSDKReady=N(e=>{this.sdk=e})}getProps(){return He(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null}getTheme(e){return e}getRoot(){return this.getAttribute("isolate")==="false"?this:this.shadowRoot||this.attachShadow({mode:"open"})}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}connectedCallback(){this.setAttribute("feaas-role","ui"),Array.from(this.children).forEach(e=>{this.getRoot().appendChild(e)}),document.addEventListener("feaasMount",this),document.addEventListener("feaasUnmount",this),super.connectedCallback()}disconnectedCallback(){document.removeEventListener("feaasMount",this),document.removeEventListener("feaasUnmount",this),super.disconnectedCallback()}getPortalRoot(){return this.getRoot()}render({children:e,library:r},{AppContext:n,Chakra:{Button:i,Tooltip:o},React:s}){let a={containerRef:{current:this.getPortalRoot()}};return o.defaultProps={hasArrow:!0,placement:"top",portalProps:a},s.createElement(n,{environment:this.props.environment,backend:this.props.backend,libraryId:this.props.library,container:this.getRoot(),auth:this.props.auth,getTheme:this.getTheme,onStatusChange:this.onStatusChange,modalProps:{portalProps:a},chakraProps:{resetScope:':where([feaas-role="ui"])',cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},e)}};Z.observedAttributes=["library","component","version","revision","hostname","template"];Z.register("feaas-context");Z.prototype.clientside=ee;import*as O from"@sitecore/byoc";import ze from"react";import Dr from"react-dom";var Ve=O.getMergedComponentProperties;function Nr(t){let e=O.objectKeysToCamelCase(Array.from(t.attributes).reduce((r,{name:n,value:i})=>(n=="data-external-id"&&(n="component-name"),Object.assign(r,{[n]:i})),{}));return Ve(e).merged}var j=class extends E{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom/client")]).then(([e])=>({React:ze,ReactDOM:Dr,ReactDOMClient:e}))}connectedCallback(){this._setAttribute||(this._setAttribute=this.setAttribute,this.setAttribute=function(e,r){let n=this.getAttribute(r);this._setAttribute(e,r),this.attributeChangedCallback(e,n,r)}),super.connectedCallback()}update(){var e;if(!(!(!((e=O.getComponent(this.getComponentName()))===null||e===void 0)&&e.component)&&this.getAttribute("hydrate")=="false"))return super.update()}render(e,{React:r}){var n;let i=(n=O.getComponent(this.getComponentName()))===null||n===void 0?void 0:n.component;return i||console.warn(`FEAASExternal: \`${this.getComponentName()}\` is not registered`),r.createElement(r.Fragment,null,i&&r.createElement(i,{componentName:this.getComponentName(),...e}))}getComponentName(){return this.getAttribute("data-external-id")}getProps(){return Nr(this)}static Preview(e){var r;let n=(e==null?void 0:e.src)||(typeof window!="undefined"?(r=window.location.search.match(/feaasSrc=([^&]+)/))===null||r===void 0?void 0:r[1]:null);return n?ze.createElement(Je,{src:n,...e}):null}static linkComponents(e){return()=>e.map(r=>null)}};j.registered=O.registered;j.registerComponent=O.registerComponent;j.setRegistrationCallback=O.setRegistrationCallback;j.getComponent=O.getComponent;j.register("feaas-external");var{linkComponents:kr}=j;var re={};function vi(t,e){re[t]=e}function Ye(t){return t==null||t===!0?["template","stylesheet","data"]:[].concat(t||[])}var Pr=t=>("src"in t&&(t=z(t.src)),I.createElement("link",{rel:"stylesheet",href:Gt(t)})),Tr=async({data:t,fetch:e,...r})=>{let n=await x.fetch(t||{});e=Ye(e!=null?e:["stylesheet"]);let i={...r};if(("src"in r||"component"in r)&&(r==null?void 0:r.template)==null){let o=await Kt(r);i.template=o.template,i.lastModified=o.lastModified}else(r==null?void 0:r.template)==null&&!e.includes("template")&&e.push("template");return qe({...i,data:t,fetch:e,fetchedData:n})};function qe({data:t,lastModified:e,fetchedData:r,renderNode:n,...i}){console.log("=== FEAASReactComponent",t,i);let o=null,s;"template"in i&&i.template&&(s=Jt(i.template,r||t||{}).map((c,d)=>Ge(c,(u,h)=>{if(n){let f=n==null?void 0:n(u,h);if(f!=null&&"type"in f)return[f.type,f.props];h={...h,...f}}if(re[u.localName])return[re[u.localName],h];if(u.localName=="feaas-external"){let f={};for(var p in h){let m=p=="data-external-id"?"componentName":w.toCamelCase(p);f[m]=h[p]}return[w.Component,f]}},d))),"src"in i&&(i={...X(i.src),...i});let a=Ye(i.fetch),l=a.includes("data")?t:a.includes("template")?r||t:null;return console.log("htmlnode to react",s),I.createElement(I.Fragment,null,"preload"in i&&o===!0&&"src"in i&&I.createElement(I.Fragment,null,I.createElement("link",{rel:"preload",as:"fetch",href:At(i.src),crossOrigin:"anonymous"}),I.createElement("link",{rel:"preload",as:"style",href:Q(i.src),crossOrigin:"anonymous"})),I.createElement("feaas-component",{class:"-feaas",...i,"last-modified":e?String(e):null,fetch:i.fetch==null?i.fetch:[].concat(i.fetch).join(" "),suppressHydrationWarning:!0,template:null,data:typeof l=="string"?l:l?JSON.stringify(l):null},s))}function Ge(t,e,r){var n;if(t.nodeType===3)return t.textContent;let i=Array.from(t.childNodes).map((d,u)=>Ge(d,e,u)),o={};for(let d=0;d<t.attributes.length;d++){let{name:u,value:h}=t.attributes[d];u=="style"?o[u]=String(h||"").trim().split(/\s*;\s*/).reduce((p,f)=>{let[m,g]=f.split(":");return{...p,[w.toCamelCase(m)]:g}},{}):u=="class"?o.className=h:o[u]=h}let s=e==null?void 0:e(t,o),a=(s==null?void 0:s[0])||t.nodeName.toLowerCase();a=="style"&&(o.dangerouslySetInnerHTML={__html:i.join(`
|
|
77
|
-
`)});let l=Object.assign({key:r,suppressHydrationWarning:!0},(s==null?void 0:s[1])||o);console.log("attributes",o),console.log("react attributes",l);let c=((n=s==null?void 0:s[1])===null||n===void 0?void 0:n.children)||i;return I.createElement(a,l,["img","br","input","style"].includes(a)?null:c)}var gi=w.enableNextClientsideComponents,yi=w.setContextProperties,bi=w.Bundle,Ai=w.Component,Ci=w.RegularComponent,Ei=w.NextComponent,Je=qe,xi=Tr,wi=Pr;export{Je as Component,ke as ComponentProps,Z as Context,N as ControlledPromise,M as DEFAULT_CDN_URL,Dt as DOM,Ot as DataPath,_t as DataScope,x as DataSettings,E as Element,j as External,Ai as ExternalComponent,bi as ExternalComponentBundle,Ct as FEAASComponent,ke as FEAASComponentsProps,Z as FEAASContext,He as FEAASContextProps,xt as FEAASEditor,Ue as FEAASEditorProps,E as FEAASElement,Ve as FEAASExternalPropsObject,Et as FEAASLoader,Pe as FEAASLoaderProps,wt as FEAASPicker,We as FEAASPickerProps,qe as FEAASReactComponent,Tr as FEAASReactServerComponent,Pr as FEAASReactStylesheet,$t as FEAASStylesheet,Te as FEAASStylesheetProps,Ge as HTMLNodeToReact,Pt as InvalidResponse,v as JSONPath,Et as Loader,kt as MyComponent,Ei as NextExternalComponent,wt as Picker,Ci as ReactExternalComponent,xi as ServerComponent,wi as Stylesheet,jt as Thumbnail,Se as WebComponent,fe as adjustNumbers,de as autoloadScripts,vt as cleanCollectionBit,br as clearFetchCache,De as createStylesheet,Or as customizeDataSettings,gi as enableNextClientsideComponents,yt as fetchAndRevalidate,it as fetchAndRevalidateComponent,Mt as fetchAndRevalidateStylesheet,Tt as fetchBypassingCache,gt as fetchCache,Kt as fetchComponent,qt as fetchData,bt as fetchToValidateCache,K as fetchWithCacheAwareness,Oe as findStylesheet,Fr as getComponent,Ar as getComponentSource,At as getComponentURL,_e as getFetchCache,Be as getFramePosition,me as getHumanizedLabel,ve as getLastPathBit,pe as getQualifier,Gt as getStylesheetSource,Q as getStylesheetURL,kr as linkComponents,mt as loadScript,Lt as loadStylesheet,Xt as loadStylesheetAllowStale,Ft as normalizeCollectionScope,Ye as normalizeFetchAttribute,ce as observeDOMElement,X as parseComponentSource,ue as parseLimit,he as parseRange,z as parseStylesheetSource,et as queryObject,zt as queryObjectRaw,ft as queryScopes,_r as registerComponent,Rr as registerDatasource,Qt as renderComponent,xr as renderComponentElement,Ne as renderComponentPromise,G as renderDOMContent,F as renderDOMElement,mr as renderHTMLContent,Cr as renderStylesheet,Fe as renderStylesheetPromise,q as serializeCH1RichText,yi as setContextProperties,W as setDOMAttribute,vi as setElementImplementation};
|
|
77
|
+
`)});let l=Object.assign({key:r,suppressHydrationWarning:!0},(s==null?void 0:s[1])||o);console.log(t,t.attributes),console.log("attributes",o),console.log("react attributes",l),console.log("-----------------");let c=((n=s==null?void 0:s[1])===null||n===void 0?void 0:n.children)||i;return I.createElement(a,l,["img","br","input","style"].includes(a)?null:c)}var gi=w.enableNextClientsideComponents,yi=w.setContextProperties,bi=w.Bundle,Ai=w.Component,Ci=w.RegularComponent,Ei=w.NextComponent,Je=qe,xi=Tr,wi=Pr;export{Je as Component,ke as ComponentProps,Z as Context,N as ControlledPromise,M as DEFAULT_CDN_URL,Dt as DOM,Ot as DataPath,_t as DataScope,x as DataSettings,E as Element,j as External,Ai as ExternalComponent,bi as ExternalComponentBundle,Ct as FEAASComponent,ke as FEAASComponentsProps,Z as FEAASContext,He as FEAASContextProps,xt as FEAASEditor,Ue as FEAASEditorProps,E as FEAASElement,Ve as FEAASExternalPropsObject,Et as FEAASLoader,Pe as FEAASLoaderProps,wt as FEAASPicker,We as FEAASPickerProps,qe as FEAASReactComponent,Tr as FEAASReactServerComponent,Pr as FEAASReactStylesheet,$t as FEAASStylesheet,Te as FEAASStylesheetProps,Ge as HTMLNodeToReact,Pt as InvalidResponse,v as JSONPath,Et as Loader,kt as MyComponent,Ei as NextExternalComponent,wt as Picker,Ci as ReactExternalComponent,xi as ServerComponent,wi as Stylesheet,jt as Thumbnail,Se as WebComponent,fe as adjustNumbers,de as autoloadScripts,vt as cleanCollectionBit,br as clearFetchCache,De as createStylesheet,Or as customizeDataSettings,gi as enableNextClientsideComponents,yt as fetchAndRevalidate,it as fetchAndRevalidateComponent,Mt as fetchAndRevalidateStylesheet,Tt as fetchBypassingCache,gt as fetchCache,Kt as fetchComponent,qt as fetchData,bt as fetchToValidateCache,K as fetchWithCacheAwareness,Oe as findStylesheet,Fr as getComponent,Ar as getComponentSource,At as getComponentURL,_e as getFetchCache,Be as getFramePosition,me as getHumanizedLabel,ve as getLastPathBit,pe as getQualifier,Gt as getStylesheetSource,Q as getStylesheetURL,kr as linkComponents,mt as loadScript,Lt as loadStylesheet,Xt as loadStylesheetAllowStale,Ft as normalizeCollectionScope,Ye as normalizeFetchAttribute,ce as observeDOMElement,X as parseComponentSource,ue as parseLimit,he as parseRange,z as parseStylesheetSource,et as queryObject,zt as queryObjectRaw,ft as queryScopes,_r as registerComponent,Rr as registerDatasource,Qt as renderComponent,xr as renderComponentElement,Ne as renderComponentPromise,G as renderDOMContent,F as renderDOMElement,mr as renderHTMLContent,Cr as renderStylesheet,Fe as renderStylesheetPromise,q as serializeCH1RichText,yi as setContextProperties,W as setDOMAttribute,vi as setElementImplementation};
|
|
78
78
|
//# sourceMappingURL=react.esm.js.map
|