@next-bricks/visual-builder 0.8.16 → 0.8.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/dist/bricks.json +1 -1
  2. package/dist/chunks/{206.8d9a229f.js → 206.3ccda763.js} +2 -2
  3. package/dist/chunks/{206.8d9a229f.js.map → 206.3ccda763.js.map} +1 -1
  4. package/dist/chunks/{3669.9dff08f1.js → 3669.13e3b1a9.js} +2 -2
  5. package/dist/chunks/3669.13e3b1a9.js.map +1 -0
  6. package/dist/chunks/{4231.00885e99.js → 4231.c0fad2d4.js} +3 -3
  7. package/dist/chunks/{4231.00885e99.js.map → 4231.c0fad2d4.js.map} +1 -1
  8. package/dist/chunks/{541.3534c94a.js → 541.31096f2a.js} +3 -3
  9. package/dist/chunks/{541.3534c94a.js.map → 541.31096f2a.js.map} +1 -1
  10. package/dist/chunks/{main.23f6ecaa.js → main.3705c065.js} +2 -2
  11. package/dist/chunks/{main.23f6ecaa.js.map → main.3705c065.js.map} +1 -1
  12. package/dist/chunks/{workbench-action-list.cc8c9e7d.js → workbench-action-list.c52b03e8.js} +2 -2
  13. package/dist/chunks/{workbench-action-list.cc8c9e7d.js.map → workbench-action-list.c52b03e8.js.map} +1 -1
  14. package/dist/chunks/{workbench-history-action.40733ed0.js → workbench-history-action.52f2c345.js} +3 -3
  15. package/dist/chunks/{workbench-history-action.40733ed0.js.map → workbench-history-action.52f2c345.js.map} +1 -1
  16. package/dist/{index.86f00212.js → index.1347f441.js} +2 -2
  17. package/dist/{index.86f00212.js.map → index.1347f441.js.map} +1 -1
  18. package/package.json +3 -3
  19. package/dist/chunks/3669.9dff08f1.js.map +0 -1
  20. /package/dist/chunks/{4231.00885e99.js.LICENSE.txt → 4231.c0fad2d4.js.LICENSE.txt} +0 -0
  21. /package/dist/chunks/{541.3534c94a.js.LICENSE.txt → 541.31096f2a.js.LICENSE.txt} +0 -0
  22. /package/dist/chunks/{workbench-history-action.40733ed0.js.LICENSE.txt → workbench-history-action.52f2c345.js.LICENSE.txt} +0 -0
package/dist/bricks.json CHANGED
@@ -37,5 +37,5 @@
37
37
  "eo-popover"
38
38
  ]
39
39
  },
40
- "filePath": "bricks/visual-builder/dist/index.86f00212.js"
40
+ "filePath": "bricks/visual-builder/dist/index.1347f441.js"
41
41
  }
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunk_next_bricks_visual_builder=self.webpackChunk_next_bricks_visual_builder||[]).push([[206],{894:(e,t,r)=>{r.d(t,{k:()=>a});var n=r(6107),o=r(6530),i=r(2812);function a(e){var t=function(e){var t=new Set;return(0,o.f)(e,(e=>{switch(e.type){case"Resolvable":case"EventHandler":var r,n=null===(r=e.raw)||void 0===r?void 0:r.useProvider;n&&t.add(n)}})),t}((0,i.ud)(e)),r=[];for(var n of t)n.includes("@")&&r.push(n);return r}customElements.define("visual-builder.collect-used-contracts",(0,n.createProviderClass)(a))},206:(e,t,r)=>{r.d(t,{Z:()=>_});var n,o=r(4795),i=r(3028),a=r(9018),s=r(5178),d=r(1763),l=r.n(d)();function p(){return(p=(0,o.Z)((function*(e,t){var r,n=yield l(document.body,{logging:!1,scale:1,width:window.innerWidth,height:window.innerHeight,foreignObjectRendering:!0}),o=document.createElement("canvas");return function(e,t,r,n){var o=r/n,{width:i,height:a}=e,s=i/a,d=s>=o,l=d?r:n*s,p=d?r/s:n;t.width=l,t.height=p,t.getContext("2d").drawImage(e,0,0,i,a,0,0,l,p),t.toDataURL()}(n,o,e,t),yield(r=o,new Promise((function(e,t){r.toBlob((function(r){r?e(r):t()}))})))}))).apply(this,arguments)}function c(e){var t;e.preventDefault(),e.stopPropagation(),(t=y(e.target)).length>0&&window.parent.postMessage({sender:"previewer",type:"select-brick",iidList:t},n)}function u(e){e.preventDefault(),e.stopPropagation()}var v=(0,s.throttle)((e=>{var t=y(e.target);t.length>0&&window.parent.postMessage({sender:"previewer",type:"hover-on-brick",iidList:t},n)}),100,{leading:!1});function w(e){e.preventDefault(),e.stopPropagation(),v(e)}function h(e){e.preventDefault(),e.stopPropagation(),v(e)}function g(e){e.preventDefault(),e.stopPropagation(),window.parent.postMessage({sender:"previewer",type:"hover-on-brick",iidList:[]},n)}function m(e){var t,r,o;e.preventDefault(),e.stopPropagation(),t=e.target,r={x:e.clientX,y:e.clientY},(o=y(t)).length>0&&window.parent.postMessage({sender:"previewer",type:"context-menu-on-brick",iidList:o,position:r},n)}function y(e){for(var t=[],r=e;r;)"string"==typeof r.dataset.iid&&t.push(r.dataset.iid),r=r.parentElement;return t}var f=r(894),b=!1,S=a.getHistory,k=a.matchPath,E=a.__secret_internals,L=!1;try{var x,I=window.dll;if(I&&null!==(x=window.BRICK_NEXT_VERSIONS)&&void 0!==x&&null!==(x=x["brick-container"])&&void 0!==x&&x.startsWith("2.")){var{getHistory:P,developHelper:C}=I("tYg3"),{matchPath:D}=I("A+yw");S=P,k=D,E=(0,i.Z)((0,i.Z)({},C),{},{getContextValue(e,t){var{tplStateStoreId:r}=t;return C.getContextValue(e,{tplContextId:r})},getAllContextValues(e){var{tplStateStoreId:t}=e,r=C.getAllContextValues({tplContextId:t});return Object.fromEntries([...r].map((e=>{var[t,r]=e;return[t,r.value]})))}}),L=!0}}catch(e){console.error("Try to use v2 runtime APIs failed:",e)}var T=null,N=null;function _(e,t){return A.apply(this,arguments)}function A(){return A=(0,o.Z)((function*(e,t){if(!b){b=!0;var r,d,l,v,x=t=>{window.parent.postMessage((0,i.Z)({sender:"previewer"},t),e)};x({type:"preview-started"}),n=e;var I,P=(e,t,r)=>{var n=M(t);x({type:"highlight-brick",highlightType:e,outlines:n,iid:t,alias:r})};t.templateId&&(I=t.settings);var C=()=>{E.updateTemplatePreviewSettings(t.appId,t.templateId,I),S().reload()},D=()=>{E.updateSnippetPreviewSettings(t.appId,JSON.parse(t.snippetData)),S().reload()},_=S();window.addEventListener("message",function(){var i=(0,o.Z)((function*(o){var i,b,k,{data:T,origin:N}=o;if(N===e&&T&&"preview-container"===T.sender)if("builder"===T.forwardedFor)switch(T.type){case"hover-on-brick":r=T.iid,d=T.alias,P("hover",T.iid,T.alias);break;case"hover-on-main":P("hover","#main-mount-point","root");break;case"hover-on-context":k=T.highlightNodes.map((e=>M(e.iid,e.alias))).flat(),x({type:"highlight-context",outlines:k});break;case"select-brick":l=T.iid,v=T.alias,P("active",T.iid,T.alias);break;case"hover-on-iframe":(e=>{var t=document.elementFromPoint(e.x,e.y);if("BODY"===(null==t?void 0:t.tagName))window.parent.postMessage({sender:"previewer",type:"hover-on-main",isDirection:!0,position:{x:e.x,y:e.y}},n);else{var r=y(t);window.parent.postMessage({sender:"previewer",type:"hover-on-brick",iidList:r,isDirection:!0,position:{x:e.x,y:e.y}},n)}})(T.position)}else switch(T.type){case"toggle-inspecting":T.enabled?(window.addEventListener("click",c,!0),window.addEventListener("mousedown",u,!0),window.addEventListener("mouseover",u,!0),window.addEventListener("mouseup",u,!0),window.addEventListener("pointerdown",w,!0),window.addEventListener("pointerover",h,!0),window.addEventListener("pointerup",u,!0),window.addEventListener("pointerleave",g,!0),window.addEventListener("contextmenu",m,!0)):(window.removeEventListener("click",c,!0),window.removeEventListener("mousedown",u,!0),window.removeEventListener("mouseover",u,!0),window.removeEventListener("mouseup",u,!0),window.removeEventListener("pointerdown",w,!0),window.removeEventListener("pointerover",h,!0),window.removeEventListener("pointerup",u,!0),window.removeEventListener("pointerleave",g,!0),window.removeEventListener("contextmenu",m,!0));break;case"refresh":if(null!==(i=T.options)&&void 0!==i&&i.updateStoryboardType){var A,B;"route"===T.options.updateStoryboardType?E.updateStoryboardByRoute(t.appId,T.storyboardPatch):"template"===T.options.updateStoryboardType?E.updateStoryboardByTemplate(t.appId,T.storyboardPatch,T.options.settings):"snippet"===T.options.updateStoryboardType&&E.updateStoryboardBySnippet(t.appId,T.storyboardPatch);var O=yield null===(A=(B=E).getAddedContracts)||void 0===A?void 0:A.call(B,T.storyboardPatch,{appId:t.appId,updateStoryboardType:T.options.updateStoryboardType,formId:t.formId,collectUsedContracts:f.k});(0,s.isEmpty)(O)?S().reload():x({type:"contract-update",data:{add:O}});break}E.updateStoryboard(t.appId,T.storyboardPatch),t.templateId?(I=T.settings,C()):null!==(b=T.options)&&void 0!==b&&b.snippetData?(t.snippetData=T.options.snippetData,D()):S().reload();break;case"reload":location.reload();break;case"back":_.goBack();break;case"forward":_.goForward();break;case"capture":(function(e,t){return p.apply(this,arguments)})(T.maxWidth,T.maxHeight).then((e=>{x({type:"capture-ok",screenshot:e})}),(()=>{x({type:"capture-failed"})}));break;case"inspect-data-value":((e,t)=>{try{var r,n,o,{dataType:i}=t,a=L?"tplContextId":"tplStateStoreId";if("state"===i&&!(r=document.querySelector("#main-mount-point").firstChild.dataset[a]))return void x({type:"inspect-data-value-error",data:{error:{message:"tplStateStoreId not found, unable to preview STATE value"}}});if(e)o="inspect-single-data-value-success",n=E.getContextValue(e,{tplStateStoreId:r});else{o="inspect-all-data-values-success";var s=E.getAllContextValues({tplStateStoreId:r});n=Object.entries(s).map((e=>{var[t,r]=e;return{name:t,value:r}}))}x({type:o,data:{name:e,value:n}})}catch(e){x({type:"inspect-data-value-error",data:{message:e.message}})}})(T.name,T.option);break;case"update-preview-url":var H=T.previewUrl.startsWith(window.origin)?T.previewUrl.substring(window.origin.length):T.previewUrl,R=(0,a.getBasePath)(),V=H.startsWith(R)?H.substring(R.length-1):H;S().push(V);break;case"update-preview-route":t.routePath=T.routePath,t.routeExact=T.routeExact,Z()}}));return function(e){return i.apply(this,arguments)}}()),window.addEventListener("scroll",(()=>{x({type:"scroll",scroll:{x:window.scrollX,y:window.scrollY}})}));var A,B=!0,O=e=>{x({type:"url-change",url:location.origin+_.createHref(e)}),A=e,Z()};O(_.location),_.listen(O),t.templateId&&C(),t.snippetData&&D(),H(),new MutationObserver((0,s.throttle)((()=>{H(),r&&P("hover",r,d),l&&P("active",l,v)}),100,{leading:!1})).observe(document.body,{subtree:!0,childList:!0})}function Z(){if(t.routePath){var e=!!k(A.pathname,{path:t.routePath,exact:t.routeExact});if(x({type:"route-match-change",match:e}),t.templateId&&!B&&e){var r=document.querySelector("#main-mount-point"),n=new MutationObserver((()=>{1===r.childNodes.length&&"SPAN"===r.firstChild.tagName&&0===r.firstChild.childNodes.length&&(C(),n.disconnect())}));n.observe(r,{childList:!0})}if(t.snippetData&&!B&&e){var o=document.querySelector("#main-mount-point"),i=new MutationObserver((()=>{1===o.childNodes.length&&"SPAN"===o.firstChild.tagName&&0===o.firstChild.childNodes.length&&(D(),i.disconnect())}));i.observe(o,{childList:!0})}B=e}}function H(){var e,t,r,n=document.querySelector("eo-page-view"),o=null!==(e=null==n||null===(t=n.shadowRoot)||void 0===t?void 0:t.querySelector(".content"))&&void 0!==e?e:null;o!==T&&(null===(r=T)||void 0===r||r.removeEventListener("scroll",R),null==o||o.addEventListener("scroll",R),T=o,N=n)}function R(){x({type:"content-scroll",scroll:{x:this.scrollLeft,y:this.scrollTop}})}})),A.apply(this,arguments)}function M(e,t){if(!e)return[];var r=e.includes("#"),n=function(e,t){return[...e].map((e=>{var r,n=null===(r=N)||void 0===r?void 0:r.contains(e),{width:o,height:i,left:a,top:s}=e.getBoundingClientRect();return{width:o,height:i,left:a+window.scrollX+(n?T.scrollLeft:0),top:s+window.scrollY+(n?T.scrollTop:0),alias:t,hasContentScroll:n}}))}(document.querySelectorAll(r?e:'[data-iid="'.concat(e,'"]')),t);return r?n.map((e=>(0,i.Z)((0,i.Z)({},e),{},{height:window.innerHeight-e.top}))):n}}}]);
2
- //# sourceMappingURL=206.8d9a229f.js.map
1
+ "use strict";(self.webpackChunk_next_bricks_visual_builder=self.webpackChunk_next_bricks_visual_builder||[]).push([[206],{894:(e,t,r)=>{r.d(t,{k:()=>a});var n=r(6107),o=r(6530),i=r(2812);function a(e){var t=function(e){var t=new Set;return(0,o.f)(e,(e=>{switch(e.type){case"Resolvable":case"EventHandler":var r,n=null===(r=e.raw)||void 0===r?void 0:r.useProvider;n&&t.add(n)}})),t}((0,i.ud)(e)),r=[];for(var n of t)n.includes("@")&&r.push(n);return r}customElements.define("visual-builder.collect-used-contracts",(0,n.createProviderClass)(a))},206:(e,t,r)=>{r.d(t,{Z:()=>_});var n,o=r(4795),i=r(3028),a=r(8356),s=r(5178),d=r(1763),l=r.n(d)();function p(){return(p=(0,o.Z)((function*(e,t){var r,n=yield l(document.body,{logging:!1,scale:1,width:window.innerWidth,height:window.innerHeight,foreignObjectRendering:!0}),o=document.createElement("canvas");return function(e,t,r,n){var o=r/n,{width:i,height:a}=e,s=i/a,d=s>=o,l=d?r:n*s,p=d?r/s:n;t.width=l,t.height=p,t.getContext("2d").drawImage(e,0,0,i,a,0,0,l,p),t.toDataURL()}(n,o,e,t),yield(r=o,new Promise((function(e,t){r.toBlob((function(r){r?e(r):t()}))})))}))).apply(this,arguments)}function c(e){var t;e.preventDefault(),e.stopPropagation(),(t=y(e.target)).length>0&&window.parent.postMessage({sender:"previewer",type:"select-brick",iidList:t},n)}function u(e){e.preventDefault(),e.stopPropagation()}var v=(0,s.throttle)((e=>{var t=y(e.target);t.length>0&&window.parent.postMessage({sender:"previewer",type:"hover-on-brick",iidList:t},n)}),100,{leading:!1});function w(e){e.preventDefault(),e.stopPropagation(),v(e)}function h(e){e.preventDefault(),e.stopPropagation(),v(e)}function g(e){e.preventDefault(),e.stopPropagation(),window.parent.postMessage({sender:"previewer",type:"hover-on-brick",iidList:[]},n)}function m(e){var t,r,o;e.preventDefault(),e.stopPropagation(),t=e.target,r={x:e.clientX,y:e.clientY},(o=y(t)).length>0&&window.parent.postMessage({sender:"previewer",type:"context-menu-on-brick",iidList:o,position:r},n)}function y(e){for(var t=[],r=e;r;)"string"==typeof r.dataset.iid&&t.push(r.dataset.iid),r=r.parentElement;return t}var f=r(894),b=!1,S=a.getHistory,k=a.matchPath,E=a.__secret_internals,L=!1;try{var x,I=window.dll;if(I&&null!==(x=window.BRICK_NEXT_VERSIONS)&&void 0!==x&&null!==(x=x["brick-container"])&&void 0!==x&&x.startsWith("2.")){var{getHistory:P,developHelper:C}=I("tYg3"),{matchPath:D}=I("A+yw");S=P,k=D,E=(0,i.Z)((0,i.Z)({},C),{},{getContextValue(e,t){var{tplStateStoreId:r}=t;return C.getContextValue(e,{tplContextId:r})},getAllContextValues(e){var{tplStateStoreId:t}=e,r=C.getAllContextValues({tplContextId:t});return Object.fromEntries([...r].map((e=>{var[t,r]=e;return[t,r.value]})))}}),L=!0}}catch(e){console.error("Try to use v2 runtime APIs failed:",e)}var T=null,N=null;function _(e,t){return A.apply(this,arguments)}function A(){return A=(0,o.Z)((function*(e,t){if(!b){b=!0;var r,d,l,v,x=t=>{window.parent.postMessage((0,i.Z)({sender:"previewer"},t),e)};x({type:"preview-started"}),n=e;var I,P=(e,t,r)=>{var n=M(t);x({type:"highlight-brick",highlightType:e,outlines:n,iid:t,alias:r})};t.templateId&&(I=t.settings);var C=()=>{E.updateTemplatePreviewSettings(t.appId,t.templateId,I),S().reload()},D=()=>{E.updateSnippetPreviewSettings(t.appId,JSON.parse(t.snippetData)),S().reload()},_=S();window.addEventListener("message",function(){var i=(0,o.Z)((function*(o){var i,b,k,{data:T,origin:N}=o;if(N===e&&T&&"preview-container"===T.sender)if("builder"===T.forwardedFor)switch(T.type){case"hover-on-brick":r=T.iid,d=T.alias,P("hover",T.iid,T.alias);break;case"hover-on-main":P("hover","#main-mount-point","root");break;case"hover-on-context":k=T.highlightNodes.map((e=>M(e.iid,e.alias))).flat(),x({type:"highlight-context",outlines:k});break;case"select-brick":l=T.iid,v=T.alias,P("active",T.iid,T.alias);break;case"hover-on-iframe":(e=>{var t=document.elementFromPoint(e.x,e.y);if("BODY"===(null==t?void 0:t.tagName))window.parent.postMessage({sender:"previewer",type:"hover-on-main",isDirection:!0,position:{x:e.x,y:e.y}},n);else{var r=y(t);window.parent.postMessage({sender:"previewer",type:"hover-on-brick",iidList:r,isDirection:!0,position:{x:e.x,y:e.y}},n)}})(T.position)}else switch(T.type){case"toggle-inspecting":T.enabled?(window.addEventListener("click",c,!0),window.addEventListener("mousedown",u,!0),window.addEventListener("mouseover",u,!0),window.addEventListener("mouseup",u,!0),window.addEventListener("pointerdown",w,!0),window.addEventListener("pointerover",h,!0),window.addEventListener("pointerup",u,!0),window.addEventListener("pointerleave",g,!0),window.addEventListener("contextmenu",m,!0)):(window.removeEventListener("click",c,!0),window.removeEventListener("mousedown",u,!0),window.removeEventListener("mouseover",u,!0),window.removeEventListener("mouseup",u,!0),window.removeEventListener("pointerdown",w,!0),window.removeEventListener("pointerover",h,!0),window.removeEventListener("pointerup",u,!0),window.removeEventListener("pointerleave",g,!0),window.removeEventListener("contextmenu",m,!0));break;case"refresh":if(null!==(i=T.options)&&void 0!==i&&i.updateStoryboardType){var A,B;"route"===T.options.updateStoryboardType?E.updateStoryboardByRoute(t.appId,T.storyboardPatch):"template"===T.options.updateStoryboardType?E.updateStoryboardByTemplate(t.appId,T.storyboardPatch,T.options.settings):"snippet"===T.options.updateStoryboardType&&E.updateStoryboardBySnippet(t.appId,T.storyboardPatch);var O=yield null===(A=(B=E).getAddedContracts)||void 0===A?void 0:A.call(B,T.storyboardPatch,{appId:t.appId,updateStoryboardType:T.options.updateStoryboardType,formId:t.formId,collectUsedContracts:f.k});(0,s.isEmpty)(O)?S().reload():x({type:"contract-update",data:{add:O}});break}E.updateStoryboard(t.appId,T.storyboardPatch),t.templateId?(I=T.settings,C()):null!==(b=T.options)&&void 0!==b&&b.snippetData?(t.snippetData=T.options.snippetData,D()):S().reload();break;case"reload":location.reload();break;case"back":_.goBack();break;case"forward":_.goForward();break;case"capture":(function(e,t){return p.apply(this,arguments)})(T.maxWidth,T.maxHeight).then((e=>{x({type:"capture-ok",screenshot:e})}),(()=>{x({type:"capture-failed"})}));break;case"inspect-data-value":((e,t)=>{try{var r,n,o,{dataType:i}=t,a=L?"tplContextId":"tplStateStoreId";if("state"===i&&!(r=document.querySelector("#main-mount-point").firstChild.dataset[a]))return void x({type:"inspect-data-value-error",data:{error:{message:"tplStateStoreId not found, unable to preview STATE value"}}});if(e)o="inspect-single-data-value-success",n=E.getContextValue(e,{tplStateStoreId:r});else{o="inspect-all-data-values-success";var s=E.getAllContextValues({tplStateStoreId:r});n=Object.entries(s).map((e=>{var[t,r]=e;return{name:t,value:r}}))}x({type:o,data:{name:e,value:n}})}catch(e){x({type:"inspect-data-value-error",data:{message:e.message}})}})(T.name,T.option);break;case"update-preview-url":var H=T.previewUrl.startsWith(window.origin)?T.previewUrl.substring(window.origin.length):T.previewUrl,R=(0,a.getBasePath)(),V=H.startsWith(R)?H.substring(R.length-1):H;S().push(V);break;case"update-preview-route":t.routePath=T.routePath,t.routeExact=T.routeExact,Z()}}));return function(e){return i.apply(this,arguments)}}()),window.addEventListener("scroll",(()=>{x({type:"scroll",scroll:{x:window.scrollX,y:window.scrollY}})}));var A,B=!0,O=e=>{x({type:"url-change",url:location.origin+_.createHref(e)}),A=e,Z()};O(_.location),_.listen(O),t.templateId&&C(),t.snippetData&&D(),H(),new MutationObserver((0,s.throttle)((()=>{H(),r&&P("hover",r,d),l&&P("active",l,v)}),100,{leading:!1})).observe(document.body,{subtree:!0,childList:!0})}function Z(){if(t.routePath){var e=!!k(A.pathname,{path:t.routePath,exact:t.routeExact});if(x({type:"route-match-change",match:e}),t.templateId&&!B&&e){var r=document.querySelector("#main-mount-point"),n=new MutationObserver((()=>{1===r.childNodes.length&&"SPAN"===r.firstChild.tagName&&0===r.firstChild.childNodes.length&&(C(),n.disconnect())}));n.observe(r,{childList:!0})}if(t.snippetData&&!B&&e){var o=document.querySelector("#main-mount-point"),i=new MutationObserver((()=>{1===o.childNodes.length&&"SPAN"===o.firstChild.tagName&&0===o.firstChild.childNodes.length&&(D(),i.disconnect())}));i.observe(o,{childList:!0})}B=e}}function H(){var e,t,r,n=document.querySelector("eo-page-view"),o=null!==(e=null==n||null===(t=n.shadowRoot)||void 0===t?void 0:t.querySelector(".content"))&&void 0!==e?e:null;o!==T&&(null===(r=T)||void 0===r||r.removeEventListener("scroll",R),null==o||o.addEventListener("scroll",R),T=o,N=n)}function R(){x({type:"content-scroll",scroll:{x:this.scrollLeft,y:this.scrollTop}})}})),A.apply(this,arguments)}function M(e,t){if(!e)return[];var r=e.includes("#"),n=function(e,t){return[...e].map((e=>{var r,n=null===(r=N)||void 0===r?void 0:r.contains(e),{width:o,height:i,left:a,top:s}=e.getBoundingClientRect();return{width:o,height:i,left:a+window.scrollX+(n?T.scrollLeft:0),top:s+window.scrollY+(n?T.scrollTop:0),alias:t,hasContentScroll:n}}))}(document.querySelectorAll(r?e:'[data-iid="'.concat(e,'"]')),t);return r?n.map((e=>(0,i.Z)((0,i.Z)({},e),{},{height:window.innerHeight-e.top}))):n}}}]);
2
+ //# sourceMappingURL=206.3ccda763.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chunks/206.8d9a229f.js","mappings":"2LAgCO,SAASA,EAAqBC,GACnC,IAAMC,EArBR,SAAiBC,GACf,IAAMD,EAAa,IAAIE,IAgBvB,OAdAC,EAAAA,EAAAA,GAASF,GAAcG,IACrB,OAAQA,EAAKC,MACX,IAAK,aACL,IAAK,eAAgB,IAAAC,EACbC,EACI,QADOD,EACfF,EAAKI,WAAG,IAAAF,OAAA,EADUA,EAEjBC,YACCA,GACFP,EAAWS,IAAIF,GAGrB,IAGKP,CACT,CAGqBU,EAAQC,EAAAA,EAAAA,IAAgBZ,IAErCa,EAAY,GAElB,IAAK,IAAMC,KAAQb,EACba,EAAKC,SAAS,MAChBF,EAAUG,KAAKF,GAInB,OAAOD,CACT,CAEAI,eAAeC,OACb,yCACAC,EAAAA,EAAAA,qBAAoBpB,G,qCCvCXqB,E,kDCJLC,E,MAAcC,GA6BnB,SAAAC,IAAA,OAAAA,GAAAC,EAAAA,EAAAA,IAfM,UACLC,EACAC,GAEA,IAhBqBC,EAgBfC,QAAqBP,EAAYQ,SAASC,KAAM,CACpDC,SAAS,EACTC,MAAO,EACPC,MAAOC,OAAOC,WACdC,OAAQF,OAAOG,YACfC,wBAAwB,IAEpBC,EAAeV,SAASW,cAA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AAItE,SAAS,KAItB2H,EASR,SACEqG,EACAtG,GAEA,MAAO,IAAIsG,GAAU7H,KAAKgD,IAAY,IAAA8E,EAC9BC,EAAoC,QAApBD,EAAGtH,SAAiB,IAAAsH,OAAA,EAAjBA,EAAmBE,SAAShF,IAC/C,MAAEjI,EAAK,OAAEG,EAAM,KAAE+M,EAAI,IAAEC,GAAQlF,EAAQmF,wBAC7C,MAAO,CACLpN,QACAG,SACA+M,KACEA,EACAjN,OAAO6K,SACNkC,EAAmBxH,EAAqBmH,WAAa,GACxDQ,IACEA,EACAlN,OAAO8K,SACNiC,EAAmBxH,EAAqBoH,UAAY,GACvDpG,QACAwG,mBACD,GAEL,CA/BmBK,CAHAzN,SAAS0N,iBACxBT,EAASzJ,EAAM,cAAHmK,OAAiBnK,EAAG,OAEKoD,GACvC,OAAOqG,EACHpG,EAASxB,KAAKpG,IAAIyF,EAAAA,EAAAA,IAAAA,EAAAA,EAAAA,GAAA,GACbzF,GAAI,IACPsB,OAAQF,OAAOG,YAAcvB,EAAKsO,QAEpC1G,CACN,C","sources":["webpack:///./src/data-providers/collect-used-contracts.ts","webpack:///./src/data-providers/preview/inspector.ts","webpack:///./src/data-providers/preview/capture.ts","webpack:///./src/data-providers/preview/resizeScreenshot.ts","webpack:///./src/data-providers/preview/connect.ts"],"sourcesContent":["import { createProviderClass } from \"@next-core/utils/general\";\nimport {\n type StoryboardNode,\n parseStoryboard,\n traverse,\n} from \"@next-core/storyboard\";\nimport {\n Storyboard,\n UseProviderResolveConf,\n UseProviderEventHandler,\n} from \"@next-core/types\";\n\nfunction collect(nodeOrNodes: StoryboardNode | StoryboardNode[]): Set<string> {\n const collection = new Set<string>();\n\n traverse(nodeOrNodes, (node) => {\n switch (node.type) {\n case \"Resolvable\":\n case \"EventHandler\": {\n const useProvider = (\n node.raw as UseProviderResolveConf | UseProviderEventHandler\n )?.useProvider;\n if (useProvider) {\n collection.add(useProvider);\n }\n }\n }\n });\n\n return collection;\n}\n\nexport function collectUsedContracts(storyboard: Storyboard): string[] {\n const collection = collect(parseStoryboard(storyboard as any));\n\n const contracts = [];\n\n for (const item of collection) {\n if (item.includes(\"@\")) {\n contracts.push(item);\n }\n }\n\n return contracts;\n}\n\ncustomElements.define(\n \"visual-builder.collect-used-contracts\",\n createProviderClass(collectUsedContracts)\n);\n","// istanbul ignore file: working in progress\n// https://github.com/facebook/react/blob/cae635054e17a6f107a39d328649137b83f25972/packages/react-devtools-shared/src/backend/views/Highlighter/index.js\nimport { throttle } from \"lodash\";\nimport type {\n PreviewMessagePreviewerHoverOnBrick,\n PreviewMessagePreviewerSelectBrick,\n PreviewMessagePreviewerContextMenuOnBrick,\n} from \"./interfaces.js\";\n\nexport let previewProxyOrigin: string;\n\nexport function setPreviewFromOrigin(origin: string): void {\n previewProxyOrigin = origin;\n}\n\nexport function startInspecting(): void {\n registerListeners();\n}\n\nexport function stopInspecting(): void {\n unregisterListeners();\n}\n\nfunction registerListeners(): void {\n window.addEventListener(\"click\", onClick, true);\n window.addEventListener(\"mousedown\", onMouseEvent, true);\n window.addEventListener(\"mouseover\", onMouseEvent, true);\n window.addEventListener(\"mouseup\", onMouseEvent, true);\n window.addEventListener(\"pointerdown\", onPointerDown, true);\n window.addEventListener(\"pointerover\", onPointerOver, true);\n window.addEventListener(\"pointerup\", onMouseEvent, true);\n window.addEventListener(\"pointerleave\", onPointerLeave, true);\n window.addEventListener(\"contextmenu\", onContextMenu, true);\n}\n\nfunction unregisterListeners(): void {\n window.removeEventListener(\"click\", onClick, true);\n window.removeEventListener(\"mousedown\", onMouseEvent, true);\n window.removeEventListener(\"mouseover\", onMouseEvent, true);\n window.removeEventListener(\"mouseup\", onMouseEvent, true);\n window.removeEventListener(\"pointerdown\", onPointerDown, true);\n window.removeEventListener(\"pointerover\", onPointerOver, true);\n window.removeEventListener(\"pointerup\", onMouseEvent, true);\n window.removeEventListener(\"pointerleave\", onPointerLeave, true);\n window.removeEventListener(\"contextmenu\", onContextMenu, true);\n}\n\nfunction onClick(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n selectBrick(event.target as HTMLElement);\n}\n\nfunction onMouseEvent(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n}\n\nconst hoverOnBrick = throttle(\n (e: MouseEvent) => {\n const brick = e.target as HTMLElement;\n const iidList = getPossibleBrickIidList(brick);\n if (iidList.length > 0) {\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"hover-on-brick\",\n iidList,\n } as PreviewMessagePreviewerHoverOnBrick,\n previewProxyOrigin\n );\n }\n },\n 100,\n { leading: false }\n);\n\nfunction onPointerDown(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n hoverOnBrick(event);\n}\n\nfunction onPointerOver(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n hoverOnBrick(event);\n}\n\nfunction onPointerLeave(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"hover-on-brick\",\n iidList: [],\n } as PreviewMessagePreviewerHoverOnBrick,\n previewProxyOrigin\n );\n}\n\nfunction onContextMenu(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n contextMenuOnBrick(event.target as HTMLElement, {\n x: event.clientX,\n y: event.clientY,\n });\n}\n\nfunction contextMenuOnBrick(\n brick: HTMLElement,\n position: {\n x: number;\n y: number;\n }\n): void {\n const iidList = getPossibleBrickIidList(brick);\n if (iidList.length > 0) {\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"context-menu-on-brick\",\n iidList,\n position,\n } as PreviewMessagePreviewerContextMenuOnBrick,\n previewProxyOrigin\n );\n }\n}\n\nfunction selectBrick(brick: HTMLElement): void {\n const iidList = getPossibleBrickIidList(brick);\n if (iidList.length > 0) {\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"select-brick\",\n iidList,\n } as PreviewMessagePreviewerSelectBrick,\n previewProxyOrigin\n );\n }\n}\n\nexport function getPossibleBrickIidList(brick: HTMLElement): string[] {\n const iidList: string[] = [];\n // Traverse from bottom to up, to find bricks current hover on.\n let cursor: HTMLElement | null = brick;\n while (cursor) {\n if (typeof cursor.dataset.iid === \"string\") {\n iidList.push(cursor.dataset.iid);\n }\n cursor = cursor.parentElement;\n }\n return iidList;\n}\n","// istanbul ignore file: nothing logical except calling html2canvas.\nimport _html2canvas from \"html2canvas\";\nimport { resizeScreenshot } from \"./resizeScreenshot.js\";\n\n// There is a type issue like i18next\nconst html2canvas = _html2canvas as unknown as typeof _html2canvas.default;\n\nfunction getCanvasBlob(canvas: HTMLCanvasElement): Promise<Blob> {\n return new Promise(function (resolve, reject) {\n canvas.toBlob(function (blob: Blob | null) {\n if (blob) {\n resolve(blob);\n } else {\n reject();\n }\n });\n });\n}\n\nexport async function capture(\n maxWidth: number,\n maxHeight: number\n): Promise<Blob> {\n const sourceCanvas = await html2canvas(document.body, {\n logging: false,\n scale: 1,\n width: window.innerWidth,\n height: window.innerHeight,\n foreignObjectRendering: true,\n });\n const targetCanvas = document.createElement(\"canvas\");\n resizeScreenshot(sourceCanvas, targetCanvas, maxWidth, maxHeight);\n const blob = await getCanvasBlob(targetCanvas);\n return blob;\n}\n","export function resizeScreenshot(\n canvas: HTMLCanvasElement,\n targetCanvas: HTMLCanvasElement,\n maxWidth: number,\n maxHeight: number\n): string {\n const targetRatio = maxWidth / maxHeight;\n const { width, height } = canvas;\n const ratio = width / height;\n const wider = ratio >= targetRatio;\n const finalWidth = wider ? maxWidth : maxHeight * ratio;\n const finalHeight = wider ? maxWidth / ratio : maxHeight;\n targetCanvas.width = finalWidth;\n targetCanvas.height = finalHeight;\n\n const ctx = targetCanvas.getContext(\"2d\")!;\n ctx.drawImage(canvas, 0, 0, width, height, 0, 0, finalWidth, finalHeight);\n return targetCanvas.toDataURL();\n}\n","import {\n getHistory as _getHistory,\n getBasePath,\n matchPath as _matchPath,\n __secret_internals as _internals,\n type NextLocation,\n} from \"@next-core/runtime\";\nimport type { BrickConf, CustomTemplate, RouteConf } from \"@next-core/types\";\nimport { isEmpty, throttle } from \"lodash\";\nimport type {\n BrickOutline,\n HighLightNode,\n Position,\n PreviewDataOption,\n PreviewMessageFromPreviewer,\n PreviewMessagePreviewContractUpdate,\n PreviewMessagePreviewDataValueError,\n PreviewMessagePreviewDataValueSuccess,\n PreviewMessagePreviewerCaptureFailed,\n PreviewMessagePreviewerCaptureOk,\n PreviewMessagePreviewerContentScroll,\n PreviewMessagePreviewerHighlightBrick,\n PreviewMessagePreviewerHighlightContext,\n PreviewMessagePreviewerHoverOnMain,\n PreviewMessagePreviewerRouteMatchChange,\n PreviewMessagePreviewerScroll,\n PreviewMessagePreviewerUrlChange,\n PreviewMessageToPreviewer,\n PreviewSettings,\n PreviewStartOptions,\n} from \"./interfaces.js\";\nimport { capture } from \"./capture.js\";\nimport {\n previewProxyOrigin,\n getPossibleBrickIidList,\n setPreviewFromOrigin,\n startInspecting,\n stopInspecting,\n} from \"./inspector.js\";\nimport { collectUsedContracts } from \"../collect-used-contracts.js\";\n\nlet connected = false;\n\ninterface DLL {\n (moduleId: \"tYg3\"): {\n getHistory: typeof _getHistory;\n developHelper: typeof _internals;\n };\n (moduleId: \"A+yw\"): {\n matchPath: typeof _matchPath;\n };\n}\n\nlet getHistory = _getHistory;\nlet matchPath = _matchPath;\nlet __secret_internals = _internals;\nlet isV2 = false;\n\n// istanbul ignore next\n// Make v3 bricks compatible with Brick Next v2.\ntry {\n const dll = (window as unknown as { dll?: DLL }).dll;\n if (\n dll &&\n window.BRICK_NEXT_VERSIONS?.[\"brick-container\"]?.startsWith(\"2.\")\n ) {\n const { getHistory: getHistoryV2, developHelper: developHelperV2 } =\n dll(\"tYg3\");\n const { matchPath: matchPathV2 } = dll(\"A+yw\");\n getHistory = getHistoryV2;\n matchPath = matchPathV2;\n // The `__secret_internals` of v3 has pretty the same API as\n // `developHelper` of v2, especially those for preview usage.\n __secret_internals = {\n ...developHelperV2,\n getContextValue(name, { tplStateStoreId }) {\n return developHelperV2.getContextValue(name, {\n tplContextId: tplStateStoreId,\n } as any);\n },\n getAllContextValues({ tplStateStoreId }) {\n // V3 returns an object of key-value.\n // While v2 returns a map of ContextItem.\n const v2Map = developHelperV2.getAllContextValues({\n tplContextId: tplStateStoreId,\n } as any) as unknown as Map<string, { value: unknown }>;\n return Object.fromEntries(\n [...v2Map].map(([k, v]) => [k, (v as any).value])\n );\n },\n };\n isV2 = true;\n }\n} catch (e) {\n // eslint-disable-next-line no-console\n console.error(\"Try to use v2 runtime APIs failed:\", e);\n}\n\nlet contentScrollElement: Element | null = null;\nlet contentScrollHost: Element | null = null;\n\nexport default async function connect(\n previewFromOrigin: string,\n options: PreviewStartOptions\n) {\n if (connected) {\n return;\n }\n connected = true;\n\n const sendMessage = <T extends PreviewMessageFromPreviewer>(\n message: Omit<T, \"sender\">\n ): void => {\n window.parent.postMessage(\n {\n sender: \"previewer\",\n ...message,\n },\n previewFromOrigin\n );\n };\n\n sendMessage({ type: \"preview-started\" });\n setPreviewFromOrigin(previewFromOrigin);\n\n let hoverIid: string;\n let hoverAlias: string;\n let activeIid: string;\n let activeAlias: string;\n\n const handleHoverOnIframe = (pos: Position): void => {\n const element = document.elementFromPoint(pos.x, pos.y);\n if (element?.tagName === \"BODY\") {\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"hover-on-main\",\n isDirection: true,\n position: {\n x: pos.x,\n y: pos.y,\n },\n } as PreviewMessagePreviewerHoverOnMain,\n previewProxyOrigin\n );\n } else {\n const iidList = getPossibleBrickIidList(element as HTMLElement);\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"hover-on-brick\",\n iidList,\n isDirection: true,\n position: {\n x: pos.x,\n y: pos.y,\n },\n },\n previewProxyOrigin\n );\n }\n };\n\n const sendHighlightBrickOutlines = (\n type: \"hover\" | \"active\",\n iid: string,\n alias: string\n ): void => {\n const outlines = getBrickOutlines(iid);\n sendMessage<PreviewMessagePreviewerHighlightBrick>({\n type: \"highlight-brick\",\n highlightType: type,\n outlines,\n iid: iid,\n alias: alias,\n });\n };\n\n const sendHighlightBricksOutlines = (nodes: HighLightNode[]): void => {\n const outlines = nodes\n .map((node) => getBrickOutlines(node.iid, node.alias))\n .flat();\n sendMessage<PreviewMessagePreviewerHighlightContext>({\n type: \"highlight-context\",\n outlines,\n });\n };\n\n let lastTemplatePreviewSettings: PreviewSettings | undefined;\n if (options.templateId) {\n lastTemplatePreviewSettings = options.settings;\n }\n\n const updateTemplatePreviewSettings = (): void => {\n __secret_internals.updateTemplatePreviewSettings(\n options.appId,\n options.templateId!,\n lastTemplatePreviewSettings\n );\n getHistory().reload();\n };\n\n const updateSnippetPreviewSettings = (): void => {\n __secret_internals.updateSnippetPreviewSettings(\n options.appId,\n JSON.parse(options.snippetData)\n );\n getHistory().reload();\n };\n\n /* const updateFormPreviewSettings = (): void => {\n __secret_internals.updateFormPreviewSettings(\n options.appId,\n options.formId,\n options.formData\n );\n getHistory().reload();\n }; */\n\n const handlePreviewData = (name: string, option: PreviewDataOption): void => {\n try {\n const { dataType } = option;\n let tplStateStoreId;\n const datasetKey = isV2 ? \"tplContextId\" : \"tplStateStoreId\";\n\n if (dataType === \"state\") {\n const mainMountPoint = document.querySelector(\"#main-mount-point\")!;\n\n tplStateStoreId = (mainMountPoint.firstChild as HTMLElement).dataset[\n datasetKey\n ];\n\n if (!tplStateStoreId) {\n sendMessage<PreviewMessagePreviewDataValueError>({\n type: \"inspect-data-value-error\",\n data: {\n error: {\n message:\n \"tplStateStoreId not found, unable to preview STATE value\",\n },\n },\n });\n\n return;\n }\n }\n\n let value, type: PreviewMessagePreviewDataValueSuccess[\"type\"];\n if (name) {\n type = \"inspect-single-data-value-success\";\n value = __secret_internals.getContextValue(name, {\n tplStateStoreId,\n });\n } else {\n type = \"inspect-all-data-values-success\";\n const data = __secret_internals.getAllContextValues({\n tplStateStoreId,\n });\n value = Object.entries(data).map(([name, value]) => ({ name, value }));\n }\n\n sendMessage<PreviewMessagePreviewDataValueSuccess>({\n type,\n data: {\n name,\n value,\n },\n });\n\n // istanbul ignore next\n } catch (error) {\n sendMessage<PreviewMessagePreviewDataValueError>({\n type: \"inspect-data-value-error\",\n data: {\n message: (error as Error).message,\n },\n });\n }\n };\n\n const history = getHistory();\n\n window.addEventListener(\n \"message\",\n async ({ data, origin }: MessageEvent<PreviewMessageToPreviewer>) => {\n if (\n origin !== previewFromOrigin ||\n !data ||\n data.sender !== \"preview-container\"\n ) {\n return;\n }\n if (data.forwardedFor === \"builder\") {\n switch (data.type) {\n case \"hover-on-brick\":\n hoverIid = data.iid;\n hoverAlias = data.alias;\n sendHighlightBrickOutlines(\"hover\", data.iid, data.alias);\n break;\n case \"hover-on-main\":\n sendHighlightBrickOutlines(\"hover\", \"#main-mount-point\", \"root\");\n break;\n case \"hover-on-context\":\n sendHighlightBricksOutlines(data.highlightNodes);\n break;\n case \"select-brick\":\n activeIid = data.iid;\n activeAlias = data.alias;\n sendHighlightBrickOutlines(\"active\", data.iid, data.alias);\n break;\n case \"hover-on-iframe\":\n handleHoverOnIframe(data.position);\n break;\n }\n } else\n switch (data.type) {\n case \"toggle-inspecting\":\n data.enabled ? startInspecting() : stopInspecting();\n break;\n case \"refresh\":\n if (data.options?.updateStoryboardType) {\n if (data.options.updateStoryboardType === \"route\") {\n __secret_internals.updateStoryboardByRoute(\n options.appId,\n data.storyboardPatch as RouteConf\n );\n } else if (data.options.updateStoryboardType === \"template\") {\n __secret_internals.updateStoryboardByTemplate(\n options.appId,\n data.storyboardPatch as CustomTemplate,\n data.options.settings\n );\n } else if (data.options.updateStoryboardType === \"snippet\") {\n __secret_internals.updateStoryboardBySnippet(\n options.appId,\n data.storyboardPatch as {\n snippetId: string;\n bricks: BrickConf[];\n }\n );\n } /* else if (data.options.updateStoryboardType === \"form\") {\n __secret_internals.updateFormPreviewSettings(\n options.appId,\n options.formId,\n data.storyboardPatch as FormDataProperties\n );\n } */\n\n const newContracts = await (\n __secret_internals as any\n ).getAddedContracts?.(data.storyboardPatch, {\n appId: options.appId,\n updateStoryboardType: data.options.updateStoryboardType,\n formId: options.formId,\n collectUsedContracts,\n });\n\n if (!isEmpty(newContracts)) {\n sendMessage<PreviewMessagePreviewContractUpdate>({\n type: \"contract-update\",\n data: {\n add: newContracts,\n },\n });\n } else {\n getHistory().reload();\n }\n\n break;\n }\n __secret_internals.updateStoryboard(\n options.appId,\n data.storyboardPatch\n );\n if (options.templateId) {\n lastTemplatePreviewSettings = data.settings;\n updateTemplatePreviewSettings();\n } /* else if (options.formId || options.formData) {\n updateFormPreviewSettings();\n } */ else if (data.options?.snippetData) {\n options.snippetData = data.options.snippetData;\n updateSnippetPreviewSettings();\n } else {\n getHistory().reload();\n }\n break;\n case \"reload\":\n location.reload();\n break;\n case \"back\":\n history.goBack();\n break;\n case \"forward\":\n history.goForward();\n break;\n case \"capture\":\n capture(data.maxWidth, data.maxHeight).then(\n (screenshot) => {\n sendMessage<PreviewMessagePreviewerCaptureOk>({\n type: \"capture-ok\",\n screenshot,\n });\n },\n () => {\n sendMessage<PreviewMessagePreviewerCaptureFailed>({\n type: \"capture-failed\",\n });\n }\n );\n break;\n case \"inspect-data-value\":\n handlePreviewData(data.name, data.option);\n break;\n case \"update-preview-url\": {\n // Remove origin first.\n const url = data.previewUrl.startsWith(window.origin)\n ? data.previewUrl.substring(window.origin.length)\n : data.previewUrl;\n // Then remove base path.\n const basePath = getBasePath();\n const to = url.startsWith(basePath)\n ? url.substring(basePath.length - 1)\n : url;\n getHistory().push(to);\n break;\n }\n case \"update-preview-route\": {\n options.routePath = data.routePath;\n options.routeExact = data.routeExact;\n syncRouteMatch();\n break;\n }\n /* case \"excute-proxy-method\": {\n const [ref, method, args = []] = data.proxyMethodArgs;\n try {\n const result = document.body.querySelector(ref)[method](...args);\n window.parent.postMessage({\n sender: \"previewer\",\n type: \"excute-proxy-method-success\",\n data: { method: method, res: result },\n });\n } catch (err) {\n window.parent.postMessage({\n sender: \"previewer\",\n type: \"excute-proxy-method-error\",\n data: { method: method, res: err.message },\n });\n }\n break;\n } */\n }\n }\n );\n\n window.addEventListener(\"scroll\", () => {\n sendMessage<PreviewMessagePreviewerScroll>({\n type: \"scroll\",\n scroll: {\n x: window.scrollX,\n y: window.scrollY,\n },\n });\n });\n\n let previewPageMatch = true;\n let currentLocation: NextLocation;\n const sendLocationChange = (loc: NextLocation): void => {\n sendMessage<PreviewMessagePreviewerUrlChange>({\n type: \"url-change\",\n url: location.origin + history.createHref(loc),\n });\n currentLocation = loc;\n syncRouteMatch();\n };\n\n function syncRouteMatch() {\n if (options.routePath) {\n const match = !!matchPath(currentLocation.pathname, {\n path: options.routePath,\n exact: options.routeExact,\n });\n sendMessage<PreviewMessagePreviewerRouteMatchChange>({\n type: \"route-match-change\",\n match,\n });\n\n // Re-update template preview settings once match route again (typically after login).\n if (options.templateId && !previewPageMatch && match) {\n const mainMountPoint = document.querySelector(\"#main-mount-point\")!;\n const placeholderLoadObserver = new MutationObserver(() => {\n // We observe when the placeholder is appeared.\n if (\n mainMountPoint.childNodes.length === 1 &&\n (mainMountPoint.firstChild as HTMLElement).tagName === \"SPAN\" &&\n mainMountPoint.firstChild!.childNodes.length === 0\n ) {\n updateTemplatePreviewSettings();\n placeholderLoadObserver.disconnect();\n }\n });\n placeholderLoadObserver.observe(mainMountPoint, { childList: true });\n }\n /* if (options.formId && !previewPageMatch && match) {\n const mainMountPoint = document.querySelector(\"#main-mount-point\");\n const placeholderLoadObserver = new MutationObserver(() => {\n // We observe when the placeholder is appeared.\n if (\n mainMountPoint.childNodes.length === 1 &&\n (mainMountPoint.firstChild as HTMLElement).tagName === \"SPAN\" &&\n mainMountPoint.firstChild.childNodes.length === 0\n ) {\n updateFormPreviewSettings();\n placeholderLoadObserver.disconnect();\n }\n });\n placeholderLoadObserver.observe(mainMountPoint, { childList: true });\n } */\n if (options.snippetData && !previewPageMatch && match) {\n const mainMountPoint = document.querySelector(\"#main-mount-point\")!;\n const placeholderLoadObserver = new MutationObserver(() => {\n // We observe when the placeholder is appeared.\n if (\n mainMountPoint.childNodes.length === 1 &&\n (mainMountPoint.firstChild as HTMLElement).tagName === \"SPAN\" &&\n mainMountPoint.firstChild!.childNodes.length === 0\n ) {\n updateSnippetPreviewSettings();\n placeholderLoadObserver.disconnect();\n }\n });\n placeholderLoadObserver.observe(mainMountPoint, { childList: true });\n }\n previewPageMatch = match;\n }\n }\n\n sendLocationChange(history.location);\n\n history.listen(sendLocationChange);\n\n if (options.templateId) {\n updateTemplatePreviewSettings();\n }\n\n /* if (options.formId || options.formData) {\n updateFormPreviewSettings();\n } */\n\n if (options.snippetData) {\n updateSnippetPreviewSettings();\n }\n\n function setupContentScroll() {\n const host = document.querySelector(\"eo-page-view\");\n const element = host?.shadowRoot?.querySelector(\".content\") ?? null;\n if (element !== contentScrollElement) {\n contentScrollElement?.removeEventListener(\"scroll\", onContentScroll);\n element?.addEventListener(\"scroll\", onContentScroll);\n contentScrollElement = element;\n contentScrollHost = host;\n }\n }\n\n function onContentScroll(this: Element) {\n sendMessage<PreviewMessagePreviewerContentScroll>({\n type: \"content-scroll\",\n scroll: {\n x: this.scrollLeft,\n y: this.scrollTop,\n },\n });\n }\n\n setupContentScroll();\n\n const mutationCallback = (): void => {\n setupContentScroll();\n if (hoverIid) {\n sendHighlightBrickOutlines(\"hover\", hoverIid, hoverAlias);\n }\n if (activeIid) {\n sendHighlightBrickOutlines(\"active\", activeIid, activeAlias);\n }\n };\n const mutationObserver = new MutationObserver(\n throttle(mutationCallback, 100, { leading: false })\n );\n mutationObserver.observe(document.body, { subtree: true, childList: true });\n}\n\nfunction getBrickOutlines(iid: string, alias?: string): BrickOutline[] {\n if (!iid) {\n return [];\n }\n const isRoot = iid.includes(\"#\");\n const elements = document.querySelectorAll<HTMLElement>(\n isRoot ? iid : `[data-iid=\"${iid}\"]`\n );\n const outlines = getOutlines(elements, alias);\n return isRoot\n ? outlines.map((item) => ({\n ...item,\n height: window.innerHeight - item.top,\n }))\n : outlines;\n}\n\nfunction getOutlines(\n elements: NodeListOf<HTMLElement>,\n alias?: string\n): BrickOutline[] {\n return [...elements].map((element) => {\n const hasContentScroll = contentScrollHost?.contains(element);\n const { width, height, left, top } = element.getBoundingClientRect();\n return {\n width,\n height,\n left:\n left +\n window.scrollX +\n (hasContentScroll ? contentScrollElement.scrollLeft : 0),\n top:\n top +\n window.scrollY +\n (hasContentScroll ? contentScrollElement.scrollTop : 0),\n alias,\n hasContentScroll,\n };\n });\n}\n"],"names":["collectUsedContracts","storyboard","collection","nodeOrNodes","Set","traverse","node","type","_node$raw","useProvider","raw","add","collect","parseStoryboard","contracts","item","includes","push","customElements","define","createProviderClass","previewProxyOrigin","html2canvas","_html2canvas","_capture","_asyncToGenerator","maxWidth","maxHeight","canvas","sourceCanvas","document","body","logging","scale","width","window","innerWidth","height","innerHeight","foreignObjectRendering","targetCanvas","createElement","targetRatio","ratio","wider","finalWidth","finalHeight","getContext","drawImage","toDataURL","resizeScreenshot","Promise","resolve","reject","toBlob","blob","apply","arguments","onClick","event","iidList","preventDefault","stopPropagation","getPossibleBrickIidList","target","length","parent","postMessage","sender","onMouseEvent","hoverOnBrick","throttle","e","leading","onPointerDown","onPointerOver","onPointerLeave","onContextMenu","brick","position","x","clientX","y","clientY","cursor","dataset","iid","parentElement","connected","getHistory","_getHistory","matchPath","_matchPath","__secret_internals","_internals","isV2","_window$BRICK_NEXT_VE","dll","BRICK_NEXT_VERSIONS","startsWith","getHistoryV2","developHelper","developHelperV2","matchPathV2","_objectSpread","getContextValue","name","_ref","tplStateStoreId","tplContextId","getAllContextValues","_ref2","v2Map","Object","fromEntries","map","_ref3","k","v","value","console","error","contentScrollElement","contentScrollHost","connect","_x","_x2","_connect","previewFromOrigin","options","hoverIid","hoverAlias","activeIid","activeAlias","sendMessage","message","lastTemplatePreviewSettings","sendHighlightBrickOutlines","alias","outlines","getBrickOutlines","highlightType","templateId","settings","updateTemplatePreviewSettings","appId","reload","updateSnippetPreviewSettings","JSON","parse","snippetData","history","addEventListener","_ref6","_ref5","_data$options","_data$options2","data","origin","forwardedFor","highlightNodes","flat","pos","element","elementFromPoint","tagName","isDirection","handleHoverOnIframe","enabled","removeEventListener","updateStoryboardType","_getAddedContracts","_ref7","updateStoryboardByRoute","storyboardPatch","updateStoryboardByTemplate","updateStoryboardBySnippet","newContracts","getAddedContracts","call","formId","isEmpty","updateStoryboard","location","goBack","goForward","capture","then","screenshot","handlePreviewData","option","dataType","datasetKey","querySelector","firstChild","entries","_ref4","url","previewUrl","substring","basePath","getBasePath","to","routePath","routeExact","syncRouteMatch","_x3","scroll","scrollX","scrollY","currentLocation","previewPageMatch","sendLocationChange","loc","createHref","listen","setupContentScroll","MutationObserver","mutationCallback","observe","subtree","childList","match","pathname","path","exact","mainMountPoint","placeholderLoadObserver","childNodes","disconnect","_host$shadowRoot$quer","_host$shadowRoot","_contentScrollElement","host","shadowRoot","onContentScroll","this","scrollLeft","scrollTop","isRoot","elements","_contentScrollHost","hasContentScroll","contains","left","top","getBoundingClientRect","getOutlines","querySelectorAll","concat"],"sourceRoot":""}
1
+ {"version":3,"file":"chunks/206.3ccda763.js","mappings":"2LAgCO,SAASA,EAAqBC,GACnC,IAAMC,EArBR,SAAiBC,GACf,IAAMD,EAAa,IAAIE,IAgBvB,OAdAC,EAAAA,EAAAA,GAASF,GAAcG,IACrB,OAAQA,EAAKC,MACX,IAAK,aACL,IAAK,eAAgB,IAAAC,EACbC,EACI,QADOD,EACfF,EAAKI,WAAG,IAAAF,OAAA,EADUA,EAEjBC,YACCA,GACFP,EAAWS,IAAIF,GAGrB,IAGKP,CACT,CAGqBU,EAAQC,EAAAA,EAAAA,IAAgBZ,IAErCa,EAAY,GAElB,IAAK,IAAMC,KAAQb,EACba,EAAKC,SAAS,MAChBF,EAAUG,KAAKF,GAInB,OAAOD,CACT,CAEAI,eAAeC,OACb,yCACAC,EAAAA,EAAAA,qBAAoBpB,G,qCCvCXqB,E,kDCJLC,E,MAAcC,GA6BnB,SAAAC,IAAA,OAAAA,GAAAC,EAAAA,EAAAA,IAf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ACN/H,EAAG4J,KAAKC,WACR3J,EAAG0J,KAAKE,YAGd,CAiBF,IAAC/G,EAAAvE,MAAA,KAAAC,UAAA,CAED,SAASmF,EAAiBtD,EAAaoD,GACrC,IAAKpD,EACH,MAAO,GAET,IAAMyJ,EAASzJ,EAAItE,SAAS,KAItB2H,EASR,SACEqG,EACAtG,GAEA,MAAO,IAAIsG,GAAU7H,KAAKgD,IAAY,IAAA8E,EAC9BC,EAAoC,QAApBD,EAAGtH,SAAiB,IAAAsH,OAAA,EAAjBA,EAAmBE,SAAShF,IAC/C,MAAEjI,EAAK,OAAEG,EAAM,KAAE+M,EAAI,IAAEC,GAAQlF,EAAQmF,wBAC7C,MAAO,CACLpN,QACAG,SACA+M,KACEA,EACAjN,OAAO6K,SACNkC,EAAmBxH,EAAqBmH,WAAa,GACxDQ,IACEA,EACAlN,OAAO8K,SACNiC,EAAmBxH,EAAqBoH,UAAY,GACvDpG,QACAwG,mBACD,GAEL,CA/BmBK,CAHAzN,SAAS0N,iBACxBT,EAASzJ,EAAM,cAAHmK,OAAiBnK,EAAG,OAEKoD,GACvC,OAAOqG,EACHpG,EAASxB,KAAKpG,IAAIyF,EAAAA,EAAAA,IAAAA,EAAAA,EAAAA,GAAA,GACbzF,GAAI,IACPsB,OAAQF,OAAOG,YAAcvB,EAAKsO,QAEpC1G,CACN,C","sources":["webpack:///./src/data-providers/collect-used-contracts.ts","webpack:///./src/data-providers/preview/inspector.ts","webpack:///./src/data-providers/preview/capture.ts","webpack:///./src/data-providers/preview/resizeScreenshot.ts","webpack:///./src/data-providers/preview/connect.ts"],"sourcesContent":["import { createProviderClass } from \"@next-core/utils/general\";\nimport {\n type StoryboardNode,\n parseStoryboard,\n traverse,\n} from \"@next-core/storyboard\";\nimport {\n Storyboard,\n UseProviderResolveConf,\n UseProviderEventHandler,\n} from \"@next-core/types\";\n\nfunction collect(nodeOrNodes: StoryboardNode | StoryboardNode[]): Set<string> {\n const collection = new Set<string>();\n\n traverse(nodeOrNodes, (node) => {\n switch (node.type) {\n case \"Resolvable\":\n case \"EventHandler\": {\n const useProvider = (\n node.raw as UseProviderResolveConf | UseProviderEventHandler\n )?.useProvider;\n if (useProvider) {\n collection.add(useProvider);\n }\n }\n }\n });\n\n return collection;\n}\n\nexport function collectUsedContracts(storyboard: Storyboard): string[] {\n const collection = collect(parseStoryboard(storyboard as any));\n\n const contracts = [];\n\n for (const item of collection) {\n if (item.includes(\"@\")) {\n contracts.push(item);\n }\n }\n\n return contracts;\n}\n\ncustomElements.define(\n \"visual-builder.collect-used-contracts\",\n createProviderClass(collectUsedContracts)\n);\n","// istanbul ignore file: working in progress\n// https://github.com/facebook/react/blob/cae635054e17a6f107a39d328649137b83f25972/packages/react-devtools-shared/src/backend/views/Highlighter/index.js\nimport { throttle } from \"lodash\";\nimport type {\n PreviewMessagePreviewerHoverOnBrick,\n PreviewMessagePreviewerSelectBrick,\n PreviewMessagePreviewerContextMenuOnBrick,\n} from \"./interfaces.js\";\n\nexport let previewProxyOrigin: string;\n\nexport function setPreviewFromOrigin(origin: string): void {\n previewProxyOrigin = origin;\n}\n\nexport function startInspecting(): void {\n registerListeners();\n}\n\nexport function stopInspecting(): void {\n unregisterListeners();\n}\n\nfunction registerListeners(): void {\n window.addEventListener(\"click\", onClick, true);\n window.addEventListener(\"mousedown\", onMouseEvent, true);\n window.addEventListener(\"mouseover\", onMouseEvent, true);\n window.addEventListener(\"mouseup\", onMouseEvent, true);\n window.addEventListener(\"pointerdown\", onPointerDown, true);\n window.addEventListener(\"pointerover\", onPointerOver, true);\n window.addEventListener(\"pointerup\", onMouseEvent, true);\n window.addEventListener(\"pointerleave\", onPointerLeave, true);\n window.addEventListener(\"contextmenu\", onContextMenu, true);\n}\n\nfunction unregisterListeners(): void {\n window.removeEventListener(\"click\", onClick, true);\n window.removeEventListener(\"mousedown\", onMouseEvent, true);\n window.removeEventListener(\"mouseover\", onMouseEvent, true);\n window.removeEventListener(\"mouseup\", onMouseEvent, true);\n window.removeEventListener(\"pointerdown\", onPointerDown, true);\n window.removeEventListener(\"pointerover\", onPointerOver, true);\n window.removeEventListener(\"pointerup\", onMouseEvent, true);\n window.removeEventListener(\"pointerleave\", onPointerLeave, true);\n window.removeEventListener(\"contextmenu\", onContextMenu, true);\n}\n\nfunction onClick(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n selectBrick(event.target as HTMLElement);\n}\n\nfunction onMouseEvent(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n}\n\nconst hoverOnBrick = throttle(\n (e: MouseEvent) => {\n const brick = e.target as HTMLElement;\n const iidList = getPossibleBrickIidList(brick);\n if (iidList.length > 0) {\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"hover-on-brick\",\n iidList,\n } as PreviewMessagePreviewerHoverOnBrick,\n previewProxyOrigin\n );\n }\n },\n 100,\n { leading: false }\n);\n\nfunction onPointerDown(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n hoverOnBrick(event);\n}\n\nfunction onPointerOver(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n hoverOnBrick(event);\n}\n\nfunction onPointerLeave(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"hover-on-brick\",\n iidList: [],\n } as PreviewMessagePreviewerHoverOnBrick,\n previewProxyOrigin\n );\n}\n\nfunction onContextMenu(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n contextMenuOnBrick(event.target as HTMLElement, {\n x: event.clientX,\n y: event.clientY,\n });\n}\n\nfunction contextMenuOnBrick(\n brick: HTMLElement,\n position: {\n x: number;\n y: number;\n }\n): void {\n const iidList = getPossibleBrickIidList(brick);\n if (iidList.length > 0) {\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"context-menu-on-brick\",\n iidList,\n position,\n } as PreviewMessagePreviewerContextMenuOnBrick,\n previewProxyOrigin\n );\n }\n}\n\nfunction selectBrick(brick: HTMLElement): void {\n const iidList = getPossibleBrickIidList(brick);\n if (iidList.length > 0) {\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"select-brick\",\n iidList,\n } as PreviewMessagePreviewerSelectBrick,\n previewProxyOrigin\n );\n }\n}\n\nexport function getPossibleBrickIidList(brick: HTMLElement): string[] {\n const iidList: string[] = [];\n // Traverse from bottom to up, to find bricks current hover on.\n let cursor: HTMLElement | null = brick;\n while (cursor) {\n if (typeof cursor.dataset.iid === \"string\") {\n iidList.push(cursor.dataset.iid);\n }\n cursor = cursor.parentElement;\n }\n return iidList;\n}\n","// istanbul ignore file: nothing logical except calling html2canvas.\nimport _html2canvas from \"html2canvas\";\nimport { resizeScreenshot } from \"./resizeScreenshot.js\";\n\n// There is a type issue like i18next\nconst html2canvas = _html2canvas as unknown as typeof _html2canvas.default;\n\nfunction getCanvasBlob(canvas: HTMLCanvasElement): Promise<Blob> {\n return new Promise(function (resolve, reject) {\n canvas.toBlob(function (blob: Blob | null) {\n if (blob) {\n resolve(blob);\n } else {\n reject();\n }\n });\n });\n}\n\nexport async function capture(\n maxWidth: number,\n maxHeight: number\n): Promise<Blob> {\n const sourceCanvas = await html2canvas(document.body, {\n logging: false,\n scale: 1,\n width: window.innerWidth,\n height: window.innerHeight,\n foreignObjectRendering: true,\n });\n const targetCanvas = document.createElement(\"canvas\");\n resizeScreenshot(sourceCanvas, targetCanvas, maxWidth, maxHeight);\n const blob = await getCanvasBlob(targetCanvas);\n return blob;\n}\n","export function resizeScreenshot(\n canvas: HTMLCanvasElement,\n targetCanvas: HTMLCanvasElement,\n maxWidth: number,\n maxHeight: number\n): string {\n const targetRatio = maxWidth / maxHeight;\n const { width, height } = canvas;\n const ratio = width / height;\n const wider = ratio >= targetRatio;\n const finalWidth = wider ? maxWidth : maxHeight * ratio;\n const finalHeight = wider ? maxWidth / ratio : maxHeight;\n targetCanvas.width = finalWidth;\n targetCanvas.height = finalHeight;\n\n const ctx = targetCanvas.getContext(\"2d\")!;\n ctx.drawImage(canvas, 0, 0, width, height, 0, 0, finalWidth, finalHeight);\n return targetCanvas.toDataURL();\n}\n","import {\n getHistory as _getHistory,\n getBasePath,\n matchPath as _matchPath,\n __secret_internals as _internals,\n type NextLocation,\n} from \"@next-core/runtime\";\nimport type { BrickConf, CustomTemplate, RouteConf } from \"@next-core/types\";\nimport { isEmpty, throttle } from \"lodash\";\nimport type {\n BrickOutline,\n HighLightNode,\n Position,\n PreviewDataOption,\n PreviewMessageFromPreviewer,\n PreviewMessagePreviewContractUpdate,\n PreviewMessagePreviewDataValueError,\n PreviewMessagePreviewDataValueSuccess,\n PreviewMessagePreviewerCaptureFailed,\n PreviewMessagePreviewerCaptureOk,\n PreviewMessagePreviewerContentScroll,\n PreviewMessagePreviewerHighlightBrick,\n PreviewMessagePreviewerHighlightContext,\n PreviewMessagePreviewerHoverOnMain,\n PreviewMessagePreviewerRouteMatchChange,\n PreviewMessagePreviewerScroll,\n PreviewMessagePreviewerUrlChange,\n PreviewMessageToPreviewer,\n PreviewSettings,\n PreviewStartOptions,\n} from \"./interfaces.js\";\nimport { capture } from \"./capture.js\";\nimport {\n previewProxyOrigin,\n getPossibleBrickIidList,\n setPreviewFromOrigin,\n startInspecting,\n stopInspecting,\n} from \"./inspector.js\";\nimport { collectUsedContracts } from \"../collect-used-contracts.js\";\n\nlet connected = false;\n\ninterface DLL {\n (moduleId: \"tYg3\"): {\n getHistory: typeof _getHistory;\n developHelper: typeof _internals;\n };\n (moduleId: \"A+yw\"): {\n matchPath: typeof _matchPath;\n };\n}\n\nlet getHistory = _getHistory;\nlet matchPath = _matchPath;\nlet __secret_internals = _internals;\nlet isV2 = false;\n\n// istanbul ignore next\n// Make v3 bricks compatible with Brick Next v2.\ntry {\n const dll = (window as unknown as { dll?: DLL }).dll;\n if (\n dll &&\n window.BRICK_NEXT_VERSIONS?.[\"brick-container\"]?.startsWith(\"2.\")\n ) {\n const { getHistory: getHistoryV2, developHelper: developHelperV2 } =\n dll(\"tYg3\");\n const { matchPath: matchPathV2 } = dll(\"A+yw\");\n getHistory = getHistoryV2;\n matchPath = matchPathV2;\n // The `__secret_internals` of v3 has pretty the same API as\n // `developHelper` of v2, especially those for preview usage.\n __secret_internals = {\n ...developHelperV2,\n getContextValue(name, { tplStateStoreId }) {\n return developHelperV2.getContextValue(name, {\n tplContextId: tplStateStoreId,\n } as any);\n },\n getAllContextValues({ tplStateStoreId }) {\n // V3 returns an object of key-value.\n // While v2 returns a map of ContextItem.\n const v2Map = developHelperV2.getAllContextValues({\n tplContextId: tplStateStoreId,\n } as any) as unknown as Map<string, { value: unknown }>;\n return Object.fromEntries(\n [...v2Map].map(([k, v]) => [k, (v as any).value])\n );\n },\n };\n isV2 = true;\n }\n} catch (e) {\n // eslint-disable-next-line no-console\n console.error(\"Try to use v2 runtime APIs failed:\", e);\n}\n\nlet contentScrollElement: Element | null = null;\nlet contentScrollHost: Element | null = null;\n\nexport default async function connect(\n previewFromOrigin: string,\n options: PreviewStartOptions\n) {\n if (connected) {\n return;\n }\n connected = true;\n\n const sendMessage = <T extends PreviewMessageFromPreviewer>(\n message: Omit<T, \"sender\">\n ): void => {\n window.parent.postMessage(\n {\n sender: \"previewer\",\n ...message,\n },\n previewFromOrigin\n );\n };\n\n sendMessage({ type: \"preview-started\" });\n setPreviewFromOrigin(previewFromOrigin);\n\n let hoverIid: string;\n let hoverAlias: string;\n let activeIid: string;\n let activeAlias: string;\n\n const handleHoverOnIframe = (pos: Position): void => {\n const element = document.elementFromPoint(pos.x, pos.y);\n if (element?.tagName === \"BODY\") {\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"hover-on-main\",\n isDirection: true,\n position: {\n x: pos.x,\n y: pos.y,\n },\n } as PreviewMessagePreviewerHoverOnMain,\n previewProxyOrigin\n );\n } else {\n const iidList = getPossibleBrickIidList(element as HTMLElement);\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"hover-on-brick\",\n iidList,\n isDirection: true,\n position: {\n x: pos.x,\n y: pos.y,\n },\n },\n previewProxyOrigin\n );\n }\n };\n\n const sendHighlightBrickOutlines = (\n type: \"hover\" | \"active\",\n iid: string,\n alias: string\n ): void => {\n const outlines = getBrickOutlines(iid);\n sendMessage<PreviewMessagePreviewerHighlightBrick>({\n type: \"highlight-brick\",\n highlightType: type,\n outlines,\n iid: iid,\n alias: alias,\n });\n };\n\n const sendHighlightBricksOutlines = (nodes: HighLightNode[]): void => {\n const outlines = nodes\n .map((node) => getBrickOutlines(node.iid, node.alias))\n .flat();\n sendMessage<PreviewMessagePreviewerHighlightContext>({\n type: \"highlight-context\",\n outlines,\n });\n };\n\n let lastTemplatePreviewSettings: PreviewSettings | undefined;\n if (options.templateId) {\n lastTemplatePreviewSettings = options.settings;\n }\n\n const updateTemplatePreviewSettings = (): void => {\n __secret_internals.updateTemplatePreviewSettings(\n options.appId,\n options.templateId!,\n lastTemplatePreviewSettings\n );\n getHistory().reload();\n };\n\n const updateSnippetPreviewSettings = (): void => {\n __secret_internals.updateSnippetPreviewSettings(\n options.appId,\n JSON.parse(options.snippetData)\n );\n getHistory().reload();\n };\n\n /* const updateFormPreviewSettings = (): void => {\n __secret_internals.updateFormPreviewSettings(\n options.appId,\n options.formId,\n options.formData\n );\n getHistory().reload();\n }; */\n\n const handlePreviewData = (name: string, option: PreviewDataOption): void => {\n try {\n const { dataType } = option;\n let tplStateStoreId;\n const datasetKey = isV2 ? \"tplContextId\" : \"tplStateStoreId\";\n\n if (dataType === \"state\") {\n const mainMountPoint = document.querySelector(\"#main-mount-point\")!;\n\n tplStateStoreId = (mainMountPoint.firstChild as HTMLElement).dataset[\n datasetKey\n ];\n\n if (!tplStateStoreId) {\n sendMessage<PreviewMessagePreviewDataValueError>({\n type: \"inspect-data-value-error\",\n data: {\n error: {\n message:\n \"tplStateStoreId not found, unable to preview STATE value\",\n },\n },\n });\n\n return;\n }\n }\n\n let value, type: PreviewMessagePreviewDataValueSuccess[\"type\"];\n if (name) {\n type = \"inspect-single-data-value-success\";\n value = __secret_internals.getContextValue(name, {\n tplStateStoreId,\n });\n } else {\n type = \"inspect-all-data-values-success\";\n const data = __secret_internals.getAllContextValues({\n tplStateStoreId,\n });\n value = Object.entries(data).map(([name, value]) => ({ name, value }));\n }\n\n sendMessage<PreviewMessagePreviewDataValueSuccess>({\n type,\n data: {\n name,\n value,\n },\n });\n\n // istanbul ignore next\n } catch (error) {\n sendMessage<PreviewMessagePreviewDataValueError>({\n type: \"inspect-data-value-error\",\n data: {\n message: (error as Error).message,\n },\n });\n }\n };\n\n const history = getHistory();\n\n window.addEventListener(\n \"message\",\n async ({ data, origin }: MessageEvent<PreviewMessageToPreviewer>) => {\n if (\n origin !== previewFromOrigin ||\n !data ||\n data.sender !== \"preview-container\"\n ) {\n return;\n }\n if (data.forwardedFor === \"builder\") {\n switch (data.type) {\n case \"hover-on-brick\":\n hoverIid = data.iid;\n hoverAlias = data.alias;\n sendHighlightBrickOutlines(\"hover\", data.iid, data.alias);\n break;\n case \"hover-on-main\":\n sendHighlightBrickOutlines(\"hover\", \"#main-mount-point\", \"root\");\n break;\n case \"hover-on-context\":\n sendHighlightBricksOutlines(data.highlightNodes);\n break;\n case \"select-brick\":\n activeIid = data.iid;\n activeAlias = data.alias;\n sendHighlightBrickOutlines(\"active\", data.iid, data.alias);\n break;\n case \"hover-on-iframe\":\n handleHoverOnIframe(data.position);\n break;\n }\n } else\n switch (data.type) {\n case \"toggle-inspecting\":\n data.enabled ? startInspecting() : stopInspecting();\n break;\n case \"refresh\":\n if (data.options?.updateStoryboardType) {\n if (data.options.updateStoryboardType === \"route\") {\n __secret_internals.updateStoryboardByRoute(\n options.appId,\n data.storyboardPatch as RouteConf\n );\n } else if (data.options.updateStoryboardType === \"template\") {\n __secret_internals.updateStoryboardByTemplate(\n options.appId,\n data.storyboardPatch as CustomTemplate,\n data.options.settings\n );\n } else if (data.options.updateStoryboardType === \"snippet\") {\n __secret_internals.updateStoryboardBySnippet(\n options.appId,\n data.storyboardPatch as {\n snippetId: string;\n bricks: BrickConf[];\n }\n );\n } /* else if (data.options.updateStoryboardType === \"form\") {\n __secret_internals.updateFormPreviewSettings(\n options.appId,\n options.formId,\n data.storyboardPatch as FormDataProperties\n );\n } */\n\n const newContracts = await (\n __secret_internals as any\n ).getAddedContracts?.(data.storyboardPatch, {\n appId: options.appId,\n updateStoryboardType: data.options.updateStoryboardType,\n formId: options.formId,\n collectUsedContracts,\n });\n\n if (!isEmpty(newContracts)) {\n sendMessage<PreviewMessagePreviewContractUpdate>({\n type: \"contract-update\",\n data: {\n add: newContracts,\n },\n });\n } else {\n getHistory().reload();\n }\n\n break;\n }\n __secret_internals.updateStoryboard(\n options.appId,\n data.storyboardPatch\n );\n if (options.templateId) {\n lastTemplatePreviewSettings = data.settings;\n updateTemplatePreviewSettings();\n } /* else if (options.formId || options.formData) {\n updateFormPreviewSettings();\n } */ else if (data.options?.snippetData) {\n options.snippetData = data.options.snippetData;\n updateSnippetPreviewSettings();\n } else {\n getHistory().reload();\n }\n break;\n case \"reload\":\n location.reload();\n break;\n case \"back\":\n history.goBack();\n break;\n case \"forward\":\n history.goForward();\n break;\n case \"capture\":\n capture(data.maxWidth, data.maxHeight).then(\n (screenshot) => {\n sendMessage<PreviewMessagePreviewerCaptureOk>({\n type: \"capture-ok\",\n screenshot,\n });\n },\n () => {\n sendMessage<PreviewMessagePreviewerCaptureFailed>({\n type: \"capture-failed\",\n });\n }\n );\n break;\n case \"inspect-data-value\":\n handlePreviewData(data.name, data.option);\n break;\n case \"update-preview-url\": {\n // Remove origin first.\n const url = data.previewUrl.startsWith(window.origin)\n ? data.previewUrl.substring(window.origin.length)\n : data.previewUrl;\n // Then remove base path.\n const basePath = getBasePath();\n const to = url.startsWith(basePath)\n ? url.substring(basePath.length - 1)\n : url;\n getHistory().push(to);\n break;\n }\n case \"update-preview-route\": {\n options.routePath = data.routePath;\n options.routeExact = data.routeExact;\n syncRouteMatch();\n break;\n }\n /* case \"excute-proxy-method\": {\n const [ref, method, args = []] = data.proxyMethodArgs;\n try {\n const result = document.body.querySelector(ref)[method](...args);\n window.parent.postMessage({\n sender: \"previewer\",\n type: \"excute-proxy-method-success\",\n data: { method: method, res: result },\n });\n } catch (err) {\n window.parent.postMessage({\n sender: \"previewer\",\n type: \"excute-proxy-method-error\",\n data: { method: method, res: err.message },\n });\n }\n break;\n } */\n }\n }\n );\n\n window.addEventListener(\"scroll\", () => {\n sendMessage<PreviewMessagePreviewerScroll>({\n type: \"scroll\",\n scroll: {\n x: window.scrollX,\n y: window.scrollY,\n },\n });\n });\n\n let previewPageMatch = true;\n let currentLocation: NextLocation;\n const sendLocationChange = (loc: NextLocation): void => {\n sendMessage<PreviewMessagePreviewerUrlChange>({\n type: \"url-change\",\n url: location.origin + history.createHref(loc),\n });\n currentLocation = loc;\n syncRouteMatch();\n };\n\n function syncRouteMatch() {\n if (options.routePath) {\n const match = !!matchPath(currentLocation.pathname, {\n path: options.routePath,\n exact: options.routeExact,\n });\n sendMessage<PreviewMessagePreviewerRouteMatchChange>({\n type: \"route-match-change\",\n match,\n });\n\n // Re-update template preview settings once match route again (typically after login).\n if (options.templateId && !previewPageMatch && match) {\n const mainMountPoint = document.querySelector(\"#main-mount-point\")!;\n const placeholderLoadObserver = new MutationObserver(() => {\n // We observe when the placeholder is appeared.\n if (\n mainMountPoint.childNodes.length === 1 &&\n (mainMountPoint.firstChild as HTMLElement).tagName === \"SPAN\" &&\n mainMountPoint.firstChild!.childNodes.length === 0\n ) {\n updateTemplatePreviewSettings();\n placeholderLoadObserver.disconnect();\n }\n });\n placeholderLoadObserver.observe(mainMountPoint, { childList: true });\n }\n /* if (options.formId && !previewPageMatch && match) {\n const mainMountPoint = document.querySelector(\"#main-mount-point\");\n const placeholderLoadObserver = new MutationObserver(() => {\n // We observe when the placeholder is appeared.\n if (\n mainMountPoint.childNodes.length === 1 &&\n (mainMountPoint.firstChild as HTMLElement).tagName === \"SPAN\" &&\n mainMountPoint.firstChild.childNodes.length === 0\n ) {\n updateFormPreviewSettings();\n placeholderLoadObserver.disconnect();\n }\n });\n placeholderLoadObserver.observe(mainMountPoint, { childList: true });\n } */\n if (options.snippetData && !previewPageMatch && match) {\n const mainMountPoint = document.querySelector(\"#main-mount-point\")!;\n const placeholderLoadObserver = new MutationObserver(() => {\n // We observe when the placeholder is appeared.\n if (\n mainMountPoint.childNodes.length === 1 &&\n (mainMountPoint.firstChild as HTMLElement).tagName === \"SPAN\" &&\n mainMountPoint.firstChild!.childNodes.length === 0\n ) {\n updateSnippetPreviewSettings();\n placeholderLoadObserver.disconnect();\n }\n });\n placeholderLoadObserver.observe(mainMountPoint, { childList: true });\n }\n previewPageMatch = match;\n }\n }\n\n sendLocationChange(history.location);\n\n history.listen(sendLocationChange);\n\n if (options.templateId) {\n updateTemplatePreviewSettings();\n }\n\n /* if (options.formId || options.formData) {\n updateFormPreviewSettings();\n } */\n\n if (options.snippetData) {\n updateSnippetPreviewSettings();\n }\n\n function setupContentScroll() {\n const host = document.querySelector(\"eo-page-view\");\n const element = host?.shadowRoot?.querySelector(\".content\") ?? null;\n if (element !== contentScrollElement) {\n contentScrollElement?.removeEventListener(\"scroll\", onContentScroll);\n element?.addEventListener(\"scroll\", onContentScroll);\n contentScrollElement = element;\n contentScrollHost = host;\n }\n }\n\n function onContentScroll(this: Element) {\n sendMessage<PreviewMessagePreviewerContentScroll>({\n type: \"content-scroll\",\n scroll: {\n x: this.scrollLeft,\n y: this.scrollTop,\n },\n });\n }\n\n setupContentScroll();\n\n const mutationCallback = (): void => {\n setupContentScroll();\n if (hoverIid) {\n sendHighlightBrickOutlines(\"hover\", hoverIid, hoverAlias);\n }\n if (activeIid) {\n sendHighlightBrickOutlines(\"active\", activeIid, activeAlias);\n }\n };\n const mutationObserver = new MutationObserver(\n throttle(mutationCallback, 100, { leading: false })\n );\n mutationObserver.observe(document.body, { subtree: true, childList: true });\n}\n\nfunction getBrickOutlines(iid: string, alias?: string): BrickOutline[] {\n if (!iid) {\n return [];\n }\n const isRoot = iid.includes(\"#\");\n const elements = document.querySelectorAll<HTMLElement>(\n isRoot ? iid : `[data-iid=\"${iid}\"]`\n );\n const outlines = getOutlines(elements, alias);\n return isRoot\n ? outlines.map((item) => ({\n ...item,\n height: window.innerHeight - item.top,\n }))\n : outlines;\n}\n\nfunction getOutlines(\n elements: NodeListOf<HTMLElement>,\n alias?: string\n): BrickOutline[] {\n return [...elements].map((element) => {\n const hasContentScroll = contentScrollHost?.contains(element);\n const { width, height, left, top } = element.getBoundingClientRect();\n return {\n width,\n height,\n left:\n left +\n window.scrollX +\n (hasContentScroll ? contentScrollElement.scrollLeft : 0),\n top:\n top +\n window.scrollY +\n (hasContentScroll ? contentScrollElement.scrollTop : 0),\n alias,\n hasContentScroll,\n };\n });\n}\n"],"names":["collectUsedContracts","storyboard","collection","nodeOrNodes","Set","traverse","node","type","_node$raw","useProvider","raw","add","collect","parseStoryboard","contracts","item","includes","push","customElements","define","createProviderClass","previewProxyOrigin","html2canvas","_html2canvas","_capture","_asyncToGenerator","maxWidth","maxHeight","canvas","sourceCanvas","document","body","logging","scale","width","window","innerWidth","height","innerHeight","foreignObjectRendering","targetCanvas","createElement","targetRatio","ratio","wider","finalWidth","finalHeight","getContext","drawImage","toDataURL","resizeScreenshot","Promise","resolve","reject","toBlob","blob","apply","arguments","onClick","event","iidList","preventDefault","stopPropagation","getPossibleBrickIidList","target","length","parent","postMessage","sender","onMouseEvent","hoverOnBrick","throttle","e","leading","onPointerDown","onPointerOver","onPointerLeave","onContextMenu","brick","position","x","clientX","y","clientY","cursor","dataset","iid","parentElement","connected","getHistory","_getHistory","matchPath","_matchPath","__secret_internals","_internals","isV2","_window$BRICK_NEXT_VE","dll","BRICK_NEXT_VERSIONS","startsWith","getHistoryV2","developHelper","developHelperV2","matchPathV2","_objectSpread","getContextValue","name","_ref","tplStateStoreId","tplContextId","getAllContextValues","_ref2","v2Map","Object","fromEntries","map","_ref3","k","v","value","console","error","contentScrollElement","contentScrollHost","connect","_x","_x2","_connect","previewFromOrigin","options","hoverIid","hoverAlias","activeIid","activeAlias","sendMessage","message","lastTemplatePreviewSettings","sendHighlightBrickOutlines","alias","outlines","getBrickOutlines","highlightType","templateId","settings","updateTemplatePreviewSettings","appId","reload","updateSnippetPreviewSettings","JSON","parse","snippetData","history","addEventListener","_ref6","_ref5","_data$options","_data$options2","data","origin","forwardedFor","highlightNodes","flat","pos","element","elementFromPoint","tagName","isDirection","handleHoverOnIframe","enabled","removeEventListener","updateStoryboardType","_getAddedContracts","_ref7","updateStoryboardByRoute","storyboardPatch","updateStoryboardByTemplate","updateStoryboardBySnippet","newContracts","getAddedContracts","call","formId","isEmpty","updateStoryboard","location","goBack","goForward","capture","then","screenshot","handlePreviewData","option","dataType","datasetKey","querySelector","firstChild","entries","_ref4","url","previewUrl","substring","basePath","getBasePath","to","routePath","routeExact","syncRouteMatch","_x3","scroll","scrollX","scrollY","currentLocation","previewPageMatch","sendLocationChange","loc","createHref","listen","setupContentScroll","MutationObserver","mutationCallback","observe","subtree","childList","match","pathname","path","exact","mainMountPoint","placeholderLoadObserver","childNodes","disconnect","_host$shadowRoot$quer","_host$shadowRoot","_contentScrollElement","host","shadowRoot","onContentScroll","this","scrollLeft","scrollTop","isRoot","elements","_contentScrollHost","hasContentScroll","contains","left","top","getBoundingClientRect","getOutlines","querySelectorAll","concat"],"sourceRoot":""}