New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@servlyadmin/runtime-react

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@servlyadmin/runtime-react - npm Package Compare versions

Comparing version
0.1.39
to
0.1.40
+29
-2
dist/index.cjs
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;

@@ -18,2 +20,10 @@ var __export = (target, all) => {

};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

@@ -41,3 +51,3 @@

// src/ServlyComponent.tsx
var import_react = require("react");
var import_react = __toESM(require("react"), 1);
var import_react_dom = require("react-dom");

@@ -103,2 +113,5 @@ var import_runtime_core = require("@servlyadmin/runtime-core");

);
function isReactElement(value) {
return import_react.default.isValidElement(value);
}
function useSlotElements(containerRef, isRendered) {

@@ -149,2 +162,6 @@ const [slotElements, setSlotElements] = (0, import_react.useState)({});

const slotElements = useSlotElements(containerRef, isRendered);
const slotBindings = (0, import_react.useMemo)(() => {
if (!state.data?.layout) return /* @__PURE__ */ new Map();
return (0, import_runtime_core.extractSlotBindings)(state.data.layout);
}, [state.data?.layout]);
const effectiveSlots = (0, import_react.useMemo)(() => {

@@ -155,4 +172,14 @@ const result = { ...slots };

}
if (props && typeof props === "object") {
for (const [propName, propValue] of Object.entries(props)) {
if (isReactElement(propValue)) {
const slotId = slotBindings.get(propName);
if (slotId && !result[slotId]) {
result[slotId] = propValue;
}
}
}
}
return result;
}, [slots, children]);
}, [slots, children, props, slotBindings]);
const loadComponent = (0, import_react.useCallback)(async () => {

@@ -159,0 +186,0 @@ if (abortControllerRef.current) {

// src/ServlyComponent.tsx
import { useRef, useEffect, useState, useCallback, useMemo } from "react";
import React, { useRef, useEffect, useState, useCallback, useMemo } from "react";
import { createPortal } from "react-dom";

@@ -8,3 +8,4 @@ import {

markElementReady,
injectTailwind
injectTailwind,
extractSlotBindings
} from "@servlyadmin/runtime-core";

@@ -69,2 +70,5 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";

);
function isReactElement(value) {
return React.isValidElement(value);
}
function useSlotElements(containerRef, isRendered) {

@@ -115,2 +119,6 @@ const [slotElements, setSlotElements] = useState({});

const slotElements = useSlotElements(containerRef, isRendered);
const slotBindings = useMemo(() => {
if (!state.data?.layout) return /* @__PURE__ */ new Map();
return extractSlotBindings(state.data.layout);
}, [state.data?.layout]);
const effectiveSlots = useMemo(() => {

@@ -121,4 +129,14 @@ const result = { ...slots };

}
if (props && typeof props === "object") {
for (const [propName, propValue] of Object.entries(props)) {
if (isReactElement(propValue)) {
const slotId = slotBindings.get(propName);
if (slotId && !result[slotId]) {
result[slotId] = propValue;
}
}
}
}
return result;
}, [slots, children]);
}, [slots, children, props, slotBindings]);
const loadComponent = useCallback(async () => {

@@ -125,0 +143,0 @@ if (abortControllerRef.current) {

+1
-1
{
"name": "@servlyadmin/runtime-react",
"version": "0.1.39",
"version": "0.1.40",
"description": "React wrapper for Servly runtime renderer",

@@ -5,0 +5,0 @@ "type": "module",