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.128 to 1.0.129

dist/index.cjs.js

762

dist/host.esm.js

@@ -1,139 +0,73 @@

'use client';import * as PlasmicQuery from '@plasmicapp/query';
'use client';
import { __extends, __assign } from 'tslib';
import * as PlasmicQuery from '@plasmicapp/query';
import * as React from 'react';
import React__default, { useState, useCallback, createContext, useContext, useEffect, createElement, Fragment, useLayoutEffect, Component, isValidElement, cloneElement } from 'react';
import React__default, { useState, useCallback, createContext, useContext, isValidElement, cloneElement } from 'react';
import * as ReactDOM from 'react-dom';
import { createPortal } from 'react-dom';
function _extends() {
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function isString(x) {
return typeof x === "string";
return typeof x === "string";
}
function ensure(x, msg) {
if (msg === void 0) {
msg = "";
}
if (x === null || x === undefined) {
debugger;
msg = (isString(msg) ? msg : msg()) || "";
throw new Error("Value must not be undefined or null" + (msg ? "- " + msg : ""));
} else {
return x;
}
if (msg === void 0) { msg = ""; }
if (x === null || x === undefined) {
debugger;
msg = (isString(msg) ? msg : msg()) || "";
throw new Error("Value must not be undefined or null" + (msg ? "- " + msg : ""));
}
else {
return x;
}
}
function useForceUpdate() {
var _useState = useState(0),
setTick = _useState[1];
var update = useCallback(function () {
setTick(function (tick) {
return tick + 1;
});
}, []);
return update;
var _a = useState(0), setTick = _a[1];
var update = useCallback(function () {
setTick(function (tick) { return tick + 1; });
}, []);
return update;
}
var root = globalThis;
if (root.__PlasmicHostVersion == null) {
root.__PlasmicHostVersion = "2";
}
var rootChangeListeners = [];
var PlasmicRootNodeWrapper = function PlasmicRootNodeWrapper(value) {
var _this = this;
this.value = value;
this.set = function (val) {
_this.value = val;
rootChangeListeners.forEach(function (f) {
return f();
});
};
this.get = function () {
return _this.value;
};
};
var plasmicRootNode = /*#__PURE__*/new PlasmicRootNodeWrapper(null);
var PlasmicRootNodeWrapper = /** @class */ (function () {
function PlasmicRootNodeWrapper(value) {
var _this = this;
this.value = value;
this.set = function (val) {
_this.value = val;
rootChangeListeners.forEach(function (f) { return f(); });
};
this.get = function () { return _this.value; };
}
return PlasmicRootNodeWrapper;
}());
var plasmicRootNode = new PlasmicRootNodeWrapper(null);
function getHashParams() {
return new URLSearchParams(location.hash.replace(/^#/, "?"));
return new URLSearchParams(location.hash.replace(/^#/, "?"));
}
function getPlasmicOrigin() {
var params = getHashParams();
return ensure(params.get("origin"), "Missing information from Plasmic window.");
var params = getHashParams();
return ensure(params.get("origin"), "Missing information from Plasmic window.");
}
function getStudioHash() {
var hashParams = getHashParams();
if (hashParams.has("studioHash")) {
return hashParams.get("studioHash");
}
var urlParams = new URL(location.href).searchParams;
return urlParams.get("studio-hash");
var hashParams = getHashParams();
if (hashParams.has("studioHash")) {
return hashParams.get("studioHash");
}
var urlParams = new URL(location.href).searchParams;
return urlParams.get("studio-hash");
}
function renderStudioIntoIframe() {
var script = document.createElement("script");
var plasmicOrigin = getPlasmicOrigin();
var hash = getStudioHash();
script.src = plasmicOrigin + "/static/js/studio" + (hash ? "." + hash + ".js" : ".js");
document.body.appendChild(script);
var script = document.createElement("script");
var plasmicOrigin = getPlasmicOrigin();
var hash = getStudioHash();
script.src = plasmicOrigin + "/static/js/studio" + (hash ? "." + hash + ".js" : ".js");
document.body.appendChild(script);
}
var renderCount = 0;
function setPlasmicRootNode(node) {
// Keep track of renderCount, which we use as key to ErrorBoundary, so
// we can reset the error on each render
renderCount++;
plasmicRootNode.set(node);
// Keep track of renderCount, which we use as key to ErrorBoundary, so
// we can reset the error on each render
renderCount++;
plasmicRootNode.set(node);
}

@@ -145,367 +79,318 @@ /**

*/
var PlasmicCanvasContext = /*#__PURE__*/createContext(false);
var usePlasmicCanvasContext = function usePlasmicCanvasContext() {
return useContext(PlasmicCanvasContext);
var PlasmicCanvasContext = React.createContext(false);
var usePlasmicCanvasContext = function () {
return React.useContext(PlasmicCanvasContext);
};
function _PlasmicCanvasHost() {
var _location$hash, _location$hash2;
// If window.parent is null, then this is a window whose containing iframe
// has been detached from the DOM (for the top window, window.parent === window).
// In that case, we shouldn't do anything. If window.parent is null, by the way,
// location.hash will also be null.
var isFrameAttached = !!window.parent;
var isCanvas = !!((_location$hash = location.hash) != null && _location$hash.match(/\bcanvas=true\b/));
var isLive = !!((_location$hash2 = location.hash) != null && _location$hash2.match(/\blive=true\b/)) || !isFrameAttached;
var shouldRenderStudio = isFrameAttached && !document.querySelector("#plasmic-studio-tag") && !isCanvas && !isLive;
var forceUpdate = useForceUpdate();
useLayoutEffect(function () {
rootChangeListeners.push(forceUpdate);
return function () {
var index = rootChangeListeners.indexOf(forceUpdate);
if (index >= 0) {
rootChangeListeners.splice(index, 1);
}
};
}, [forceUpdate]);
useEffect(function () {
if (shouldRenderStudio && isFrameAttached && window.parent !== window) {
renderStudioIntoIframe();
var _a, _b;
// If window.parent is null, then this is a window whose containing iframe
// has been detached from the DOM (for the top window, window.parent === window).
// In that case, we shouldn't do anything. If window.parent is null, by the way,
// location.hash will also be null.
var isFrameAttached = !!window.parent;
var isCanvas = !!((_a = location.hash) === null || _a === void 0 ? void 0 : _a.match(/\bcanvas=true\b/));
var isLive = !!((_b = location.hash) === null || _b === void 0 ? void 0 : _b.match(/\blive=true\b/)) || !isFrameAttached;
var shouldRenderStudio = isFrameAttached &&
!document.querySelector("#plasmic-studio-tag") &&
!isCanvas &&
!isLive;
var forceUpdate = useForceUpdate();
React.useLayoutEffect(function () {
rootChangeListeners.push(forceUpdate);
return function () {
var index = rootChangeListeners.indexOf(forceUpdate);
if (index >= 0) {
rootChangeListeners.splice(index, 1);
}
};
}, [forceUpdate]);
React.useEffect(function () {
if (shouldRenderStudio && isFrameAttached && window.parent !== window) {
renderStudioIntoIframe();
}
}, [shouldRenderStudio, isFrameAttached]);
React.useEffect(function () {
if (!shouldRenderStudio && !document.querySelector("#getlibs") && isLive) {
var scriptElt = document.createElement("script");
scriptElt.id = "getlibs";
scriptElt.src = getPlasmicOrigin() + "/static/js/getlibs.js";
scriptElt.async = false;
scriptElt.onload = function () {
var _a, _b;
(_b = (_a = window).__GetlibsReadyResolver) === null || _b === void 0 ? void 0 : _b.call(_a);
};
document.head.append(scriptElt);
}
}, [shouldRenderStudio]);
var _c = React.useState(function () {
return deriveCanvasContextValue();
}), canvasContextValue = _c[0], setCanvasContextValue = _c[1];
React.useEffect(function () {
if (isCanvas) {
var listener_1 = function () {
setCanvasContextValue(deriveCanvasContextValue());
};
window.addEventListener("hashchange", listener_1);
return function () { return window.removeEventListener("hashchange", listener_1); };
}
return undefined;
}, [isCanvas]);
if (!isFrameAttached) {
return null;
}
}, [shouldRenderStudio, isFrameAttached]);
useEffect(function () {
if (!shouldRenderStudio && !document.querySelector("#getlibs") && isLive) {
var scriptElt = document.createElement("script");
scriptElt.id = "getlibs";
scriptElt.src = getPlasmicOrigin() + "/static/js/getlibs.js";
scriptElt.async = false;
scriptElt.onload = function () {
window.__GetlibsReadyResolver == null ? void 0 : window.__GetlibsReadyResolver();
};
document.head.append(scriptElt);
if (isCanvas || isLive) {
var appDiv = document.querySelector("#plasmic-app.__wab_user-body");
if (!appDiv) {
appDiv = document.createElement("div");
appDiv.id = "plasmic-app";
appDiv.classList.add("__wab_user-body");
document.body.appendChild(appDiv);
}
return ReactDOM.createPortal(React.createElement(ErrorBoundary, { key: "" + renderCount },
React.createElement(PlasmicCanvasContext.Provider, { value: canvasContextValue }, plasmicRootNode.get())), appDiv, "plasmic-app");
}
}, [shouldRenderStudio]);
var _React$useState = useState(function () {
return deriveCanvasContextValue();
}),
canvasContextValue = _React$useState[0],
setCanvasContextValue = _React$useState[1];
useEffect(function () {
if (isCanvas) {
var listener = function listener() {
setCanvasContextValue(deriveCanvasContextValue());
};
window.addEventListener("hashchange", listener);
return function () {
return window.removeEventListener("hashchange", listener);
};
if (shouldRenderStudio && window.parent === window) {
return (React.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,
} }));
}
return undefined;
}, [isCanvas]);
if (!isFrameAttached) {
return null;
}
if (isCanvas || isLive) {
var appDiv = document.querySelector("#plasmic-app.__wab_user-body");
if (!appDiv) {
appDiv = document.createElement("div");
appDiv.id = "plasmic-app";
appDiv.classList.add("__wab_user-body");
document.body.appendChild(appDiv);
}
return createPortal(createElement(ErrorBoundary, {
key: "" + renderCount
}, createElement(PlasmicCanvasContext.Provider, {
value: canvasContextValue
}, plasmicRootNode.get())), appDiv, "plasmic-app");
}
if (shouldRenderStudio && window.parent === window) {
return 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
}
});
}
return null;
}
var PlasmicCanvasHost = function PlasmicCanvasHost(props) {
var enableWebpackHmr = props.enableWebpackHmr;
var _React$useState2 = useState(null),
node = _React$useState2[0],
setNode = _React$useState2[1];
useEffect(function () {
setNode(createElement(_PlasmicCanvasHost, null));
}, []);
return createElement(Fragment, null, !enableWebpackHmr && createElement(DisableWebpackHmr, null), node);
var PlasmicCanvasHost = function (props) {
var enableWebpackHmr = props.enableWebpackHmr;
var _a = React.useState(null), node = _a[0], setNode = _a[1];
React.useEffect(function () {
setNode(React.createElement(_PlasmicCanvasHost, null));
}, []);
return (React.createElement(React.Fragment, null,
!enableWebpackHmr && React.createElement(DisableWebpackHmr, null),
node));
};
var renderErrorListeners = [];
function registerRenderErrorListener(listener) {
renderErrorListeners.push(listener);
return function () {
var index = renderErrorListeners.indexOf(listener);
if (index >= 0) {
renderErrorListeners.splice(index, 1);
renderErrorListeners.push(listener);
return function () {
var index = renderErrorListeners.indexOf(listener);
if (index >= 0) {
renderErrorListeners.splice(index, 1);
}
};
}
var ErrorBoundary = /** @class */ (function (_super) {
__extends(ErrorBoundary, _super);
function ErrorBoundary(props) {
var _this = _super.call(this, props) || this;
_this.state = {};
return _this;
}
};
}
var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
_inheritsLoose(ErrorBoundary, _React$Component);
function ErrorBoundary(props) {
var _this2;
_this2 = _React$Component.call(this, props) || this;
_this2.state = {};
return _this2;
}
ErrorBoundary.getDerivedStateFromError = function getDerivedStateFromError(error) {
return {
error: error
ErrorBoundary.getDerivedStateFromError = function (error) {
return { error: error };
};
};
var _proto = ErrorBoundary.prototype;
_proto.componentDidCatch = function componentDidCatch(error) {
renderErrorListeners.forEach(function (listener) {
return listener(error);
});
};
_proto.render = function render() {
if (this.state.error) {
return createElement("div", null, "Error: ", "" + this.state.error.message);
} else {
return createElement(Fragment, null, this.props.children);
}
};
return ErrorBoundary;
}(Component);
ErrorBoundary.prototype.componentDidCatch = function (error) {
renderErrorListeners.forEach(function (listener) { return listener(error); });
};
ErrorBoundary.prototype.render = function () {
if (this.state.error) {
return React.createElement("div", null,
"Error: ", "" + this.state.error.message);
}
else {
return React.createElement(React.Fragment, null, this.props.children);
}
};
return ErrorBoundary;
}(React.Component));
function DisableWebpackHmr() {
if (process.env.NODE_ENV === "production") {
return null;
}
return createElement("script", {
type: "text/javascript",
dangerouslySetInnerHTML: {
__html: "\n if (typeof window !== \"undefined\") {\n const RealEventSource = window.EventSource;\n window.EventSource = function(url, config) {\n if (/[^a-zA-Z]hmr($|[^a-zA-Z])/.test(url)) {\n console.warn(\"Plasmic: disabled EventSource request for\", url);\n return {\n onerror() {}, onmessage() {}, onopen() {}, close() {}\n };\n } else {\n return new RealEventSource(url, config);\n }\n }\n }\n "
if (process.env.NODE_ENV === "production") {
return null;
}
});
return (React.createElement("script", { type: "text/javascript", dangerouslySetInnerHTML: {
__html: "\n if (typeof window !== \"undefined\") {\n const RealEventSource = window.EventSource;\n window.EventSource = function(url, config) {\n if (/[^a-zA-Z]hmr($|[^a-zA-Z])/.test(url)) {\n console.warn(\"Plasmic: disabled EventSource request for\", url);\n return {\n onerror() {}, onmessage() {}, onopen() {}, close() {}\n };\n } else {\n return new RealEventSource(url, config);\n }\n }\n }\n ",
} }));
}
function deriveCanvasContextValue() {
var hash = window.location.hash;
if (hash && hash.length > 0) {
// create URLsearchParams skipping the initial # character
var params = new URLSearchParams(hash.substring(1));
if (params.get("canvas") === "true") {
var _params$get;
var globalVariants = params.get("globalVariants");
return {
componentName: (_params$get = params.get("componentName")) != null ? _params$get : null,
globalVariants: globalVariants ? JSON.parse(globalVariants) : {},
interactive: params.get("interactive") === "true"
};
var _a;
var hash = window.location.hash;
if (hash && hash.length > 0) {
// create URLsearchParams skipping the initial # character
var params = new URLSearchParams(hash.substring(1));
if (params.get("canvas") === "true") {
var globalVariants = params.get("globalVariants");
return {
componentName: (_a = params.get("componentName")) !== null && _a !== void 0 ? _a : null,
globalVariants: globalVariants ? JSON.parse(globalVariants) : {},
interactive: params.get("interactive") === "true",
};
}
}
}
return false;
return false;
}
var tuple = function tuple() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return args;
var tuple = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return args;
};
var DataContext = /*#__PURE__*/createContext(undefined);
var DataContext = createContext(undefined);
function mkMetaName(name) {
return "__plasmic_meta_" + name;
return "__plasmic_meta_" + name;
}
function mkMetaValue(meta) {
return meta;
return meta;
}
function applySelector(rawData, selector) {
if (!selector) {
return undefined;
}
var curData = rawData;
for (var _iterator = _createForOfIteratorHelperLoose(selector.split(".")), _step; !(_step = _iterator()).done;) {
var _curData;
var key = _step.value;
curData = (_curData = curData) == null ? void 0 : _curData[key];
}
return curData;
if (!selector) {
return undefined;
}
var curData = rawData;
for (var _i = 0, _a = selector.split("."); _i < _a.length; _i++) {
var key = _a[_i];
curData = curData === null || curData === void 0 ? void 0 : curData[key];
}
return curData;
}
function useSelector(selector) {
var rawData = useDataEnv();
return applySelector(rawData, selector);
var rawData = useDataEnv();
return applySelector(rawData, selector);
}
function useSelectors(selectors) {
if (selectors === void 0) {
selectors = {};
}
var rawData = useDataEnv();
return Object.fromEntries(Object.entries(selectors).filter(function (_ref) {
var key = _ref[0],
selector = _ref[1];
return !!key && !!selector;
}).map(function (_ref2) {
var key = _ref2[0],
selector = _ref2[1];
return tuple(key, applySelector(rawData, selector));
}));
if (selectors === void 0) { selectors = {}; }
var rawData = useDataEnv();
return Object.fromEntries(Object.entries(selectors)
.filter(function (_a) {
var key = _a[0], selector = _a[1];
return !!key && !!selector;
})
.map(function (_a) {
var key = _a[0], selector = _a[1];
return tuple(key, applySelector(rawData, selector));
}));
}
function useDataEnv() {
return useContext(DataContext);
return useContext(DataContext);
}
function DataProvider(_ref3) {
var _useDataEnv;
var name = _ref3.name,
data = _ref3.data,
hidden = _ref3.hidden,
label = _ref3.label,
children = _ref3.children;
var existingEnv = (_useDataEnv = useDataEnv()) != null ? _useDataEnv : {};
if (!name) {
return React__default.createElement(React__default.Fragment, null, children);
} else {
var _extends2;
return React__default.createElement(DataContext.Provider, {
value: _extends({}, existingEnv, (_extends2 = {}, _extends2[name] = data, _extends2[mkMetaName(name)] = mkMetaValue({
hidden: hidden,
label: label
}), _extends2))
}, children);
}
function DataProvider(_a) {
var _b;
var _c;
var name = _a.name, data = _a.data, hidden = _a.hidden, label = _a.label, children = _a.children;
var existingEnv = (_c = useDataEnv()) !== null && _c !== void 0 ? _c : {};
if (!name) {
return React__default.createElement(React__default.Fragment, null, children);
}
else {
return (React__default.createElement(DataContext.Provider, { value: __assign(__assign({}, existingEnv), (_b = {}, _b[name] = data, _b[mkMetaName(name)] = mkMetaValue({ hidden: hidden, label: label }), _b)) }, children));
}
}
function PageParamsProvider(_ref4) {
var children = _ref4.children,
_ref4$params = _ref4.params,
params = _ref4$params === void 0 ? {} : _ref4$params,
_ref4$query = _ref4.query,
query = _ref4$query === void 0 ? {} : _ref4$query;
var $ctx = useDataEnv() || {};
return React__default.createElement(DataProvider, {
name: "params",
data: _extends({}, $ctx.params, params),
label: "Page URL path params"
}, React__default.createElement(DataProvider, {
name: "query",
data: _extends({}, $ctx.query, query),
label: "Page URL query params"
}, children));
function PageParamsProvider(_a) {
var children = _a.children, _b = _a.params, params = _b === void 0 ? {} : _b, _c = _a.query, query = _c === void 0 ? {} : _c;
var $ctx = useDataEnv() || {};
return (React__default.createElement(DataProvider, { name: "params", data: __assign(__assign({}, $ctx.params), params), label: "Page URL path params" },
React__default.createElement(DataProvider, { name: "query", data: __assign(__assign({}, $ctx.query), query), label: "Page URL query params" }, children)));
}
function DataCtxReader(_ref5) {
var children = _ref5.children;
var $ctx = useDataEnv();
return children($ctx);
function DataCtxReader(_a) {
var children = _a.children;
var $ctx = useDataEnv();
return children($ctx);
}
var root$1 = globalThis;
root$1.__PlasmicFetcherRegistry = [];
var root$6 = globalThis;
root$6.__PlasmicFetcherRegistry = [];
function registerFetcher(fetcher, meta) {
root$1.__PlasmicFetcherRegistry.push({
fetcher: fetcher,
meta: meta
});
root$6.__PlasmicFetcherRegistry.push({ fetcher: fetcher, meta: meta });
}
var GlobalActionsContext = /*#__PURE__*/React__default.createContext(undefined);
var GlobalActionsContext = React__default.createContext(undefined);
function GlobalActionsProvider(props) {
var contextName = props.contextName,
children = props.children,
actions = props.actions;
var namespacedActions = React__default.useMemo(function () {
return Object.fromEntries(Object.entries(actions).map(function (_ref) {
var key = _ref[0],
val = _ref[1];
return [contextName + "." + key, val];
}));
}, [contextName, actions]);
return React__default.createElement(GlobalActionsContext.Provider, {
value: namespacedActions
}, children);
var contextName = props.contextName, children = props.children, actions = props.actions;
var namespacedActions = React__default.useMemo(function () {
return Object.fromEntries(Object.entries(actions).map(function (_a) {
var key = _a[0], val = _a[1];
return [
contextName + "." + key,
val,
];
}));
}, [contextName, actions]);
return (React__default.createElement(GlobalActionsContext.Provider, { value: namespacedActions }, children));
}
function useGlobalActions() {
var _React$useContext;
return (_React$useContext = React__default.useContext(GlobalActionsContext)) != null ? _React$useContext : {};
var _a;
return (_a = React__default.useContext(GlobalActionsContext)) !== null && _a !== void 0 ? _a : {};
}
var root$2 = globalThis;
if (root$2.__PlasmicComponentRegistry == null) {
root$2.__PlasmicComponentRegistry = [];
var root$5 = globalThis;
if (root$5.__PlasmicComponentRegistry == null) {
root$5.__PlasmicComponentRegistry = [];
}
function registerComponent(component, meta) {
// Check for duplicates
if (root$2.__PlasmicComponentRegistry.some(function (r) {
return r.component === component && r.meta.name === meta.name;
})) {
return;
}
root$2.__PlasmicComponentRegistry.push({
component: component,
meta: meta
});
// Check for duplicates
if (root$5.__PlasmicComponentRegistry.some(function (r) {
return r.component === component && r.meta.name === meta.name;
})) {
return;
}
root$5.__PlasmicComponentRegistry.push({ component: component, meta: meta });
}
var root$3 = globalThis;
if (root$3.__PlasmicContextRegistry == null) {
root$3.__PlasmicContextRegistry = [];
var root$4 = globalThis;
if (root$4.__PlasmicContextRegistry == null) {
root$4.__PlasmicContextRegistry = [];
}
function registerGlobalContext(component, meta) {
// Check for duplicates
if (root$3.__PlasmicContextRegistry.some(function (r) {
return r.component === component && r.meta.name === meta.name;
})) {
return;
}
root$3.__PlasmicContextRegistry.push({
component: component,
meta: meta
});
// Check for duplicates
if (root$4.__PlasmicContextRegistry.some(function (r) {
return r.component === component && r.meta.name === meta.name;
})) {
return;
}
root$4.__PlasmicContextRegistry.push({ component: component, meta: meta });
}
var root$4 = globalThis;
if (root$4.__PlasmicTokenRegistry == null) {
root$4.__PlasmicTokenRegistry = [];
var root$3 = globalThis;
if (root$3.__PlasmicTokenRegistry == null) {
root$3.__PlasmicTokenRegistry = [];
}
function registerToken(token) {
root$4.__PlasmicTokenRegistry.push(token);
root$3.__PlasmicTokenRegistry.push(token);
}
var root$5 = globalThis;
if (root$5.__PlasmicTraitRegistry == null) {
root$5.__PlasmicTraitRegistry = [];
var root$2 = globalThis;
if (root$2.__PlasmicTraitRegistry == null) {
root$2.__PlasmicTraitRegistry = [];
}
function registerTrait(trait, meta) {
root$5.__PlasmicTraitRegistry.push({
trait: trait,
meta: meta
});
root$2.__PlasmicTraitRegistry.push({
trait: trait,
meta: meta,
});
}
var _root$__Sub$setRepeat, _root$__Sub;
var _a, _b;
function repeatedElement(index, elt) {
return _repeatedElementFn(index, elt);
return repeatedElementFn(index, elt);
}
var _repeatedElementFn = function repeatedElementFn(index, elt) {
if (Array.isArray(elt)) {
return elt.map(function (v) {
return _repeatedElementFn(index, v);
});
}
if (elt && isValidElement(elt) && typeof elt !== "string") {
return cloneElement(elt);
}
return elt;
var repeatedElementFn = function (index, elt) {
if (Array.isArray(elt)) {
return elt.map(function (v) { return repeatedElementFn(index, v); });
}
if (elt && isValidElement(elt) && typeof elt !== "string") {
return cloneElement(elt);
}
return elt;
};
var root$6 = globalThis;
var setRepeatedElementFn = (_root$__Sub$setRepeat = root$6 == null ? void 0 : (_root$__Sub = root$6.__Sub) == null ? void 0 : _root$__Sub.setRepeatedElementFn) != null ? _root$__Sub$setRepeat : function (fn) {
_repeatedElementFn = fn;
var root$1 = globalThis;
var setRepeatedElementFn = (_b = (_a = root$1 === null || root$1 === void 0 ? void 0 : root$1.__Sub) === null || _a === void 0 ? void 0 : _a.setRepeatedElementFn) !== null && _b !== void 0 ? _b : function (fn) {
repeatedElementFn = fn;
};
var hostModule = {
var hostModule = /*#__PURE__*/Object.freeze({
__proto__: null,

@@ -534,29 +419,26 @@ PlasmicCanvasContext: PlasmicCanvasContext,

useGlobalActions: useGlobalActions
};
});
var hostVersion = "1.0.128";
var hostVersion = "1.0.129";
var root$7 = globalThis;
if (root$7.__Sub == null) {
// Creating a side effect here by logging, so that vite won't
// ignore this block for whatever reason. Hiding this for now
// as users are complaining; will have to check if this has
// been fixed with vite.
// console.log("Plasmic: Setting up app host dependencies");
root$7.__Sub = /*#__PURE__*/_extends({
React: React,
ReactDOM: ReactDOM,
PlasmicQuery: PlasmicQuery,
hostModule: hostModule,
hostVersion: hostVersion,
hostUtils: {
setPlasmicRootNode: setPlasmicRootNode,
registerRenderErrorListener: registerRenderErrorListener,
setRepeatedElementFn: setRepeatedElementFn
},
// For backwards compatibility:
setPlasmicRootNode: setPlasmicRootNode,
registerRenderErrorListener: registerRenderErrorListener,
setRepeatedElementFn: setRepeatedElementFn
}, hostModule);
var root = globalThis;
if (root.__Sub == null) {
// Creating a side effect here by logging, so that vite won't
// ignore this block for whatever reason. Hiding this for now
// as users are complaining; will have to check if this has
// been fixed with vite.
// console.log("Plasmic: Setting up app host dependencies");
root.__Sub = __assign({ React: React,
ReactDOM: ReactDOM,
PlasmicQuery: PlasmicQuery,
hostModule: hostModule,
hostVersion: hostVersion, hostUtils: {
setPlasmicRootNode: setPlasmicRootNode,
registerRenderErrorListener: registerRenderErrorListener,
setRepeatedElementFn: setRepeatedElementFn,
},
// For backwards compatibility:
setPlasmicRootNode: setPlasmicRootNode,
registerRenderErrorListener: registerRenderErrorListener,
setRepeatedElementFn: setRepeatedElementFn }, hostModule);
}

@@ -563,0 +445,0 @@

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

export declare const hostVersion = "1.0.128";
export declare const hostVersion = "1.0.129";
{
"name": "@plasmicapp/host",
"version": "1.0.128",
"version": "1.0.129",
"description": "plasmic library for app hosting",
"main": "dist/index.js",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts",

@@ -41,5 +41,5 @@ "module": "dist/host.esm.js",

"scripts": {
"build": "./update_version.sh && tsdx build && rollup -c",
"build": "./update_version.sh && rollup -c",
"postbuild": "yarn postbuild:default && yarn postbuild:registerComponent && yarn postbuild:registerGlobalContext && yarn postbuild:registerToken && yarn postbuild:registerTrait",
"postbuild:default": "node ../../print-module-api.js ./packages/host/dist/index.js > index-api.txt",
"postbuild:default": "node ../../print-module-api.js ./packages/host/dist/index.cjs.js > index-api.txt",
"postbuild:registerComponent": "node ../../print-module-api.js ./packages/host/registerComponent/dist/index.cjs.js > registerComponent-api.txt",

@@ -85,3 +85,3 @@ "postbuild:registerGlobalContext": "node ../../print-module-api.js ./packages/host/registerGlobalContext/dist/index.cjs.js > registerGlobalContext-api.txt",

},
"gitHead": "361c3f2e99d74b4feaeca0f27a9e8875718fcaee"
"gitHead": "58e0dbd862668273e0fa3d4e4790e8c818935952"
}

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