@sitecore-feaas/clientside 0.1.14 → 0.1.15
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/dist/browser/index.cjs
CHANGED
|
@@ -64,9 +64,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
64
64
|
style="animation: 1.5s linear 0s infinite normal none running loader-circular-track"
|
|
65
65
|
></circle>
|
|
66
66
|
</svg>
|
|
67
|
-
</div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}};J.observedAttributes=["hidden"];J.register("feaas-loader");function Pt(t=this){var r;return{library:t==null?void 0:t.getContextAttribute("library"),revision:(r=t==null?void 0:t.getAttribute("revision"))!=null?r:"published",cdn:(t==null?void 0:t.getContextAttribute("cdn"))||(t==null?void 0:t.getContextAttribute("hostname"))}}var rt=class extends m{getProps(){return Pt(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return v(this,null,function*(){tt(this.props,this.onLoad)})}render(){this.stylesheet||(this.stylesheet=document.createElement("style"),this.appendChild(this.stylesheet)),this.stylesheet.textContent=this.payload}};rt.register("feaas-stylesheet");function wt(t=this){let r,e=t.getAttribute("data");if(e!=null)try{r=typeof e=="string"?JSON.parse(e):{}}catch(n){}return{data:r!=null?r:{},library:t.getAttribute("library"),component:t.getAttribute("component"),version:t.getAttribute("version"),revision:t.getAttribute("revision"),hostname:t.getAttribute("hostname"),cdn:t.getContextAttribute("cdn"),template:t.getAttribute("template")}}var q=class extends m{setData(e){this.set({data:e})}getProps(){return wt(this)}attributeChangedCallback(e,n,o){this.payload=void 0,this.needsRefresh=!0,super.attributeChangedCallback(e,n,o)}getOriginal(){let e=this.getAttribute("data-path-scope");if(!!e){for(var n=this;(n=n.previousElementSibling)&&n.getAttribute("data-path-scope")==e;)var o=n;return o}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}load(){return v(this,null,function*(){if(!this.getOriginal())try{Z(this.props,this.onLoad)}catch(e){console.error(`FEAAS: Could not fetch component: ${this.props.component}/${this.props.version}/${this.props.revision}`)}})}render(){if(Array.from(this.children).filter(e=>e.tagName!="BR").length>0&&!this.needsRefresh)_(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;U(this,this.payload,this.props.data)}}};q.observedAttributes=["library","component","version","revision","hostname","cdn","template","data"];q.register("feaas-component");function Rt(t){let r=[];if(t){let e=t.ownerDocument.defaultView,n,o;for(;e!==window.top;){n=e.parent;for(let s=0;s<n.frames.length;s++)if(n.frames[s]===e){for(let i of n.document.getElementsByTagName("iframe"))if(i.contentWindow===e){o=i.getBoundingClientRect();let a=i.contentWindow.getComputedStyle(i);r.push({left:o.left+parseInt(a.borderLeftWidth),top:o.top+parseInt(a.borderTopWidth)})}e=n;break}}}return r.reduce((e,n)=>({left:e.left+n.left,top:e.top+n.top}),{left:0,top:0})}function xt(t=this){var r;return{context:HTMLElement,frontend:t==null?void 0:t.getContextAttribute("frontend"),src:(r=t==null?void 0:t.getAttribute("src"))!=null?r:"/assets/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"),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")}}var nt=class extends m{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.getTarget=()=>document.querySelector("iframe").contentWindow.document.getElementById(this.props.for);this.onChromeMeasureElement=(e,n)=>(n==null&&(n=e.getBoundingClientRect()),e.ownerDocument==document?{left:n.left-this.bodyRect.left,top:n.top-this.bodyRect.top,width:n.width,height:n.height}:{left:n.left+this.framePoint.left-this.bodyRect.left,top:n.top+this.framePoint.top-this.bodyRect.top,width:n.width,height:n.height});this.onBeforeMeasure=e=>{e.memoized.focusable&&(this.framePoint=Rt(e.memoized.focusable)),this.wrapperRect=this.wrapper.getBoundingClientRect(),this.bodyRect=this.wrapper.ownerDocument.body.parentElement.getBoundingClientRect()};this.onMeasure=()=>{};this.onPosition=({focusable:e,root:n})=>{let o=this.wrapper.querySelector(".editor-chrome"),s=this.wrapper.querySelector(".ui.overlays");e?(o.style.width=e.width+16*2+"px",o.style.height=e.height+16*1+64+"px",o.style.left=e.left-16+"px",o.style.top=e.top-64+"px",s&&(s.style.left=n.left+"px",s.style.top=n.top+"px")):(o.style.left="-1000px",o.style.top="-1000px")}}getProps(){return xt(this)}load(){return import(this.formatURL(this.props.src,this.props.frontend))}renderReact({children:e,component:n,version:o},{Editor:s,VersionStatusList:i,Version:a,EditorUIUndo:u,EditorUIMode:l,React:{useEffect:c,useMemo:p,useState:h},Chakra:{HStack:y,Box:f},Chrome:x,ReactDOM:K,useSDK:st,useSlots:O,useModelObserver:Y}){if(!this.payload)return;let{sdk:$}=st(),[g,H]=h(),C=$.library;c(()=>H(C.components.getItem(n)),[n,C]),c(()=>{g==null||g.versions.fetch()},[g]);let it=p(this.getTarget,[this.props.for]),T=Y(g==null?void 0:g.versions),b=p(()=>(T==null?void 0:T.filter(w=>w.id==o||!o))||[],[T]);if(!!g)return O(e,({picker:w,children:M})=>React.createElement(f,{ref:E=>this.wrapper=E},React.createElement(f,{className:"editor-wrapper",position:"absolute",left:0,top:0},React.createElement(s,{sdk:$,library:$.library,component:g,versions:b,context:{onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition}},({editor:E,status:k,isArchivedDisplayed:D})=>({after:M,picker:w,chrome:E&&React.createElement(x,null),children:g.reduceVersionRevisions(b).filter(S=>{var R;return D||!((R=S.saved||S.draft)!=null&&R.deletedAt)}).map((S,R)=>React.createElement(f,{key:S.head.id,position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none"},React.createElement(f,{className:"borders",pointerEvents:"none",left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(f,{className:"borders",pointerEvents:"none",right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(f,{className:"borders",pointerEvents:"none",top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(f,{className:"borders",pointerEvents:"none",bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(a,{version:S.head,node:it},{left:React.createElement(y,{justifyContent:"space-between"},React.createElement(u,{size:"sm",editor:k=="ready"?E:null}),React.createElement(l,{size:"sm"})),middle:React.createElement(i,null)})))})))))}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null}};nt.register("feaas-editor");function Ct(t=this){var r,e;return{part:(t==null?void 0:t.getAttribute("part"))||"picker",slot:(t==null?void 0:t.getAttribute("part"))||"slot",mode:t==null?void 0:t.getAttribute("mode"),frontend:(r=t==null?void 0:t.getContextAttribute("frontend"))!=null?r:"https://components.sitecorecloud.io",src:(e=t==null?void 0:t.getAttribute("src"))!=null?e:"/assets/picker.js",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,context:void 0,onClose:void 0}}var ot=class extends m{getProps(){return Ct(this)}load(){return import(this.formatURL(this.props.src,this.props.frontend))}renderReact({context:r,mode:e,children:n},{Picker:o,React:s,ReactDOM:i}){return s.createElement(o,{mode:e||void 0,onClose:this.props.onClose,context:r},n)}};ot.register("feaas-picker");function Tt(t=this){var r,e;return{library:(t==null?void 0:t.getAttribute("library"))||"library",mode:t==null?void 0:t.getAttribute("mode"),frontend:(r=t==null?void 0:t.getContextAttribute("frontend"))!=null?r:"https://components.sitecorecloud.io",src:(e=t==null?void 0:t.getAttribute("src"))!=null?e:"/assets/picker.js",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,context:null,getToken:null}}var V=class extends m{constructor(){super(...arguments);this.payload=null;this.onClose=()=>{this.
|
|
67
|
+
</div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}};J.observedAttributes=["hidden"];J.register("feaas-loader");function Pt(t=this){var r;return{library:t==null?void 0:t.getContextAttribute("library"),revision:(r=t==null?void 0:t.getAttribute("revision"))!=null?r:"published",cdn:(t==null?void 0:t.getContextAttribute("cdn"))||(t==null?void 0:t.getContextAttribute("hostname"))}}var rt=class extends m{getProps(){return Pt(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return v(this,null,function*(){tt(this.props,this.onLoad)})}render(){this.stylesheet||(this.stylesheet=document.createElement("style"),this.appendChild(this.stylesheet)),this.stylesheet.textContent=this.payload}};rt.register("feaas-stylesheet");function wt(t=this){let r,e=t.getAttribute("data");if(e!=null)try{r=typeof e=="string"?JSON.parse(e):{}}catch(n){}return{data:r!=null?r:{},library:t.getAttribute("library"),component:t.getAttribute("component"),version:t.getAttribute("version"),revision:t.getAttribute("revision"),hostname:t.getAttribute("hostname"),cdn:t.getContextAttribute("cdn"),template:t.getAttribute("template")}}var q=class extends m{setData(e){this.set({data:e})}getProps(){return wt(this)}attributeChangedCallback(e,n,o){this.payload=void 0,this.needsRefresh=!0,super.attributeChangedCallback(e,n,o)}getOriginal(){let e=this.getAttribute("data-path-scope");if(!!e){for(var n=this;(n=n.previousElementSibling)&&n.getAttribute("data-path-scope")==e;)var o=n;return o}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}load(){return v(this,null,function*(){if(!this.getOriginal())try{Z(this.props,this.onLoad)}catch(e){console.error(`FEAAS: Could not fetch component: ${this.props.component}/${this.props.version}/${this.props.revision}`)}})}render(){if(Array.from(this.children).filter(e=>e.tagName!="BR").length>0&&!this.needsRefresh)_(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;U(this,this.payload,this.props.data)}}};q.observedAttributes=["library","component","version","revision","hostname","cdn","template","data"];q.register("feaas-component");function Rt(t){let r=[];if(t){let e=t.ownerDocument.defaultView,n,o;for(;e!==window.top;){n=e.parent;for(let s=0;s<n.frames.length;s++)if(n.frames[s]===e){for(let i of n.document.getElementsByTagName("iframe"))if(i.contentWindow===e){o=i.getBoundingClientRect();let a=i.contentWindow.getComputedStyle(i);r.push({left:o.left+parseInt(a.borderLeftWidth),top:o.top+parseInt(a.borderTopWidth)})}e=n;break}}}return r.reduce((e,n)=>({left:e.left+n.left,top:e.top+n.top}),{left:0,top:0})}function xt(t=this){var r;return{context:HTMLElement,frontend:t==null?void 0:t.getContextAttribute("frontend"),src:(r=t==null?void 0:t.getAttribute("src"))!=null?r:"/assets/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"),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")}}var nt=class extends m{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.getTarget=()=>document.querySelector("iframe").contentWindow.document.getElementById(this.props.for);this.onChromeMeasureElement=(e,n)=>(n==null&&(n=e.getBoundingClientRect()),e.ownerDocument==document?{left:n.left-this.bodyRect.left,top:n.top-this.bodyRect.top,width:n.width,height:n.height}:{left:n.left+this.framePoint.left-this.bodyRect.left,top:n.top+this.framePoint.top-this.bodyRect.top,width:n.width,height:n.height});this.onBeforeMeasure=e=>{e.memoized.focusable&&(this.framePoint=Rt(e.memoized.focusable)),this.wrapperRect=this.wrapper.getBoundingClientRect(),this.bodyRect=this.wrapper.ownerDocument.body.parentElement.getBoundingClientRect()};this.onMeasure=()=>{};this.onPosition=({focusable:e,root:n})=>{let o=this.wrapper.querySelector(".editor-chrome"),s=this.wrapper.querySelector(".ui.overlays");e?(o.style.width=e.width+16*2+"px",o.style.height=e.height+16*1+64+"px",o.style.left=e.left-16+"px",o.style.top=e.top-64+"px",s&&(s.style.left=n.left+"px",s.style.top=n.top+"px")):(o.style.left="-1000px",o.style.top="-1000px")}}getProps(){return xt(this)}load(){return import(this.formatURL(this.props.src,this.props.frontend))}renderReact({children:e,component:n,version:o},{Editor:s,VersionStatusList:i,Version:a,EditorUIUndo:u,EditorUIMode:l,React:{useEffect:c,useMemo:p,useState:h},Chakra:{HStack:y,Box:f},Chrome:x,ReactDOM:K,useSDK:st,useSlots:O,useModelObserver:Y}){if(!this.payload)return;let{sdk:$}=st(),[g,H]=h(),C=$.library;c(()=>H(C.components.getItem(n)),[n,C]),c(()=>{g==null||g.versions.fetch()},[g]);let it=p(this.getTarget,[this.props.for]),T=Y(g==null?void 0:g.versions),b=p(()=>(T==null?void 0:T.filter(w=>w.id==o||!o))||[],[T]);if(!!g)return O(e,({picker:w,children:M})=>React.createElement(f,{ref:E=>this.wrapper=E},React.createElement(f,{className:"editor-wrapper",position:"absolute",left:0,top:0},React.createElement(s,{sdk:$,library:$.library,component:g,versions:b,context:{onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition}},({editor:E,status:k,isArchivedDisplayed:D})=>({after:M,picker:w,chrome:E&&React.createElement(x,null),children:g.reduceVersionRevisions(b).filter(S=>{var R;return D||!((R=S.saved||S.draft)!=null&&R.deletedAt)}).map((S,R)=>React.createElement(f,{key:S.head.id,position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none"},React.createElement(f,{className:"borders",pointerEvents:"none",left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(f,{className:"borders",pointerEvents:"none",right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(f,{className:"borders",pointerEvents:"none",top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(f,{className:"borders",pointerEvents:"none",bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(a,{version:S.head,node:it},{left:React.createElement(y,{justifyContent:"space-between"},React.createElement(u,{size:"sm",editor:k=="ready"?E:null}),React.createElement(l,{size:"sm"})),middle:React.createElement(i,null)})))})))))}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null}};nt.register("feaas-editor");function Ct(t=this){var r,e;return{part:(t==null?void 0:t.getAttribute("part"))||"picker",slot:(t==null?void 0:t.getAttribute("part"))||"slot",mode:t==null?void 0:t.getAttribute("mode"),frontend:(r=t==null?void 0:t.getContextAttribute("frontend"))!=null?r:"https://components.sitecorecloud.io",src:(e=t==null?void 0:t.getAttribute("src"))!=null?e:"/assets/picker.js",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,context:void 0,onClose:void 0}}var ot=class extends m{getProps(){return Ct(this)}load(){return import(this.formatURL(this.props.src,this.props.frontend))}renderReact({context:r,mode:e,children:n},{Picker:o,React:s,ReactDOM:i}){return s.createElement(o,{mode:e||void 0,onClose:this.props.onClose,context:r},n)}};ot.register("feaas-picker");function Tt(t=this){var r,e;return{library:(t==null?void 0:t.getAttribute("library"))||"library",mode:t==null?void 0:t.getAttribute("mode"),frontend:(r=t==null?void 0:t.getContextAttribute("frontend"))!=null?r:"https://components.sitecorecloud.io",src:(e=t==null?void 0:t.getAttribute("src"))!=null?e:"/assets/picker.js",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,context:null,getToken:null}}var V=class extends m{constructor(){super(...arguments);this.payload=null;this.onClose=()=>{this.removeAttribute("mode")}}getProps(){return Tt(this)}render(){let{frontend:e,library:n,getToken:o,src:s,mode:i,context:a}=this.props;this.getAttribute("mode")==null?this.setAttribute("hidden","hidden"):this.removeAttribute("hidden"),this.children.length==0&&(this.innerHTML=`
|
|
68
68
|
<feaas-context library='${n}'>
|
|
69
69
|
<feaas-picker mode='${i}'>
|
|
70
70
|
<feaas-loader />
|
|
71
71
|
</feaas-context>
|
|
72
|
-
`),this.refs.context.set({frontend:e,library:n,getToken:o}),this.refs.picker.set({frontend:e,context:a,src:s,mode:i,onClose:this.onClose})}};V.observedAttributes=["library","mode","frontend","src","
|
|
72
|
+
`),this.refs.context.set({frontend:e,library:n,getToken:o}),this.refs.picker.set({frontend:e,context:a,src:s,mode:i,onClose:this.onClose})}};V.observedAttributes=["library","mode","frontend","src","context"];V.register("feaas-picker-lazy");function kt(t=this){var r,e,n,o;return{library:t==null?void 0:t.getAttribute("library"),src:(r=t==null?void 0:t.getAttribute("src"))!=null?r:"/assets/context.js",frontend:(e=t==null?void 0:t.getAttribute("frontend"))!=null?e:"https://components.sitecoreclud.io",backend:(n=t==null?void 0:t.getAttribute("backend"))!=null?n:"https://components-api.sitecoreclud.io",cdn:(o=t==null?void 0:t.getAttribute("cdn"))!=null?o:"https://feaascompontsapiprod.blob.core.windows.net",getToken:null}}var X=class extends m{getProps(){return kt(this)}load(){return import(this.formatURL(this.props.src,this.props.frontend))}getTheme(e){return e}getRoot(){return this.shadowRoot||this.attachShadow({mode:"open"})}getReactRoot(){return this.reactRoot||(this.reactRoot=document.createElement("div"),this.getRoot().appendChild(this.reactRoot)),this.reactRoot}nestedCallback(e){super.nestedCallback(e);let n=e.composedPath()[0];n.parentNode!=this.getRoot()&&this.getRoot().appendChild(n)}renderReact({children:e,library:n},{AppContext:o,Chakra:{Button:s,Tooltip:i},React:a}){let u={containerRef:{current:this.getRoot()}};return i.defaultProps={hasArrow:!0,placement:"top",portalProps:u},a.createElement(o,{libraryId:this.props.library,container:this.getRoot(),getToken:this.props.getToken,getTheme:this.getTheme,modalProps:{portalProps:u},chakraProps:{cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:u}}},e)}};X.observedAttributes=["library","component","version","revision","hostname","template"];X.register("feaas-context");
|
package/dist/browser/index.js
CHANGED
|
@@ -64,9 +64,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
64
64
|
style="animation: 1.5s linear 0s infinite normal none running loader-circular-track"
|
|
65
65
|
></circle>
|
|
66
66
|
</svg>
|
|
67
|
-
</div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}};K.observedAttributes=["hidden"];K.register("feaas-loader");function Wt(t=this){var r;return{library:t==null?void 0:t.getContextAttribute("library"),revision:(r=t==null?void 0:t.getAttribute("revision"))!=null?r:"published",cdn:(t==null?void 0:t.getContextAttribute("cdn"))||(t==null?void 0:t.getContextAttribute("hostname"))}}var st=class extends m{getProps(){return Wt(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return v(this,null,function*(){V(this.props,this.onLoad)})}render(){this.stylesheet||(this.stylesheet=document.createElement("style"),this.appendChild(this.stylesheet)),this.stylesheet.textContent=this.payload}};st.register("feaas-stylesheet");function zt(t=this){let r,e=t.getAttribute("data");if(e!=null)try{r=typeof e=="string"?JSON.parse(e):{}}catch(n){}return{data:r!=null?r:{},library:t.getAttribute("library"),component:t.getAttribute("component"),version:t.getAttribute("version"),revision:t.getAttribute("revision"),hostname:t.getAttribute("hostname"),cdn:t.getContextAttribute("cdn"),template:t.getAttribute("template")}}var Y=class extends m{setData(e){this.set({data:e})}getProps(){return zt(this)}attributeChangedCallback(e,n,o){this.payload=void 0,this.needsRefresh=!0,super.attributeChangedCallback(e,n,o)}getOriginal(){let e=this.getAttribute("data-path-scope");if(!!e){for(var n=this;(n=n.previousElementSibling)&&n.getAttribute("data-path-scope")==e;)var o=n;return o}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}load(){return v(this,null,function*(){if(!this.getOriginal())try{q(this.props,this.onLoad)}catch(e){console.error(`FEAAS: Could not fetch component: ${this.props.component}/${this.props.version}/${this.props.revision}`)}})}render(){if(Array.from(this.children).filter(e=>e.tagName!="BR").length>0&&!this.needsRefresh)B(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;X(this,this.payload,this.props.data)}}};Y.observedAttributes=["library","component","version","revision","hostname","cdn","template","data"];Y.register("feaas-component");function Ut(t){let r=[];if(t){let e=t.ownerDocument.defaultView,n,o;for(;e!==window.top;){n=e.parent;for(let s=0;s<n.frames.length;s++)if(n.frames[s]===e){for(let i of n.document.getElementsByTagName("iframe"))if(i.contentWindow===e){o=i.getBoundingClientRect();let a=i.contentWindow.getComputedStyle(i);r.push({left:o.left+parseInt(a.borderLeftWidth),top:o.top+parseInt(a.borderTopWidth)})}e=n;break}}}return r.reduce((e,n)=>({left:e.left+n.left,top:e.top+n.top}),{left:0,top:0})}function Jt(t=this){var r;return{context:HTMLElement,frontend:t==null?void 0:t.getContextAttribute("frontend"),src:(r=t==null?void 0:t.getAttribute("src"))!=null?r:"/assets/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"),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")}}var it=class extends m{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.getTarget=()=>document.querySelector("iframe").contentWindow.document.getElementById(this.props.for);this.onChromeMeasureElement=(e,n)=>(n==null&&(n=e.getBoundingClientRect()),e.ownerDocument==document?{left:n.left-this.bodyRect.left,top:n.top-this.bodyRect.top,width:n.width,height:n.height}:{left:n.left+this.framePoint.left-this.bodyRect.left,top:n.top+this.framePoint.top-this.bodyRect.top,width:n.width,height:n.height});this.onBeforeMeasure=e=>{e.memoized.focusable&&(this.framePoint=Ut(e.memoized.focusable)),this.wrapperRect=this.wrapper.getBoundingClientRect(),this.bodyRect=this.wrapper.ownerDocument.body.parentElement.getBoundingClientRect()};this.onMeasure=()=>{};this.onPosition=({focusable:e,root:n})=>{let o=this.wrapper.querySelector(".editor-chrome"),s=this.wrapper.querySelector(".ui.overlays");e?(o.style.width=e.width+16*2+"px",o.style.height=e.height+16*1+64+"px",o.style.left=e.left-16+"px",o.style.top=e.top-64+"px",s&&(s.style.left=n.left+"px",s.style.top=n.top+"px")):(o.style.left="-1000px",o.style.top="-1000px")}}getProps(){return Jt(this)}load(){return import(this.formatURL(this.props.src,this.props.frontend))}renderReact({children:e,component:n,version:o},{Editor:s,VersionStatusList:i,Version:a,EditorUIUndo:u,EditorUIMode:l,React:{useEffect:c,useMemo:p,useState:h},Chakra:{HStack:y,Box:f},Chrome:x,ReactDOM:U,useSDK:Z,useSlots:_,useModelObserver:J}){if(!this.payload)return;let{sdk:I}=Z(),[g,O]=h(),C=I.library;c(()=>O(C.components.getItem(n)),[n,C]),c(()=>{g==null||g.versions.fetch()},[g]);let tt=p(this.getTarget,[this.props.for]),T=J(g==null?void 0:g.versions),b=p(()=>(T==null?void 0:T.filter(w=>w.id==o||!o))||[],[T]);if(!!g)return _(e,({picker:w,children:M})=>React.createElement(f,{ref:E=>this.wrapper=E},React.createElement(f,{className:"editor-wrapper",position:"absolute",left:0,top:0},React.createElement(s,{sdk:I,library:I.library,component:g,versions:b,context:{onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition}},({editor:E,status:k,isArchivedDisplayed:D})=>({after:M,picker:w,chrome:E&&React.createElement(x,null),children:g.reduceVersionRevisions(b).filter(S=>{var R;return D||!((R=S.saved||S.draft)!=null&&R.deletedAt)}).map((S,R)=>React.createElement(f,{key:S.head.id,position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none"},React.createElement(f,{className:"borders",pointerEvents:"none",left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(f,{className:"borders",pointerEvents:"none",right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(f,{className:"borders",pointerEvents:"none",top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(f,{className:"borders",pointerEvents:"none",bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(a,{version:S.head,node:tt},{left:React.createElement(y,{justifyContent:"space-between"},React.createElement(u,{size:"sm",editor:k=="ready"?E:null}),React.createElement(l,{size:"sm"})),middle:React.createElement(i,null)})))})))))}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null}};it.register("feaas-editor");function qt(t=this){var r,e;return{part:(t==null?void 0:t.getAttribute("part"))||"picker",slot:(t==null?void 0:t.getAttribute("part"))||"slot",mode:t==null?void 0:t.getAttribute("mode"),frontend:(r=t==null?void 0:t.getContextAttribute("frontend"))!=null?r:"https://components.sitecorecloud.io",src:(e=t==null?void 0:t.getAttribute("src"))!=null?e:"/assets/picker.js",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,context:void 0,onClose:void 0}}var at=class extends m{getProps(){return qt(this)}load(){return import(this.formatURL(this.props.src,this.props.frontend))}renderReact({context:r,mode:e,children:n},{Picker:o,React:s,ReactDOM:i}){return s.createElement(o,{mode:e||void 0,onClose:this.props.onClose,context:r},n)}};at.register("feaas-picker");function Vt(t=this){var r,e;return{library:(t==null?void 0:t.getAttribute("library"))||"library",mode:t==null?void 0:t.getAttribute("mode"),frontend:(r=t==null?void 0:t.getContextAttribute("frontend"))!=null?r:"https://components.sitecorecloud.io",src:(e=t==null?void 0:t.getAttribute("src"))!=null?e:"/assets/picker.js",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,context:null,getToken:null}}var G=class extends m{constructor(){super(...arguments);this.payload=null;this.onClose=()=>{this.
|
|
67
|
+
</div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}};K.observedAttributes=["hidden"];K.register("feaas-loader");function Wt(t=this){var r;return{library:t==null?void 0:t.getContextAttribute("library"),revision:(r=t==null?void 0:t.getAttribute("revision"))!=null?r:"published",cdn:(t==null?void 0:t.getContextAttribute("cdn"))||(t==null?void 0:t.getContextAttribute("hostname"))}}var st=class extends m{getProps(){return Wt(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return v(this,null,function*(){V(this.props,this.onLoad)})}render(){this.stylesheet||(this.stylesheet=document.createElement("style"),this.appendChild(this.stylesheet)),this.stylesheet.textContent=this.payload}};st.register("feaas-stylesheet");function zt(t=this){let r,e=t.getAttribute("data");if(e!=null)try{r=typeof e=="string"?JSON.parse(e):{}}catch(n){}return{data:r!=null?r:{},library:t.getAttribute("library"),component:t.getAttribute("component"),version:t.getAttribute("version"),revision:t.getAttribute("revision"),hostname:t.getAttribute("hostname"),cdn:t.getContextAttribute("cdn"),template:t.getAttribute("template")}}var Y=class extends m{setData(e){this.set({data:e})}getProps(){return zt(this)}attributeChangedCallback(e,n,o){this.payload=void 0,this.needsRefresh=!0,super.attributeChangedCallback(e,n,o)}getOriginal(){let e=this.getAttribute("data-path-scope");if(!!e){for(var n=this;(n=n.previousElementSibling)&&n.getAttribute("data-path-scope")==e;)var o=n;return o}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}load(){return v(this,null,function*(){if(!this.getOriginal())try{q(this.props,this.onLoad)}catch(e){console.error(`FEAAS: Could not fetch component: ${this.props.component}/${this.props.version}/${this.props.revision}`)}})}render(){if(Array.from(this.children).filter(e=>e.tagName!="BR").length>0&&!this.needsRefresh)B(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;X(this,this.payload,this.props.data)}}};Y.observedAttributes=["library","component","version","revision","hostname","cdn","template","data"];Y.register("feaas-component");function Ut(t){let r=[];if(t){let e=t.ownerDocument.defaultView,n,o;for(;e!==window.top;){n=e.parent;for(let s=0;s<n.frames.length;s++)if(n.frames[s]===e){for(let i of n.document.getElementsByTagName("iframe"))if(i.contentWindow===e){o=i.getBoundingClientRect();let a=i.contentWindow.getComputedStyle(i);r.push({left:o.left+parseInt(a.borderLeftWidth),top:o.top+parseInt(a.borderTopWidth)})}e=n;break}}}return r.reduce((e,n)=>({left:e.left+n.left,top:e.top+n.top}),{left:0,top:0})}function Jt(t=this){var r;return{context:HTMLElement,frontend:t==null?void 0:t.getContextAttribute("frontend"),src:(r=t==null?void 0:t.getAttribute("src"))!=null?r:"/assets/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"),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")}}var it=class extends m{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.getTarget=()=>document.querySelector("iframe").contentWindow.document.getElementById(this.props.for);this.onChromeMeasureElement=(e,n)=>(n==null&&(n=e.getBoundingClientRect()),e.ownerDocument==document?{left:n.left-this.bodyRect.left,top:n.top-this.bodyRect.top,width:n.width,height:n.height}:{left:n.left+this.framePoint.left-this.bodyRect.left,top:n.top+this.framePoint.top-this.bodyRect.top,width:n.width,height:n.height});this.onBeforeMeasure=e=>{e.memoized.focusable&&(this.framePoint=Ut(e.memoized.focusable)),this.wrapperRect=this.wrapper.getBoundingClientRect(),this.bodyRect=this.wrapper.ownerDocument.body.parentElement.getBoundingClientRect()};this.onMeasure=()=>{};this.onPosition=({focusable:e,root:n})=>{let o=this.wrapper.querySelector(".editor-chrome"),s=this.wrapper.querySelector(".ui.overlays");e?(o.style.width=e.width+16*2+"px",o.style.height=e.height+16*1+64+"px",o.style.left=e.left-16+"px",o.style.top=e.top-64+"px",s&&(s.style.left=n.left+"px",s.style.top=n.top+"px")):(o.style.left="-1000px",o.style.top="-1000px")}}getProps(){return Jt(this)}load(){return import(this.formatURL(this.props.src,this.props.frontend))}renderReact({children:e,component:n,version:o},{Editor:s,VersionStatusList:i,Version:a,EditorUIUndo:u,EditorUIMode:l,React:{useEffect:c,useMemo:p,useState:h},Chakra:{HStack:y,Box:f},Chrome:x,ReactDOM:U,useSDK:Z,useSlots:_,useModelObserver:J}){if(!this.payload)return;let{sdk:I}=Z(),[g,O]=h(),C=I.library;c(()=>O(C.components.getItem(n)),[n,C]),c(()=>{g==null||g.versions.fetch()},[g]);let tt=p(this.getTarget,[this.props.for]),T=J(g==null?void 0:g.versions),b=p(()=>(T==null?void 0:T.filter(w=>w.id==o||!o))||[],[T]);if(!!g)return _(e,({picker:w,children:M})=>React.createElement(f,{ref:E=>this.wrapper=E},React.createElement(f,{className:"editor-wrapper",position:"absolute",left:0,top:0},React.createElement(s,{sdk:I,library:I.library,component:g,versions:b,context:{onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition}},({editor:E,status:k,isArchivedDisplayed:D})=>({after:M,picker:w,chrome:E&&React.createElement(x,null),children:g.reduceVersionRevisions(b).filter(S=>{var R;return D||!((R=S.saved||S.draft)!=null&&R.deletedAt)}).map((S,R)=>React.createElement(f,{key:S.head.id,position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none"},React.createElement(f,{className:"borders",pointerEvents:"none",left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(f,{className:"borders",pointerEvents:"none",right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(f,{className:"borders",pointerEvents:"none",top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(f,{className:"borders",pointerEvents:"none",bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(a,{version:S.head,node:tt},{left:React.createElement(y,{justifyContent:"space-between"},React.createElement(u,{size:"sm",editor:k=="ready"?E:null}),React.createElement(l,{size:"sm"})),middle:React.createElement(i,null)})))})))))}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null}};it.register("feaas-editor");function qt(t=this){var r,e;return{part:(t==null?void 0:t.getAttribute("part"))||"picker",slot:(t==null?void 0:t.getAttribute("part"))||"slot",mode:t==null?void 0:t.getAttribute("mode"),frontend:(r=t==null?void 0:t.getContextAttribute("frontend"))!=null?r:"https://components.sitecorecloud.io",src:(e=t==null?void 0:t.getAttribute("src"))!=null?e:"/assets/picker.js",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,context:void 0,onClose:void 0}}var at=class extends m{getProps(){return qt(this)}load(){return import(this.formatURL(this.props.src,this.props.frontend))}renderReact({context:r,mode:e,children:n},{Picker:o,React:s,ReactDOM:i}){return s.createElement(o,{mode:e||void 0,onClose:this.props.onClose,context:r},n)}};at.register("feaas-picker");function Vt(t=this){var r,e;return{library:(t==null?void 0:t.getAttribute("library"))||"library",mode:t==null?void 0:t.getAttribute("mode"),frontend:(r=t==null?void 0:t.getContextAttribute("frontend"))!=null?r:"https://components.sitecorecloud.io",src:(e=t==null?void 0:t.getAttribute("src"))!=null?e:"/assets/picker.js",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,context:null,getToken:null}}var G=class extends m{constructor(){super(...arguments);this.payload=null;this.onClose=()=>{this.removeAttribute("mode")}}getProps(){return Vt(this)}render(){let{frontend:e,library:n,getToken:o,src:s,mode:i,context:a}=this.props;this.getAttribute("mode")==null?this.setAttribute("hidden","hidden"):this.removeAttribute("hidden"),this.children.length==0&&(this.innerHTML=`
|
|
68
68
|
<feaas-context library='${n}'>
|
|
69
69
|
<feaas-picker mode='${i}'>
|
|
70
70
|
<feaas-loader />
|
|
71
71
|
</feaas-context>
|
|
72
|
-
`),this.refs.context.set({frontend:e,library:n,getToken:o}),this.refs.picker.set({frontend:e,context:a,src:s,mode:i,onClose:this.onClose})}};G.observedAttributes=["library","mode","frontend","src","
|
|
72
|
+
`),this.refs.context.set({frontend:e,library:n,getToken:o}),this.refs.picker.set({frontend:e,context:a,src:s,mode:i,onClose:this.onClose})}};G.observedAttributes=["library","mode","frontend","src","context"];G.register("feaas-picker-lazy");function Xt(t=this){var r,e,n,o;return{library:t==null?void 0:t.getAttribute("library"),src:(r=t==null?void 0:t.getAttribute("src"))!=null?r:"/assets/context.js",frontend:(e=t==null?void 0:t.getAttribute("frontend"))!=null?e:"https://components.sitecoreclud.io",backend:(n=t==null?void 0:t.getAttribute("backend"))!=null?n:"https://components-api.sitecoreclud.io",cdn:(o=t==null?void 0:t.getAttribute("cdn"))!=null?o:"https://feaascompontsapiprod.blob.core.windows.net",getToken:null}}var Q=class extends m{getProps(){return Xt(this)}load(){return import(this.formatURL(this.props.src,this.props.frontend))}getTheme(e){return e}getRoot(){return this.shadowRoot||this.attachShadow({mode:"open"})}getReactRoot(){return this.reactRoot||(this.reactRoot=document.createElement("div"),this.getRoot().appendChild(this.reactRoot)),this.reactRoot}nestedCallback(e){super.nestedCallback(e);let n=e.composedPath()[0];n.parentNode!=this.getRoot()&&this.getRoot().appendChild(n)}renderReact({children:e,library:n},{AppContext:o,Chakra:{Button:s,Tooltip:i},React:a}){let u={containerRef:{current:this.getRoot()}};return i.defaultProps={hasArrow:!0,placement:"top",portalProps:u},a.createElement(o,{libraryId:this.props.library,container:this.getRoot(),getToken:this.props.getToken,getTheme:this.getTheme,modalProps:{portalProps:u},chakraProps:{cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:u}}},e)}};Q.observedAttributes=["library","component","version","revision","hostname","template"];Q.register("feaas-context");export{Y as FEAASComponent,zt as FEAASComponentsProps,Q as FEAASContext,Xt as FEAASContextProps,it as FEAASEditor,Jt as FEAASEditorProps,K as FEAASLoader,pe as FEAASLoaderProps,at as FEAASPicker,G as FEAASPickerLazy,Vt as FEAASPickerLazyProps,qt as FEAASPickerProps,st as FEAASStylesheet,Wt as FEAASStylesheetProps,$t as autoloadScripts,Ot as cleanCollectionBit,nt as fetchAndRevalidate,Ut as getFramePosition,ot as loadScript,Ht as normalizeCollectionScope,It as observeDOMElement,dt as queryScopes,ie as renderComponent,oe as renderComponentElement,jt as renderComponentPromise,X as renderDOMContent,B as renderDOMElement,se as renderStylesheet,Nt as renderStylesheetPromise,z as setDOMAttribute};
|
package/dist/node/index.cjs
CHANGED
|
@@ -1834,7 +1834,7 @@ var FEAASPickerLazy = class extends FEAASBase {
|
|
|
1834
1834
|
super(...arguments);
|
|
1835
1835
|
this.payload = null;
|
|
1836
1836
|
this.onClose = () => {
|
|
1837
|
-
this.
|
|
1837
|
+
this.removeAttribute("mode");
|
|
1838
1838
|
};
|
|
1839
1839
|
}
|
|
1840
1840
|
getProps() {
|
|
@@ -1842,6 +1842,11 @@ var FEAASPickerLazy = class extends FEAASBase {
|
|
|
1842
1842
|
}
|
|
1843
1843
|
render() {
|
|
1844
1844
|
const { frontend, library, getToken, src, mode, context } = this.props;
|
|
1845
|
+
if (this.getAttribute("mode") == null) {
|
|
1846
|
+
this.setAttribute("hidden", "hidden");
|
|
1847
|
+
} else {
|
|
1848
|
+
this.removeAttribute("hidden");
|
|
1849
|
+
}
|
|
1845
1850
|
if (this.children.length == 0)
|
|
1846
1851
|
this.innerHTML = `
|
|
1847
1852
|
<feaas-context library='${library}'>
|
|
@@ -1863,7 +1868,7 @@ var FEAASPickerLazy = class extends FEAASBase {
|
|
|
1863
1868
|
});
|
|
1864
1869
|
}
|
|
1865
1870
|
};
|
|
1866
|
-
FEAASPickerLazy.observedAttributes = ["library", "mode", "frontend", "src", "
|
|
1871
|
+
FEAASPickerLazy.observedAttributes = ["library", "mode", "frontend", "src", "context"];
|
|
1867
1872
|
FEAASPickerLazy.register("feaas-picker-lazy");
|
|
1868
1873
|
|
|
1869
1874
|
// src/components/FEAASContext.tsx
|
package/dist/node/index.js
CHANGED
|
@@ -1783,7 +1783,7 @@ var FEAASPickerLazy = class extends FEAASBase {
|
|
|
1783
1783
|
super(...arguments);
|
|
1784
1784
|
this.payload = null;
|
|
1785
1785
|
this.onClose = () => {
|
|
1786
|
-
this.
|
|
1786
|
+
this.removeAttribute("mode");
|
|
1787
1787
|
};
|
|
1788
1788
|
}
|
|
1789
1789
|
getProps() {
|
|
@@ -1791,6 +1791,11 @@ var FEAASPickerLazy = class extends FEAASBase {
|
|
|
1791
1791
|
}
|
|
1792
1792
|
render() {
|
|
1793
1793
|
const { frontend, library, getToken, src, mode, context } = this.props;
|
|
1794
|
+
if (this.getAttribute("mode") == null) {
|
|
1795
|
+
this.setAttribute("hidden", "hidden");
|
|
1796
|
+
} else {
|
|
1797
|
+
this.removeAttribute("hidden");
|
|
1798
|
+
}
|
|
1794
1799
|
if (this.children.length == 0)
|
|
1795
1800
|
this.innerHTML = `
|
|
1796
1801
|
<feaas-context library='${library}'>
|
|
@@ -1812,7 +1817,7 @@ var FEAASPickerLazy = class extends FEAASBase {
|
|
|
1812
1817
|
});
|
|
1813
1818
|
}
|
|
1814
1819
|
};
|
|
1815
|
-
FEAASPickerLazy.observedAttributes = ["library", "mode", "frontend", "src", "
|
|
1820
|
+
FEAASPickerLazy.observedAttributes = ["library", "mode", "frontend", "src", "context"];
|
|
1816
1821
|
FEAASPickerLazy.register("feaas-picker-lazy");
|
|
1817
1822
|
|
|
1818
1823
|
// src/components/FEAASContext.tsx
|
package/package.json
CHANGED
|
@@ -61,7 +61,7 @@ export function FEAASPickerLazyProps(element: FEAASBase<any, any> = this) {
|
|
|
61
61
|
type FEAASPickerLazyProps = ReturnType<typeof FEAASPickerLazyProps>
|
|
62
62
|
|
|
63
63
|
export class FEAASPickerLazy extends FEAASBase<FEAASPickerLazyProps, typeof FEAASPickerImports> {
|
|
64
|
-
static observedAttributes = ['library', 'mode', 'frontend', 'src', '
|
|
64
|
+
static observedAttributes = ['library', 'mode', 'frontend', 'src', 'context']
|
|
65
65
|
|
|
66
66
|
payload = null as any
|
|
67
67
|
getProps() {
|
|
@@ -69,12 +69,18 @@ export class FEAASPickerLazy extends FEAASBase<FEAASPickerLazyProps, typeof FEAA
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
onClose = () => {
|
|
72
|
-
this.
|
|
72
|
+
this.removeAttribute('mode')
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
render() {
|
|
76
76
|
const { frontend, library, getToken, src, mode, context } = this.props
|
|
77
77
|
|
|
78
|
+
if (this.getAttribute('mode') == null) {
|
|
79
|
+
this.setAttribute('hidden', 'hidden')
|
|
80
|
+
} else {
|
|
81
|
+
this.removeAttribute('hidden')
|
|
82
|
+
}
|
|
83
|
+
|
|
78
84
|
if (this.children.length == 0)
|
|
79
85
|
this.innerHTML = `
|
|
80
86
|
<feaas-context library='${library}'>
|