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

@remote-ui/react

Package Overview
Dependencies
Maintainers
3
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remote-ui/react - npm Package Compare versions

Comparing version 4.5.13 to 4.6.0

2

build/cjs/index.js

@@ -9,2 +9,3 @@ 'use strict';

var components = require('./components.js');
var reconciler = require('./reconciler.js');
var subscription = require('./hooks/subscription.js');

@@ -28,2 +29,3 @@

exports.createRemoteReactComponent = components.createRemoteReactComponent;
exports.createReconciler = reconciler.createReconciler;
exports.useRemoteSubscription = subscription.useRemoteSubscription;

234

build/cjs/reconciler.js

@@ -11,147 +11,151 @@ 'use strict';

const reconciler = reactReconciler__default["default"]({
now: Date.now,
// Timeout
scheduleTimeout: setTimeout,
cancelTimeout: clearTimeout,
noTimeout: false,
// @see https://github.com/facebook/react/blob/master/packages/react-dom/src/client/ReactDOMHostConfig.js#L408
queueMicrotask: callback => Promise.resolve(null).then(callback).catch(handleErrorInNextTick),
isPrimaryRenderer: true,
supportsMutation: true,
supportsHydration: false,
supportsPersistence: false,
const createReconciler = options => {
var _options$primary;
// Context
getRootHostContext() {
return {};
},
return reactReconciler__default["default"]({
now: Date.now,
// Timeout
scheduleTimeout: setTimeout,
cancelTimeout: clearTimeout,
noTimeout: false,
// @see https://github.com/facebook/react/blob/master/packages/react-dom/src/client/ReactDOMHostConfig.js#L408
queueMicrotask: callback => Promise.resolve(null).then(callback).catch(handleErrorInNextTick),
isPrimaryRenderer: (_options$primary = options === null || options === void 0 ? void 0 : options.primary) !== null && _options$primary !== void 0 ? _options$primary : true,
supportsMutation: true,
supportsHydration: false,
supportsPersistence: false,
getChildHostContext(context) {
return context;
},
// Context
getRootHostContext() {
return {};
},
// Instances
createTextInstance(text, root) {
return root.createText(text);
},
getChildHostContext(context) {
return context;
},
createInstance(type, allProps, root) {
const {
children: _children,
...props
} = allProps;
return root.createComponent(type, props);
},
// Instances
createTextInstance(text, root) {
return root.createText(text);
},
// Updates
commitTextUpdate(text, _oldText, newText) {
text.updateText(newText);
},
createInstance(type, allProps, root) {
const {
children: _children,
...props
} = allProps;
return root.createComponent(type, props);
},
prepareUpdate(_instance, _type, oldProps, newProps) {
const updateProps = {};
let needsUpdate = false;
// Updates
commitTextUpdate(text, _oldText, newText) {
text.update(newText);
},
for (const key in oldProps) {
if (!has(oldProps, key) || key === 'children') {
continue;
}
prepareUpdate(_instance, _type, oldProps, newProps) {
const updateProps = {};
let needsUpdate = false;
if (!(key in newProps)) {
needsUpdate = true;
updateProps[key] = undefined; // } else if (typeof oldProps[key] === 'function') {
// if (typeof newProps[key] === 'function') {
// fragment.controller.functions.exchange(
// oldProps[key] as Function,
// newProps[key] as Function,
// );
// } else {
// needsUpdate = true;
// fragment.controller.functions.revoke(oldProps[key] as Function);
// updateProps[key] = newProps[key];
// }
} else if (oldProps[key] !== newProps[key]) {
needsUpdate = true;
updateProps[key] = newProps[key];
}
}
for (const key in oldProps) {
if (!has(oldProps, key) || key === 'children') {
continue;
}
for (const key in newProps) {
if (!has(newProps, key) || key === 'children') {
continue;
if (!(key in newProps)) {
needsUpdate = true;
updateProps[key] = undefined; // } else if (typeof oldProps[key] === 'function') {
// if (typeof newProps[key] === 'function') {
// fragment.controller.functions.exchange(
// oldProps[key] as Function,
// newProps[key] as Function,
// );
// } else {
// needsUpdate = true;
// fragment.controller.functions.revoke(oldProps[key] as Function);
// updateProps[key] = newProps[key];
// }
} else if (oldProps[key] !== newProps[key]) {
needsUpdate = true;
updateProps[key] = newProps[key];
}
}
if (!(key in oldProps)) {
needsUpdate = true;
updateProps[key] = newProps[key];
for (const key in newProps) {
if (!has(newProps, key) || key === 'children') {
continue;
}
if (!(key in oldProps)) {
needsUpdate = true;
updateProps[key] = newProps[key];
}
}
}
return needsUpdate ? updateProps : null;
},
return needsUpdate ? updateProps : null;
},
commitUpdate(instance, payload) {
instance.updateProps(payload);
},
commitUpdate(instance, payload) {
instance.updateProps(payload);
},
// Update root
appendChildToContainer(remoteRoot, child) {
remoteRoot.appendChild(child);
},
// Update root
appendChildToContainer(remoteRoot, child) {
remoteRoot.append(child);
},
insertInContainerBefore(remoteRoot, child, beforeChild) {
remoteRoot.insertChildBefore(child, beforeChild);
},
insertInContainerBefore(remoteRoot, child, beforeChild) {
remoteRoot.insertBefore(child, beforeChild);
},
removeChildFromContainer(remoteRoot, child) {
remoteRoot.removeChild(child);
},
clearContainer(remoteRoot) {
for (const child of remoteRoot.children) {
removeChildFromContainer(remoteRoot, child) {
remoteRoot.removeChild(child);
}
},
},
// Update children
appendInitialChild(parent, child) {
parent.appendChild(child);
},
clearContainer(remoteRoot) {
for (const child of remoteRoot.children) {
remoteRoot.removeChild(child);
}
},
appendChild(parent, child) {
parent.appendChild(child);
},
// Update children
appendInitialChild(parent, child) {
parent.append(child);
},
insertBefore(parent, newChild, beforeChild) {
parent.insertChildBefore(newChild, beforeChild);
},
appendChild(parent, child) {
parent.append(child);
},
removeChild(parent, child) {
parent.removeChild(child);
},
insertBefore(parent, newChild, beforeChild) {
parent.insertBefore(newChild, beforeChild);
},
// Unknown
finalizeInitialChildren() {
return false;
},
removeChild(parent, child) {
parent.removeChild(child);
},
shouldSetTextContent() {
return false;
},
// Unknown
finalizeInitialChildren() {
return false;
},
getPublicInstance() {},
shouldSetTextContent() {
return false;
},
prepareForCommit() {
return null;
},
getPublicInstance() {},
resetAfterCommit() {},
prepareForCommit() {
return null;
},
commitMount() {},
resetAfterCommit() {},
preparePortalMount() {}
commitMount() {},
});
preparePortalMount() {}
});
};
function handleErrorInNextTick(error) {

@@ -171,2 +175,2 @@ setTimeout(() => {

exports.reconciler = reconciler;
exports.createReconciler = createReconciler;

@@ -13,3 +13,4 @@ 'use strict';

const LEGACY_ROOT = 0;
function render(element, root, callback) {
const defaultReconciler = reconciler.createReconciler();
function render(element, root, callback, reconciler = defaultReconciler) {
// First, check if we've already cached a container and render context for this root

@@ -21,7 +22,7 @@ let cached = cache.get(root);

const value = {
container: reconciler.reconciler.createContainer(root, LEGACY_ROOT, false, null),
container: reconciler.createContainer(root, LEGACY_ROOT, false, null),
// We also cache the render context to avoid re-creating it on subsequent render calls
renderContext: {
root,
reconciler: reconciler.reconciler
reconciler
}

@@ -40,3 +41,3 @@ }; // Store the container and render context for retrieval on subsequent render calls

reconciler.reconciler.updateContainer( /*#__PURE__*/jsxRuntime.jsx(context.RenderContext.Provider, {
reconciler.updateContainer( /*#__PURE__*/jsxRuntime.jsx(context.RenderContext.Provider, {
value: renderContext,

@@ -43,0 +44,0 @@ children: element

@@ -8,2 +8,4 @@ export { retain, release } from '@remote-ui/rpc';

export type { ReactPropsFromRemoteComponentType, ReactComponentTypeFromRemoteComponentType, } from './types';
export { createReconciler } from './reconciler';
export type { Reconciler } from './reconciler';
//# sourceMappingURL=index.d.ts.map

@@ -8,4 +8,6 @@ import reactReconciler, { Reconciler as ReactReconciler } from 'react-reconciler';

export declare type Reconciler = ReactReconciler<RemoteRoot, ViewInstance, TextInstance, SuspenseInstance, PublicInstance>;
export declare const reconciler: reactReconciler.Reconciler<RemoteRoot<any, true>, ViewInstance, TextInstance, never, unknown>;
export declare const createReconciler: (options?: {
primary?: boolean | undefined;
} | undefined) => reactReconciler.Reconciler<RemoteRoot<any, true>, ViewInstance, TextInstance, never, unknown>;
export {};
//# sourceMappingURL=reconciler.d.ts.map
import type { ReactElement } from 'react';
import type { RemoteRoot } from '@remote-ui/core';
export declare function render(element: ReactElement, root: RemoteRoot<any, any>, callback?: () => void): void;
import type { Reconciler } from './reconciler';
export declare function render(element: ReactElement, root: RemoteRoot<any, any>, callback?: () => void, reconciler?: Reconciler): void;
//# sourceMappingURL=render.d.ts.map
# Changelog
All notable changes to this project will be documented in this file.
## 4.6.0
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### Minor Changes
## [Unreleased]
- [#197](https://github.com/Shopify/remote-ui/pull/197) [`e15d142`](https://github.com/Shopify/remote-ui/commit/e15d1423f3759bdf9368d1fe3964347fd8a0c301) Thanks [@lemonmade](https://github.com/lemonmade)! - Added a number of methods that align more closely with the corresponding DOM API, and deprecated a few existing methods with overlapping functionality:
- `RemoteParent.appendChild` is deprecated, with a new `RemoteParent.append` API recommended instead. This new API matches the [`Element.append`](https://developer.mozilla.org/en-US/docs/Web/API/Element/append) DOM API: it allows you to pass multiple children, including strings that are converted to text nodes.
- `RemoteParent.insertChildBefore` is deprecated, with a new `RemoteParent.insertBefore` API recommended instead. This matches the [`Node.insertBefore`](https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore) DOM API, including the fact that the second argument can be null (in which case, the method behaves the same as `append`
- `RemoteParent.replaceChildren` is new, and matches the [`Element.replaceChildren`](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren) DOM API. It allows passing any number of children/ strings, and those are used to fully replace the existing children.
- `RemoteComponent.remove` and `RemoteText.remove` are new, and match the [`Element.remove`](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) DOM API.
- `RemoteText.updateText` is deprecated in favor of a new `RemoteText.update` method, which is a little shorter.
### Patch Changes
- Updated dependencies [[`e15d142`](https://github.com/Shopify/remote-ui/commit/e15d1423f3759bdf9368d1fe3964347fd8a0c301)]:
- @remote-ui/core@2.2.0
- @remote-ui/rpc@1.4.0
## [4.5.1] - 2022-05-16

@@ -11,0 +22,0 @@

{
"name": "@remote-ui/react",
"version": "4.5.13",
"version": "4.6.0",
"publishConfig": {

@@ -40,9 +40,8 @@ "access": "public",

"@remote-ui/async-subscription": "^2.1.13",
"@remote-ui/core": "^2.1.16",
"@remote-ui/rpc": "^1.3.4",
"@remote-ui/core": "^2.2.0",
"@remote-ui/rpc": "^1.4.0",
"@types/react": ">=17.0.0 <18.0.0",
"@types/react-reconciler": "^0.26.0",
"react-reconciler": ">=0.26.0 <0.27.0"
},
"gitHead": "607480889c7d85403643c1ebb394d6e683e6e15c"
}
}

@@ -11,1 +11,3 @@ export {retain, release} from '@remote-ui/rpc';

} from './types';
export {createReconciler} from './reconciler';
export type {Reconciler} from './reconciler';

@@ -30,144 +30,145 @@ import reactReconciler, {Reconciler as ReactReconciler} from 'react-reconciler';

export const reconciler = reactReconciler<
Type,
Props,
RemoteRoot,
ViewInstance,
TextInstance,
SuspenseInstance,
HydratableInstance,
PublicInstance,
HostContext,
UpdatePayload,
ChildSet,
TimeoutHandle,
NoTimeout
>({
now: Date.now,
export const createReconciler = (options?: {primary?: boolean}) =>
reactReconciler<
Type,
Props,
RemoteRoot,
ViewInstance,
TextInstance,
SuspenseInstance,
HydratableInstance,
PublicInstance,
HostContext,
UpdatePayload,
ChildSet,
TimeoutHandle,
NoTimeout
>({
now: Date.now,
// Timeout
scheduleTimeout: setTimeout,
cancelTimeout: clearTimeout,
noTimeout: false,
// @see https://github.com/facebook/react/blob/master/packages/react-dom/src/client/ReactDOMHostConfig.js#L408
queueMicrotask: (callback) =>
Promise.resolve(null).then(callback).catch(handleErrorInNextTick),
// Timeout
scheduleTimeout: setTimeout,
cancelTimeout: clearTimeout,
noTimeout: false,
// @see https://github.com/facebook/react/blob/master/packages/react-dom/src/client/ReactDOMHostConfig.js#L408
queueMicrotask: (callback) =>
Promise.resolve(null).then(callback).catch(handleErrorInNextTick),
isPrimaryRenderer: true,
supportsMutation: true,
supportsHydration: false,
supportsPersistence: false,
isPrimaryRenderer: options?.primary ?? true,
supportsMutation: true,
supportsHydration: false,
supportsPersistence: false,
// Context
getRootHostContext() {
return {};
},
getChildHostContext(context) {
return context;
},
// Context
getRootHostContext() {
return {};
},
getChildHostContext(context) {
return context;
},
// Instances
createTextInstance(text, root) {
return root.createText(text);
},
createInstance(type, allProps, root) {
const {children: _children, ...props} = allProps;
return root.createComponent(type, props);
},
// Instances
createTextInstance(text, root) {
return root.createText(text);
},
createInstance(type, allProps, root) {
const {children: _children, ...props} = allProps;
return root.createComponent(type, props);
},
// Updates
commitTextUpdate(text, _oldText, newText) {
text.updateText(newText);
},
prepareUpdate(_instance, _type, oldProps, newProps) {
const updateProps: Record<string, unknown> = {};
let needsUpdate = false;
// Updates
commitTextUpdate(text, _oldText, newText) {
text.update(newText);
},
prepareUpdate(_instance, _type, oldProps, newProps) {
const updateProps: Record<string, unknown> = {};
let needsUpdate = false;
for (const key in oldProps) {
if (!has(oldProps, key) || key === 'children') {
continue;
}
for (const key in oldProps) {
if (!has(oldProps, key) || key === 'children') {
continue;
}
if (!(key in newProps)) {
needsUpdate = true;
updateProps[key] = undefined;
// } else if (typeof oldProps[key] === 'function') {
// if (typeof newProps[key] === 'function') {
// fragment.controller.functions.exchange(
// oldProps[key] as Function,
// newProps[key] as Function,
// );
// } else {
// needsUpdate = true;
// fragment.controller.functions.revoke(oldProps[key] as Function);
// updateProps[key] = newProps[key];
// }
} else if (oldProps[key] !== newProps[key]) {
needsUpdate = true;
updateProps[key] = newProps[key];
if (!(key in newProps)) {
needsUpdate = true;
updateProps[key] = undefined;
// } else if (typeof oldProps[key] === 'function') {
// if (typeof newProps[key] === 'function') {
// fragment.controller.functions.exchange(
// oldProps[key] as Function,
// newProps[key] as Function,
// );
// } else {
// needsUpdate = true;
// fragment.controller.functions.revoke(oldProps[key] as Function);
// updateProps[key] = newProps[key];
// }
} else if (oldProps[key] !== newProps[key]) {
needsUpdate = true;
updateProps[key] = newProps[key];
}
}
}
for (const key in newProps) {
if (!has(newProps, key) || key === 'children') {
continue;
}
for (const key in newProps) {
if (!has(newProps, key) || key === 'children') {
continue;
}
if (!(key in oldProps)) {
needsUpdate = true;
updateProps[key] = newProps[key];
if (!(key in oldProps)) {
needsUpdate = true;
updateProps[key] = newProps[key];
}
}
}
return needsUpdate ? updateProps : null;
},
commitUpdate(instance, payload) {
instance.updateProps(payload);
},
return needsUpdate ? updateProps : null;
},
commitUpdate(instance, payload) {
instance.updateProps(payload);
},
// Update root
appendChildToContainer(remoteRoot, child) {
remoteRoot.appendChild(child);
},
insertInContainerBefore(remoteRoot, child, beforeChild) {
remoteRoot.insertChildBefore(child, beforeChild);
},
removeChildFromContainer(remoteRoot, child) {
remoteRoot.removeChild(child);
},
clearContainer(remoteRoot) {
for (const child of remoteRoot.children) {
// Update root
appendChildToContainer(remoteRoot, child) {
remoteRoot.append(child);
},
insertInContainerBefore(remoteRoot, child, beforeChild) {
remoteRoot.insertBefore(child, beforeChild);
},
removeChildFromContainer(remoteRoot, child) {
remoteRoot.removeChild(child);
}
},
},
clearContainer(remoteRoot) {
for (const child of remoteRoot.children) {
remoteRoot.removeChild(child);
}
},
// Update children
appendInitialChild(parent, child) {
parent.appendChild(child);
},
appendChild(parent, child) {
parent.appendChild(child);
},
insertBefore(parent, newChild, beforeChild) {
parent.insertChildBefore(newChild, beforeChild);
},
removeChild(parent, child) {
parent.removeChild(child);
},
// Update children
appendInitialChild(parent, child) {
parent.append(child);
},
appendChild(parent, child) {
parent.append(child);
},
insertBefore(parent, newChild, beforeChild) {
parent.insertBefore(newChild, beforeChild);
},
removeChild(parent, child) {
parent.removeChild(child);
},
// Unknown
finalizeInitialChildren() {
return false;
},
shouldSetTextContent() {
return false;
},
getPublicInstance() {},
prepareForCommit() {
return null;
},
resetAfterCommit() {},
commitMount() {},
preparePortalMount() {},
});
// Unknown
finalizeInitialChildren() {
return false;
},
shouldSetTextContent() {
return false;
},
getPublicInstance() {},
prepareForCommit() {
return null;
},
resetAfterCommit() {},
commitMount() {},
preparePortalMount() {},
});

@@ -174,0 +175,0 @@ function handleErrorInNextTick(error: Error) {

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

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

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