Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@plasmicapp/host

Package Overview
Dependencies
Maintainers
1
Versions
248
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@plasmicapp/host - npm Package Compare versions

Comparing version 1.0.48 to 1.0.49

17

dist/data.d.ts
import React, { ReactNode } from "react";
export declare type DataDict = Record<string, any>;
export declare const DataContext: React.Context<Record<string, any> | undefined>;
export declare type DataMeta = {
hidden?: boolean;
};
export declare function mkMetaName(name: string): string;
export declare function mkMetaValue(meta: Partial<DataMeta>): DataMeta;
export declare function applySelector(rawData: DataDict | undefined, selector: string | undefined): any;

@@ -10,7 +15,17 @@ export declare type SelectorDict = Record<string, string | undefined>;

export interface DataProviderProps {
/**
* Key to set in data context.
*/
name?: string;
/**
* Value to set for `name` in data context.
*/
data?: any;
/**
* If true, hide this entry in studio (data binding).
*/
hidden?: boolean;
children?: ReactNode;
}
export declare function DataProvider({ name, data, children }: DataProviderProps): JSX.Element;
export declare function DataProvider({ name, data, hidden, children, }: DataProviderProps): JSX.Element;
export interface PageParamsProviderProps {

@@ -17,0 +32,0 @@ params?: Record<string, string>;

@@ -334,2 +334,8 @@ 'use strict';

var DataContext = /*#__PURE__*/React.createContext(undefined);
function mkMetaName(name) {
return "__plasmic_meta_" + name;
}
function mkMetaValue(meta) {
return meta;
}
function applySelector(rawData, selector) {

@@ -379,2 +385,3 @@ if (!selector) {

data = _ref3.data,
hidden = _ref3.hidden,
children = _ref3.children;

@@ -389,3 +396,5 @@ var existingEnv = (_useDataEnv = useDataEnv()) != null ? _useDataEnv : {};

return React__default.createElement(DataContext.Provider, {
value: _extends({}, existingEnv, (_extends2 = {}, _extends2[name] = data, _extends2))
value: _extends({}, existingEnv, (_extends2 = {}, _extends2[name] = data, _extends2[mkMetaName(name)] = mkMetaValue({
hidden: hidden
}), _extends2))
}, children);

@@ -514,2 +523,4 @@ }

DataContext: DataContext,
mkMetaName: mkMetaName,
mkMetaValue: mkMetaValue,
applySelector: applySelector,

@@ -524,3 +535,3 @@ useSelector: useSelector,

var hostVersion = "1.0.48";
var hostVersion = "1.0.49";

@@ -557,2 +568,4 @@ var root$6 = globalThis;

exports.applySelector = applySelector;
exports.mkMetaName = mkMetaName;
exports.mkMetaValue = mkMetaValue;
exports.registerComponent = registerComponent;

@@ -559,0 +572,0 @@ exports.registerGlobalContext = registerGlobalContext;

2

dist/host.cjs.production.min.js

@@ -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 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}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 d=t.createContext(!1),f=function(){return t.useContext(d)};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,f=(o=t.useState(0)[1],t.useCallback((function(){o((function(e){return e+1}))}),[]));if(t.useLayoutEffect((function(){return l.push(f),function(){var e=l.indexOf(f);e>=0&&l.splice(e,1)}}),[f]),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(d.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 P(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 P(w(),e)}function C(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],P(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){var t=e.params,n=e.query;return r.createElement(R,{name:"params",data:void 0===t?{}:t},r.createElement(R,{name:"query",data:void 0===n?{}:n},e.children))}function j(e){return(0,e.children)(w())}var O=globalThis;function T(e,t){O.__PlasmicFetcherRegistry.push({fetcher:e,meta:t})}O.__PlasmicFetcherRegistry=[];var D=globalThis;function F(e,t){D.__PlasmicComponentRegistry.push({component:e,meta:t})}null==D.__PlasmicComponentRegistry&&(D.__PlasmicComponentRegistry=[]);var A=globalThis;function q(e,t){A.__PlasmicContextRegistry.push({component:e,meta:t})}null==A.__PlasmicContextRegistry&&(A.__PlasmicContextRegistry=[]);var H,L,U=globalThis;function I(e,t){U.__PlasmicTraitRegistry.push({trait:e,meta:t})}function M(e,t){return V(e,t)}null==U.__PlasmicTraitRegistry&&(U.__PlasmicTraitRegistry=[]);var V=function(e,r){return e?r:Array.isArray(r)?r.map((function(t){return M(e,t)})):r&&t.isValidElement(r)&&"string"!=typeof r?t.cloneElement(r):r},k=globalThis,G=null!=(H=null==k||null==(L=k.__Sub)?void 0:L.setRepeatedElementFn)?H:function(e){V=e},N={__proto__:null,PlasmicCanvasContext:d,PlasmicCanvasHost:h,usePlasmicCanvasContext:f,unstable_registerFetcher:T,registerComponent:F,registerGlobalContext:q,registerTrait:I,repeatedElement:M,DataContext:x,applySelector:P,useSelector:E,useSelectors:C,useDataEnv:w,DataProvider:R,PageParamsProvider:S,DataCtxReader:j},z=globalThis;null==z.__Sub&&(console.log("Plasmic: Setting up app host dependencies"),z.__Sub=o({React:t,ReactDOM:n,hostModule:N,hostVersion:"1.0.48",hostUtils:{setPlasmicRootNode:m,registerRenderErrorListener:y,setRepeatedElementFn:G},setPlasmicRootNode:m,registerRenderErrorListener:y,setRepeatedElementFn:G},N)),exports.DataContext=x,exports.DataCtxReader=j,exports.DataProvider=R,exports.PageParamsProvider=S,exports.PlasmicCanvasContext=d,exports.PlasmicCanvasHost=h,exports.applySelector=P,exports.registerComponent=F,exports.registerGlobalContext=q,exports.registerTrait=I,exports.repeatedElement=M,exports.unstable_registerFetcher=T,exports.useDataEnv=w,exports.usePlasmicCanvasContext=f,exports.useSelector=E,exports.useSelectors=C;
"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}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 d=t.createContext(!1),f=function(){return t.useContext(d)};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,f=(o=t.useState(0)[1],t.useCallback((function(){o((function(e){return e+1}))}),[]));if(t.useLayoutEffect((function(){return l.push(f),function(){var e=l.indexOf(f);e>=0&&l.splice(e,1)}}),[f]),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(y,{key:""+p},t.createElement(d.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 _(e){return g.push(e),function(){var t=g.indexOf(e);t>=0&&g.splice(t,1)}}var y=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 P(e){return"__plasmic_meta_"+e}function E(e){return e}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 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 j(e){var t,n,a=e.name,i=e.data,s=e.hidden,l=e.children,u=null!=(t=S())?t:{};return a?r.createElement(x.Provider,{value:o({},u,(n={},n[a]=i,n[P(a)]={hidden:s},n))},l):r.createElement(r.Fragment,null,l)}function O(e){var t=e.params,n=e.query;return r.createElement(j,{name:"params",data:void 0===t?{}:t},r.createElement(j,{name:"query",data:void 0===n?{}:n},e.children))}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 A=globalThis;function M(e,t){A.__PlasmicComponentRegistry.push({component:e,meta:t})}null==A.__PlasmicComponentRegistry&&(A.__PlasmicComponentRegistry=[]);var k=globalThis;function q(e,t){k.__PlasmicContextRegistry.push({component:e,meta:t})}null==k.__PlasmicContextRegistry&&(k.__PlasmicContextRegistry=[]);var V,H,L=globalThis;function N(e,t){L.__PlasmicTraitRegistry.push({trait:e,meta:t})}function U(e,t){return I(e,t)}null==L.__PlasmicTraitRegistry&&(L.__PlasmicTraitRegistry=[]);var I=function(e,r){return e?r:Array.isArray(r)?r.map((function(t){return U(e,t)})):r&&t.isValidElement(r)&&"string"!=typeof r?t.cloneElement(r):r},G=globalThis,z=null!=(V=null==G||null==(H=G.__Sub)?void 0:H.setRepeatedElementFn)?V:function(e){I=e},W={__proto__:null,PlasmicCanvasContext:d,PlasmicCanvasHost:h,usePlasmicCanvasContext:f,unstable_registerFetcher:F,registerComponent:M,registerGlobalContext:q,registerTrait:N,repeatedElement:U,DataContext:x,mkMetaName:P,mkMetaValue:E,applySelector:C,useSelector:w,useSelectors:R,useDataEnv:S,DataProvider:j,PageParamsProvider:O,DataCtxReader:T},$=globalThis;null==$.__Sub&&(console.log("Plasmic: Setting up app host dependencies"),$.__Sub=o({React:t,ReactDOM:n,hostModule:W,hostVersion:"1.0.49",hostUtils:{setPlasmicRootNode:m,registerRenderErrorListener:_,setRepeatedElementFn:z},setPlasmicRootNode:m,registerRenderErrorListener:_,setRepeatedElementFn:z},W)),exports.DataContext=x,exports.DataCtxReader=T,exports.DataProvider=j,exports.PageParamsProvider=O,exports.PlasmicCanvasContext=d,exports.PlasmicCanvasHost=h,exports.applySelector=C,exports.mkMetaName=P,exports.mkMetaValue=E,exports.registerComponent=M,exports.registerGlobalContext=q,exports.registerTrait=N,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

@@ -332,2 +332,8 @@ import * as React from 'react';

var DataContext = /*#__PURE__*/createContext(undefined);
function mkMetaName(name) {
return "__plasmic_meta_" + name;
}
function mkMetaValue(meta) {
return meta;
}
function applySelector(rawData, selector) {

@@ -377,2 +383,3 @@ if (!selector) {

data = _ref3.data,
hidden = _ref3.hidden,
children = _ref3.children;

@@ -387,3 +394,5 @@ var existingEnv = (_useDataEnv = useDataEnv()) != null ? _useDataEnv : {};

return React__default.createElement(DataContext.Provider, {
value: _extends({}, existingEnv, (_extends2 = {}, _extends2[name] = data, _extends2))
value: _extends({}, existingEnv, (_extends2 = {}, _extends2[name] = data, _extends2[mkMetaName(name)] = mkMetaValue({
hidden: hidden
}), _extends2))
}, children);

@@ -512,2 +521,4 @@ }

DataContext: DataContext,
mkMetaName: mkMetaName,
mkMetaValue: mkMetaValue,
applySelector: applySelector,

@@ -522,3 +533,3 @@ useSelector: useSelector,

var hostVersion = "1.0.48";
var hostVersion = "1.0.49";

@@ -548,3 +559,3 @@ var root$6 = globalThis;

export { DataContext, DataCtxReader, DataProvider, PageParamsProvider, PlasmicCanvasContext, PlasmicCanvasHost, applySelector, registerComponent, registerGlobalContext, registerTrait, repeatedElement, registerFetcher as unstable_registerFetcher, useDataEnv, usePlasmicCanvasContext, useSelector, useSelectors };
export { DataContext, DataCtxReader, DataProvider, PageParamsProvider, PlasmicCanvasContext, PlasmicCanvasHost, applySelector, mkMetaName, mkMetaValue, registerComponent, registerGlobalContext, registerTrait, repeatedElement, registerFetcher as unstable_registerFetcher, useDataEnv, usePlasmicCanvasContext, useSelector, useSelectors };
//# sourceMappingURL=host.esm.js.map

@@ -1,1 +0,1 @@

export declare const hostVersion = "1.0.48";
export declare const hostVersion = "1.0.49";
{
"name": "@plasmicapp/host",
"version": "1.0.48",
"version": "1.0.49",
"description": "plasmic library for app hosting",

@@ -58,3 +58,3 @@ "main": "dist/index.js",

},
"gitHead": "e57163897e6ebf84ce69bab6a43a77d66316dd64"
"gitHead": "238ba32e0fbc2cd2db52e00e49256e0c7f1588ad"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc