@plasmicapp/host
Advanced tools
Comparing version 1.0.78 to 1.0.79
@@ -547,3 +547,3 @@ 'use strict'; | ||
var hostVersion = "1.0.78"; | ||
var hostVersion = "1.0.79"; | ||
@@ -550,0 +550,0 @@ var root$6 = globalThis; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),r=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,n=require("react-dom");function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var s=globalThis;null==s.__PlasmicHostVersion&&(s.__PlasmicHostVersion="2");var l=[],u=new function(e){var t=this;this.value=null,this.set=function(e){t.value=e,l.forEach((function(e){return e()}))},this.get=function(){return t.value}}(null);function c(){return function(e,t){if(void 0===t&&(t=""),null==e)throw t=(function(e){return"string"==typeof e}(t)?t:t())||"",new Error("Value must not be undefined or null"+(t?"- "+t:""));return e}(new URL("https://fakeurl/"+location.hash.replace(/#/,"?")).searchParams.get("origin"),"Missing information from Plasmic window.")}var m=0;function p(e){m++,u.set(e)}var d=t.createContext(!1),f=function(){return t.useContext(d)};function v(){var e,r,a,o=!!window.parent,i=!(null==(e=location.hash)||!e.match(/\bcanvas=true\b/)),s=!(null==(r=location.hash)||!r.match(/\blive=true\b/))||!o,p=o&&!document.querySelector("#plasmic-studio-tag")&&!i&&!s,f=new URLSearchParams(location.hash),v=t.useState((function(){var e;return JSON.parse(null!=(e=f.get("globalVariants"))?e:"{}")})),h=v[0],g=v[1],y=(a=t.useState(0)[1],t.useCallback((function(){a((function(e){return e+1}))}),[]));if(t.useLayoutEffect((function(){return l.push(y),function(){var e=l.indexOf(y);e>=0&&l.splice(e,1)}}),[y]),t.useEffect((function(){var e,t;p&&o&&window.parent!==window&&(e=document.createElement("script"),t=c(),e.src=t+"/static/js/studio.js",document.body.appendChild(e))}),[p,o]),t.useEffect((function(){if(!p&&!document.querySelector("#getlibs")&&s){var e=document.createElement("script");e.id="getlibs",e.src=c()+"/static/js/getlibs.js",e.async=!1,e.onload=function(){null==window.__GetlibsReadyResolver||window.__GetlibsReadyResolver()},document.head.append(e)}}),[p]),t.useEffect((function(){var e=function(e){try{var t=JSON.parse(e.data);"canvas-frame"===t.source&&g(t.activeGlobalVariants)}catch(e){}};return window.addEventListener("message",e),function(){return window.removeEventListener("message",e)}}),[]),!o)return null;if(i||s){var _=document.querySelector("#plasmic-app.__wab_user-body");_||((_=document.createElement("div")).id="plasmic-app",_.classList.add("__wab_user-body"),document.body.appendChild(_));var x=!!i&&{componentName:f.get("componentName"),globalVariants:h};return n.createPortal(t.createElement(b,{key:""+m},t.createElement(d.Provider,{value:x},u.get())),_,"plasmic-app")}return p&&window.parent===window?t.createElement("iframe",{src:"https://docs.plasmic.app/app-content/app-host-ready#appHostUrl="+encodeURIComponent(location.href),style:{width:"100vw",height:"100vh",border:"none",position:"fixed",top:0,left:0,zIndex:99999999}}):null}var h=function(e){var r=e.enableWebpackHmr,n=t.useState(null),a=n[0],o=n[1];return t.useEffect((function(){o(t.createElement(v,null))}),[]),t.createElement(t.Fragment,null,!r&&t.createElement(_,null),a)},g=[];function y(e){return g.push(e),function(){var t=g.indexOf(e);t>=0&&g.splice(t,1)}}var b=function(e){var r,n;function a(t){var r;return(r=e.call(this,t)||this).state={},r}n=e,(r=a).prototype=Object.create(n.prototype),r.prototype.constructor=r,o(r,n),a.getDerivedStateFromError=function(e){return{error:e}};var i=a.prototype;return i.componentDidCatch=function(e){g.forEach((function(t){return t(e)}))},i.render=function(){return this.state.error?t.createElement("div",null,"Error: ",""+this.state.error.message):t.createElement(t.Fragment,null,this.props.children)},a}(t.Component);function _(){return null}var x=t.createContext(void 0);function E(e){return"__plasmic_meta_"+e}function P(e){return e}function C(e,t){if(t){for(var r,n=e,a=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return i(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,void 0):void 0}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t.split("."));!(r=a()).done;){var o;n=null==(o=n)?void 0:o[r.value]}return n}}function w(e){return C(S(),e)}function R(e){void 0===e&&(e={});var t=S();return Object.fromEntries(Object.entries(e).filter((function(e){return!!e[0]&&!!e[1]})).map((function(e){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t}(e[0],C(t,e[1]))})))}function S(){return t.useContext(x)}function O(e){var t,n,o=e.name,i=e.data,s=e.hidden,l=e.label,u=e.children,c=null!=(t=S())?t:{};return o?r.createElement(x.Provider,{value:a({},c,(n={},n[o]=i,n[E(o)]={hidden:s,label:l},n))},u):r.createElement(r.Fragment,null,u)}function j(e){var t=e.children,n=e.params,o=void 0===n?{}:n,i=e.query,s=void 0===i?{}:i,l=S()||{};return r.createElement(O,{name:"params",data:a({},l.params,o),label:"Page route params"},r.createElement(O,{name:"query",data:a({},l.query,s),label:"Page query params"},t))}function T(e){return(0,e.children)(S())}var D=globalThis;function F(e,t){D.__PlasmicFetcherRegistry.push({fetcher:e,meta:t})}D.__PlasmicFetcherRegistry=[];var V=globalThis;function q(e,t){V.__PlasmicComponentRegistry.push({component:e,meta:t})}null==V.__PlasmicComponentRegistry&&(V.__PlasmicComponentRegistry=[]);var A=globalThis;function M(e,t){A.__PlasmicContextRegistry.push({component:e,meta:t})}null==A.__PlasmicContextRegistry&&(A.__PlasmicContextRegistry=[]);var k,L,N=globalThis;function H(e,t){N.__PlasmicTraitRegistry.push({trait:e,meta:t})}function U(e,t){return G(e,t)}null==N.__PlasmicTraitRegistry&&(N.__PlasmicTraitRegistry=[]);var G=function(e,r){return Array.isArray(r)?r.map((function(t){return G(e,t)})):r&&t.isValidElement(r)&&"string"!=typeof r?t.cloneElement(r):r},I=globalThis,J=null!=(k=null==I||null==(L=I.__Sub)?void 0:L.setRepeatedElementFn)?k:function(e){G=e},z={__proto__:null,PlasmicCanvasContext:d,PlasmicCanvasHost:h,usePlasmicCanvasContext:f,unstable_registerFetcher:F,registerComponent:q,registerGlobalContext:M,registerTrait:H,repeatedElement:U,DataContext:x,mkMetaName:E,mkMetaValue:P,applySelector:C,useSelector:w,useSelectors:R,useDataEnv:S,DataProvider:O,PageParamsProvider:j,DataCtxReader:T},W=globalThis;null==W.__Sub&&(W.__Sub=a({React:t,ReactDOM:n,hostModule:z,hostVersion:"1.0.78",hostUtils:{setPlasmicRootNode:p,registerRenderErrorListener:y,setRepeatedElementFn:J},setPlasmicRootNode:p,registerRenderErrorListener:y,setRepeatedElementFn:J},z)),exports.DataContext=x,exports.DataCtxReader=T,exports.DataProvider=O,exports.PageParamsProvider=j,exports.PlasmicCanvasContext=d,exports.PlasmicCanvasHost=h,exports.applySelector=C,exports.mkMetaName=E,exports.mkMetaValue=P,exports.registerComponent=q,exports.registerGlobalContext=M,exports.registerTrait=H,exports.repeatedElement=U,exports.unstable_registerFetcher=F,exports.useDataEnv=S,exports.usePlasmicCanvasContext=f,exports.useSelector=w,exports.useSelectors=R; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),r=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,n=require("react-dom");function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var s=globalThis;null==s.__PlasmicHostVersion&&(s.__PlasmicHostVersion="2");var l=[],u=new function(e){var t=this;this.value=null,this.set=function(e){t.value=e,l.forEach((function(e){return e()}))},this.get=function(){return t.value}}(null);function c(){return function(e,t){if(void 0===t&&(t=""),null==e)throw t=(function(e){return"string"==typeof e}(t)?t:t())||"",new Error("Value must not be undefined or null"+(t?"- "+t:""));return e}(new URL("https://fakeurl/"+location.hash.replace(/#/,"?")).searchParams.get("origin"),"Missing information from Plasmic window.")}var m=0;function p(e){m++,u.set(e)}var d=t.createContext(!1),f=function(){return t.useContext(d)};function v(){var e,r,a,o=!!window.parent,i=!(null==(e=location.hash)||!e.match(/\bcanvas=true\b/)),s=!(null==(r=location.hash)||!r.match(/\blive=true\b/))||!o,p=o&&!document.querySelector("#plasmic-studio-tag")&&!i&&!s,f=new URLSearchParams(location.hash),v=t.useState((function(){var e;return JSON.parse(null!=(e=f.get("globalVariants"))?e:"{}")})),h=v[0],g=v[1],y=(a=t.useState(0)[1],t.useCallback((function(){a((function(e){return e+1}))}),[]));if(t.useLayoutEffect((function(){return l.push(y),function(){var e=l.indexOf(y);e>=0&&l.splice(e,1)}}),[y]),t.useEffect((function(){var e,t;p&&o&&window.parent!==window&&(e=document.createElement("script"),t=c(),e.src=t+"/static/js/studio.js",document.body.appendChild(e))}),[p,o]),t.useEffect((function(){if(!p&&!document.querySelector("#getlibs")&&s){var e=document.createElement("script");e.id="getlibs",e.src=c()+"/static/js/getlibs.js",e.async=!1,e.onload=function(){null==window.__GetlibsReadyResolver||window.__GetlibsReadyResolver()},document.head.append(e)}}),[p]),t.useEffect((function(){var e=function(e){try{var t=JSON.parse(e.data);"canvas-frame"===t.source&&g(t.activeGlobalVariants)}catch(e){}};return window.addEventListener("message",e),function(){return window.removeEventListener("message",e)}}),[]),!o)return null;if(i||s){var _=document.querySelector("#plasmic-app.__wab_user-body");_||((_=document.createElement("div")).id="plasmic-app",_.classList.add("__wab_user-body"),document.body.appendChild(_));var x=!!i&&{componentName:f.get("componentName"),globalVariants:h};return n.createPortal(t.createElement(b,{key:""+m},t.createElement(d.Provider,{value:x},u.get())),_,"plasmic-app")}return p&&window.parent===window?t.createElement("iframe",{src:"https://docs.plasmic.app/app-content/app-host-ready#appHostUrl="+encodeURIComponent(location.href),style:{width:"100vw",height:"100vh",border:"none",position:"fixed",top:0,left:0,zIndex:99999999}}):null}var h=function(e){var r=e.enableWebpackHmr,n=t.useState(null),a=n[0],o=n[1];return t.useEffect((function(){o(t.createElement(v,null))}),[]),t.createElement(t.Fragment,null,!r&&t.createElement(_,null),a)},g=[];function y(e){return g.push(e),function(){var t=g.indexOf(e);t>=0&&g.splice(t,1)}}var b=function(e){var r,n;function a(t){var r;return(r=e.call(this,t)||this).state={},r}n=e,(r=a).prototype=Object.create(n.prototype),r.prototype.constructor=r,o(r,n),a.getDerivedStateFromError=function(e){return{error:e}};var i=a.prototype;return i.componentDidCatch=function(e){g.forEach((function(t){return t(e)}))},i.render=function(){return this.state.error?t.createElement("div",null,"Error: ",""+this.state.error.message):t.createElement(t.Fragment,null,this.props.children)},a}(t.Component);function _(){return null}var x=t.createContext(void 0);function E(e){return"__plasmic_meta_"+e}function P(e){return e}function C(e,t){if(t){for(var r,n=e,a=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return i(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,void 0):void 0}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t.split("."));!(r=a()).done;){var o;n=null==(o=n)?void 0:o[r.value]}return n}}function w(e){return C(S(),e)}function R(e){void 0===e&&(e={});var t=S();return Object.fromEntries(Object.entries(e).filter((function(e){return!!e[0]&&!!e[1]})).map((function(e){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t}(e[0],C(t,e[1]))})))}function S(){return t.useContext(x)}function O(e){var t,n,o=e.name,i=e.data,s=e.hidden,l=e.label,u=e.children,c=null!=(t=S())?t:{};return o?r.createElement(x.Provider,{value:a({},c,(n={},n[o]=i,n[E(o)]={hidden:s,label:l},n))},u):r.createElement(r.Fragment,null,u)}function j(e){var t=e.children,n=e.params,o=void 0===n?{}:n,i=e.query,s=void 0===i?{}:i,l=S()||{};return r.createElement(O,{name:"params",data:a({},l.params,o),label:"Page route params"},r.createElement(O,{name:"query",data:a({},l.query,s),label:"Page query params"},t))}function T(e){return(0,e.children)(S())}var D=globalThis;function F(e,t){D.__PlasmicFetcherRegistry.push({fetcher:e,meta:t})}D.__PlasmicFetcherRegistry=[];var V=globalThis;function q(e,t){V.__PlasmicComponentRegistry.push({component:e,meta:t})}null==V.__PlasmicComponentRegistry&&(V.__PlasmicComponentRegistry=[]);var A=globalThis;function M(e,t){A.__PlasmicContextRegistry.push({component:e,meta:t})}null==A.__PlasmicContextRegistry&&(A.__PlasmicContextRegistry=[]);var k,L,N=globalThis;function H(e,t){N.__PlasmicTraitRegistry.push({trait:e,meta:t})}function U(e,t){return G(e,t)}null==N.__PlasmicTraitRegistry&&(N.__PlasmicTraitRegistry=[]);var G=function(e,r){return Array.isArray(r)?r.map((function(t){return G(e,t)})):r&&t.isValidElement(r)&&"string"!=typeof r?t.cloneElement(r):r},I=globalThis,J=null!=(k=null==I||null==(L=I.__Sub)?void 0:L.setRepeatedElementFn)?k:function(e){G=e},z={__proto__:null,PlasmicCanvasContext:d,PlasmicCanvasHost:h,usePlasmicCanvasContext:f,unstable_registerFetcher:F,registerComponent:q,registerGlobalContext:M,registerTrait:H,repeatedElement:U,DataContext:x,mkMetaName:E,mkMetaValue:P,applySelector:C,useSelector:w,useSelectors:R,useDataEnv:S,DataProvider:O,PageParamsProvider:j,DataCtxReader:T},W=globalThis;null==W.__Sub&&(W.__Sub=a({React:t,ReactDOM:n,hostModule:z,hostVersion:"1.0.79",hostUtils:{setPlasmicRootNode:p,registerRenderErrorListener:y,setRepeatedElementFn:J},setPlasmicRootNode:p,registerRenderErrorListener:y,setRepeatedElementFn:J},z)),exports.DataContext=x,exports.DataCtxReader=T,exports.DataProvider=O,exports.PageParamsProvider=j,exports.PlasmicCanvasContext=d,exports.PlasmicCanvasHost=h,exports.applySelector=C,exports.mkMetaName=E,exports.mkMetaValue=P,exports.registerComponent=q,exports.registerGlobalContext=M,exports.registerTrait=H,exports.repeatedElement=U,exports.unstable_registerFetcher=F,exports.useDataEnv=S,exports.usePlasmicCanvasContext=f,exports.useSelector=w,exports.useSelectors=R; | ||
//# sourceMappingURL=host.cjs.production.min.js.map |
@@ -545,3 +545,3 @@ import * as React from 'react'; | ||
var hostVersion = "1.0.78"; | ||
var hostVersion = "1.0.79"; | ||
@@ -548,0 +548,0 @@ var root$6 = globalThis; |
@@ -151,2 +151,8 @@ /// <reference types="react" /> | ||
SideModal: React.ComponentType<ModalProps>; | ||
/** | ||
* The document that the component will be rendered into; instead of using | ||
* `document` directly (for, say, `document.querySelector()` etc.), you | ||
* should use this instead. | ||
*/ | ||
studioDocument: typeof document; | ||
} | ||
@@ -210,2 +216,8 @@ export declare type CustomControl<P> = React.ComponentType<CustomControlProps<P>>; | ||
}; | ||
/** | ||
* The document that the component will be rendered into; instead of using | ||
* `document` directly (for, say, `document.querySelector()` etc.), you | ||
* should use this instead. | ||
*/ | ||
studioDocument: typeof document; | ||
} | ||
@@ -212,0 +224,0 @@ export declare type Action<P> = { |
@@ -1,1 +0,1 @@ | ||
export declare const hostVersion = "1.0.78"; | ||
export declare const hostVersion = "1.0.79"; |
{ | ||
"name": "@plasmicapp/host", | ||
"version": "1.0.78", | ||
"version": "1.0.79", | ||
"description": "plasmic library for app hosting", | ||
@@ -58,3 +58,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "00908b0c730adea12726998c0a84427ec378374d" | ||
"gitHead": "01d15a2f6fc64b18cb0d2e6eb1caac6ad9f8c9f1" | ||
} |
@@ -151,2 +151,8 @@ /// <reference types="react" /> | ||
SideModal: React.ComponentType<ModalProps>; | ||
/** | ||
* The document that the component will be rendered into; instead of using | ||
* `document` directly (for, say, `document.querySelector()` etc.), you | ||
* should use this instead. | ||
*/ | ||
studioDocument: typeof document; | ||
} | ||
@@ -210,2 +216,8 @@ export declare type CustomControl<P> = React.ComponentType<CustomControlProps<P>>; | ||
}; | ||
/** | ||
* The document that the component will be rendered into; instead of using | ||
* `document` directly (for, say, `document.querySelector()` etc.), you | ||
* should use this instead. | ||
*/ | ||
studioDocument: typeof document; | ||
} | ||
@@ -212,0 +224,0 @@ export declare type Action<P> = { |
@@ -151,2 +151,8 @@ /// <reference types="react" /> | ||
SideModal: React.ComponentType<ModalProps>; | ||
/** | ||
* The document that the component will be rendered into; instead of using | ||
* `document` directly (for, say, `document.querySelector()` etc.), you | ||
* should use this instead. | ||
*/ | ||
studioDocument: typeof document; | ||
} | ||
@@ -210,2 +216,8 @@ export declare type CustomControl<P> = React.ComponentType<CustomControlProps<P>>; | ||
}; | ||
/** | ||
* The document that the component will be rendered into; instead of using | ||
* `document` directly (for, say, `document.querySelector()` etc.), you | ||
* should use this instead. | ||
*/ | ||
studioDocument: typeof document; | ||
} | ||
@@ -212,0 +224,0 @@ export declare type Action<P> = { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
290016
2814