@plasmicapp/host
Advanced tools
Comparing version 1.0.43 to 1.0.44
@@ -7,2 +7,3 @@ export { PlasmicCanvasContext, PlasmicCanvasHost, usePlasmicCanvasContext, } from "./canvas-host"; | ||
export { default as registerGlobalContext, GlobalContextMeta, GlobalContextRegistration, PropType as GlobalContextPropType, } from "./registerGlobalContext"; | ||
export { BasicTrait, ChoiceTrait, default as registerTrait, TraitMeta, TraitRegistration, } from "./registerTrait"; | ||
export { default as repeatedElement } from "./repeatedElement"; |
@@ -433,2 +433,15 @@ 'use strict'; | ||
var root$4 = globalThis; | ||
if (root$4.__PlasmicTraitRegistry == null) { | ||
root$4.__PlasmicTraitRegistry = []; | ||
} | ||
function registerTrait(trait, meta) { | ||
root$4.__PlasmicTraitRegistry.push({ | ||
trait: trait, | ||
meta: meta | ||
}); | ||
} | ||
var _root$__Sub$setRepeat, _root$__Sub; | ||
@@ -468,4 +481,4 @@ /** | ||
var root$4 = globalThis; | ||
var setRepeatedElementFn = (_root$__Sub$setRepeat = root$4 == null ? void 0 : (_root$__Sub = root$4.__Sub) == null ? void 0 : _root$__Sub.setRepeatedElementFn) != null ? _root$__Sub$setRepeat : function (fn) { | ||
var root$5 = globalThis; | ||
var setRepeatedElementFn = (_root$__Sub$setRepeat = root$5 == null ? void 0 : (_root$__Sub = root$5.__Sub) == null ? void 0 : _root$__Sub.setRepeatedElementFn) != null ? _root$__Sub$setRepeat : function (fn) { | ||
repeatedElementFn = fn; | ||
@@ -484,2 +497,3 @@ }; | ||
registerGlobalContext: registerGlobalContext, | ||
registerTrait: registerTrait, | ||
repeatedElement: repeatedElement, | ||
@@ -495,9 +509,9 @@ DataContext: DataContext, | ||
var root$5 = globalThis; | ||
var root$6 = globalThis; | ||
if (root$5.__Sub == null) { | ||
if (root$6.__Sub == null) { | ||
// Creating a side effect here by logging, so that vite won't | ||
// ignore this block for whatever reason | ||
console.log("Plasmic: Setting up app host dependencies"); | ||
root$5.__Sub = /*#__PURE__*/_extends({ | ||
root$6.__Sub = /*#__PURE__*/_extends({ | ||
React: React, | ||
@@ -526,2 +540,3 @@ ReactDOM: ReactDOM, | ||
exports.registerGlobalContext = registerGlobalContext; | ||
exports.registerTrait = registerTrait; | ||
exports.repeatedElement = repeatedElement; | ||
@@ -528,0 +543,0 @@ exports.unstable_registerFetcher = registerFetcher; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("react-dom");function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function a(e,t){return(a=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 n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}require("@plasmicapp/preamble");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 p=0;function f(e){p++,u.set(e)}var m=t.createContext(!1),d=function(){return t.useContext(m)};function v(){var e,n,o,a=!!window.parent,i=!(null==(e=location.hash)||!e.match(/\bcanvas=true\b/)),s=!(null==(n=location.hash)||!n.match(/\blive=true\b/))||!a,f=a&&!document.querySelector("#plasmic-studio-tag")&&!i&&!s,d=(o=t.useState(0)[1],t.useCallback((function(){o((function(e){return e+1}))}),[]));if(t.useLayoutEffect((function(){return l.push(d),function(){var e=l.indexOf(d);e>=0&&l.splice(e,1)}}),[d]),t.useEffect((function(){var e,t;f&&a&&window.parent!==window&&(e=document.createElement("script"),t=c(),e.src=t+"/static/js/studio.js",document.body.appendChild(e))}),[f,a]),t.useEffect((function(){if(!f&&!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)}}),[f]),!a)return null;if(i||s){var v=document.querySelector("#plasmic-app.__wab_user-body");v||((v=document.createElement("div")).id="plasmic-app",v.classList.add("__wab_user-body"),document.body.appendChild(v));var h=new URLSearchParams(location.hash),b=!!i&&{componentName:h.get("componentName")};return r.createPortal(t.createElement(g,{key:""+p},t.createElement(m.Provider,{value:b},u.get())),v,"plasmic-app")}return f&&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 n=e.enableWebpackHmr,r=t.useState(null),o=r[0],a=r[1];return t.useEffect((function(){a(t.createElement(v,null))}),[]),t.createElement(t.Fragment,null,!n&&t.createElement(_,null),o)},b=[];function y(e){return b.push(e),function(){var t=b.indexOf(e);t>=0&&b.splice(t,1)}}var g=function(e){var n,r;function o(t){var n;return(n=e.call(this,t)||this).state={},n}r=e,(n=o).prototype=Object.create(r.prototype),n.prototype.constructor=n,a(n,r),o.getDerivedStateFromError=function(e){return{error:e}};var i=o.prototype;return i.componentDidCatch=function(e){b.forEach((function(t){return t(e)}))},i.render=function(){return this.state.error?t.createElement("div",null,"Error: ",""+this.state.error.message):this.props.children},o}(t.Component);function _(){return null}var x=t.createContext(void 0);function C(e,t){if(t){for(var n,r=e,o=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return i(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,void 0):void 0}}(e))){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}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("."));!(n=o()).done;){var a;r=null==(a=r)?void 0:a[n.value]}return r}}function E(e){return C(P(),e)}function w(e){void 0===e&&(e={});var t=P();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),n=0;n<e;n++)t[n]=arguments[n];return t}(e[0],C(t,e[1]))})))}function P(){return t.useContext(x)}function R(e){var t,r,a=e.name,i=e.data,s=e.children,l=null!=(t=P())?t:{};return a?n.createElement(x.Provider,{value:o({},l,(r={},r[a]=i,r))},s):n.createElement(n.Fragment,null,s)}function S(e){return(0,e.children)(P())}var j=globalThis;function O(e,t){j.__PlasmicFetcherRegistry.push({fetcher:e,meta:t})}j.__PlasmicFetcherRegistry=[];var D=globalThis;function F(e,t){D.__PlasmicComponentRegistry.push({component:e,meta:t})}null==D.__PlasmicComponentRegistry&&(D.__PlasmicComponentRegistry=[]);var A,T,q=globalThis;function H(e,t){q.__PlasmicContextRegistry.push({component:e,meta:t})}function L(e,t){return U(e,t)}null==q.__PlasmicContextRegistry&&(q.__PlasmicContextRegistry=[]);var U=function(e,n){return e?n:Array.isArray(n)?n.map((function(t){return L(e,t)})):n&&t.isValidElement(n)&&"string"!=typeof n?t.cloneElement(n):n},I=globalThis,M=null!=(A=null==I||null==(T=I.__Sub)?void 0:T.setRepeatedElementFn)?A:function(e){U=e},k={__proto__:null,PlasmicCanvasContext:m,PlasmicCanvasHost:h,usePlasmicCanvasContext:d,unstable_registerFetcher:O,registerComponent:F,registerGlobalContext:H,repeatedElement:L,DataContext:x,applySelector:C,useSelector:E,useSelectors:w,useDataEnv:P,DataProvider:R,DataCtxReader:S},G=globalThis;null==G.__Sub&&(console.log("Plasmic: Setting up app host dependencies"),G.__Sub=o({React:t,ReactDOM:r,hostModule:k,hostUtils:{setPlasmicRootNode:f,registerRenderErrorListener:y,setRepeatedElementFn:M},setPlasmicRootNode:f,registerRenderErrorListener:y,setRepeatedElementFn:M},k)),exports.DataContext=x,exports.DataCtxReader=S,exports.DataProvider=R,exports.PlasmicCanvasContext=m,exports.PlasmicCanvasHost=h,exports.applySelector=C,exports.registerComponent=F,exports.registerGlobalContext=H,exports.repeatedElement=L,exports.unstable_registerFetcher=O,exports.useDataEnv=P,exports.usePlasmicCanvasContext=d,exports.useSelector=E,exports.useSelectors=w; | ||
"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 o(){return(o=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 a(e,t){return(a=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}require("@plasmicapp/preamble");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 p=0;function m(e){p++,u.set(e)}var f=t.createContext(!1),d=function(){return t.useContext(f)};function v(){var e,r,o,a=!!window.parent,i=!(null==(e=location.hash)||!e.match(/\bcanvas=true\b/)),s=!(null==(r=location.hash)||!r.match(/\blive=true\b/))||!a,m=a&&!document.querySelector("#plasmic-studio-tag")&&!i&&!s,d=(o=t.useState(0)[1],t.useCallback((function(){o((function(e){return e+1}))}),[]));if(t.useLayoutEffect((function(){return l.push(d),function(){var e=l.indexOf(d);e>=0&&l.splice(e,1)}}),[d]),t.useEffect((function(){var e,t;m&&a&&window.parent!==window&&(e=document.createElement("script"),t=c(),e.src=t+"/static/js/studio.js",document.body.appendChild(e))}),[m,a]),t.useEffect((function(){if(!m&&!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)}}),[m]),!a)return null;if(i||s){var v=document.querySelector("#plasmic-app.__wab_user-body");v||((v=document.createElement("div")).id="plasmic-app",v.classList.add("__wab_user-body"),document.body.appendChild(v));var h=new URLSearchParams(location.hash),g=!!i&&{componentName:h.get("componentName")};return n.createPortal(t.createElement(_,{key:""+p},t.createElement(f.Provider,{value:g},u.get())),v,"plasmic-app")}return m&&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),o=n[0],a=n[1];return t.useEffect((function(){a(t.createElement(v,null))}),[]),t.createElement(t.Fragment,null,!r&&t.createElement(b,null),o)},g=[];function y(e){return g.push(e),function(){var t=g.indexOf(e);t>=0&&g.splice(t,1)}}var _=function(e){var r,n;function o(t){var r;return(r=e.call(this,t)||this).state={},r}n=e,(r=o).prototype=Object.create(n.prototype),r.prototype.constructor=r,a(r,n),o.getDerivedStateFromError=function(e){return{error:e}};var i=o.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):this.props.children},o}(t.Component);function b(){return null}var x=t.createContext(void 0);function C(e,t){if(t){for(var r,n=e,o=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=o()).done;){var a;n=null==(a=n)?void 0:a[r.value]}return n}}function E(e){return C(w(),e)}function P(e){void 0===e&&(e={});var t=w();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 w(){return t.useContext(x)}function R(e){var t,n,a=e.name,i=e.data,s=e.children,l=null!=(t=w())?t:{};return a?r.createElement(x.Provider,{value:o({},l,(n={},n[a]=i,n))},s):r.createElement(r.Fragment,null,s)}function S(e){return(0,e.children)(w())}var j=globalThis;function O(e,t){j.__PlasmicFetcherRegistry.push({fetcher:e,meta:t})}j.__PlasmicFetcherRegistry=[];var T=globalThis;function D(e,t){T.__PlasmicComponentRegistry.push({component:e,meta:t})}null==T.__PlasmicComponentRegistry&&(T.__PlasmicComponentRegistry=[]);var F=globalThis;function A(e,t){F.__PlasmicContextRegistry.push({component:e,meta:t})}null==F.__PlasmicContextRegistry&&(F.__PlasmicContextRegistry=[]);var q,H,L=globalThis;function U(e,t){L.__PlasmicTraitRegistry.push({trait:e,meta:t})}function I(e,t){return M(e,t)}null==L.__PlasmicTraitRegistry&&(L.__PlasmicTraitRegistry=[]);var M=function(e,r){return e?r:Array.isArray(r)?r.map((function(t){return I(e,t)})):r&&t.isValidElement(r)&&"string"!=typeof r?t.cloneElement(r):r},k=globalThis,G=null!=(q=null==k||null==(H=k.__Sub)?void 0:H.setRepeatedElementFn)?q:function(e){M=e},N={__proto__:null,PlasmicCanvasContext:f,PlasmicCanvasHost:h,usePlasmicCanvasContext:d,unstable_registerFetcher:O,registerComponent:D,registerGlobalContext:A,registerTrait:U,repeatedElement:I,DataContext:x,applySelector:C,useSelector:E,useSelectors:P,useDataEnv:w,DataProvider:R,DataCtxReader:S},V=globalThis;null==V.__Sub&&(console.log("Plasmic: Setting up app host dependencies"),V.__Sub=o({React:t,ReactDOM:n,hostModule:N,hostUtils:{setPlasmicRootNode:m,registerRenderErrorListener:y,setRepeatedElementFn:G},setPlasmicRootNode:m,registerRenderErrorListener:y,setRepeatedElementFn:G},N)),exports.DataContext=x,exports.DataCtxReader=S,exports.DataProvider=R,exports.PlasmicCanvasContext=f,exports.PlasmicCanvasHost=h,exports.applySelector=C,exports.registerComponent=D,exports.registerGlobalContext=A,exports.registerTrait=U,exports.repeatedElement=I,exports.unstable_registerFetcher=O,exports.useDataEnv=w,exports.usePlasmicCanvasContext=d,exports.useSelector=E,exports.useSelectors=P; | ||
//# sourceMappingURL=host.cjs.production.min.js.map |
@@ -431,2 +431,15 @@ import * as React from 'react'; | ||
var root$4 = globalThis; | ||
if (root$4.__PlasmicTraitRegistry == null) { | ||
root$4.__PlasmicTraitRegistry = []; | ||
} | ||
function registerTrait(trait, meta) { | ||
root$4.__PlasmicTraitRegistry.push({ | ||
trait: trait, | ||
meta: meta | ||
}); | ||
} | ||
var _root$__Sub$setRepeat, _root$__Sub; | ||
@@ -466,4 +479,4 @@ /** | ||
var root$4 = globalThis; | ||
var setRepeatedElementFn = (_root$__Sub$setRepeat = root$4 == null ? void 0 : (_root$__Sub = root$4.__Sub) == null ? void 0 : _root$__Sub.setRepeatedElementFn) != null ? _root$__Sub$setRepeat : function (fn) { | ||
var root$5 = globalThis; | ||
var setRepeatedElementFn = (_root$__Sub$setRepeat = root$5 == null ? void 0 : (_root$__Sub = root$5.__Sub) == null ? void 0 : _root$__Sub.setRepeatedElementFn) != null ? _root$__Sub$setRepeat : function (fn) { | ||
repeatedElementFn = fn; | ||
@@ -482,2 +495,3 @@ }; | ||
registerGlobalContext: registerGlobalContext, | ||
registerTrait: registerTrait, | ||
repeatedElement: repeatedElement, | ||
@@ -493,9 +507,9 @@ DataContext: DataContext, | ||
var root$5 = globalThis; | ||
var root$6 = globalThis; | ||
if (root$5.__Sub == null) { | ||
if (root$6.__Sub == null) { | ||
// Creating a side effect here by logging, so that vite won't | ||
// ignore this block for whatever reason | ||
console.log("Plasmic: Setting up app host dependencies"); | ||
root$5.__Sub = /*#__PURE__*/_extends({ | ||
root$6.__Sub = /*#__PURE__*/_extends({ | ||
React: React, | ||
@@ -516,3 +530,3 @@ ReactDOM: ReactDOM, | ||
export { DataContext, DataCtxReader, DataProvider, PlasmicCanvasContext, PlasmicCanvasHost, applySelector, registerComponent, registerGlobalContext, repeatedElement, registerFetcher as unstable_registerFetcher, useDataEnv, usePlasmicCanvasContext, useSelector, useSelectors }; | ||
export { DataContext, DataCtxReader, DataProvider, PlasmicCanvasContext, PlasmicCanvasHost, applySelector, registerComponent, registerGlobalContext, registerTrait, repeatedElement, registerFetcher as unstable_registerFetcher, useDataEnv, usePlasmicCanvasContext, useSelector, useSelectors }; | ||
//# sourceMappingURL=host.esm.js.map |
{ | ||
"name": "@plasmicapp/host", | ||
"version": "1.0.43", | ||
"version": "1.0.44", | ||
"description": "plasmic library for app hosting", | ||
@@ -11,3 +11,4 @@ "main": "dist/index.js", | ||
"registerComponent", | ||
"registerGlobalContext" | ||
"registerGlobalContext", | ||
"registerTrait" | ||
], | ||
@@ -59,3 +60,3 @@ "size-limit": [ | ||
}, | ||
"gitHead": "89ecf01cc166b8af87a4441d0a8624c6d807068c" | ||
"gitHead": "c7dc4de9512e635061037a5937e12e57280c3700" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
241793
44
2394