@remote-ui/react
Advanced tools
Comparing version 4.5.13 to 5.0.0-alpha.0
@@ -11,3 +11,7 @@ 'use strict'; | ||
const scheduleMicrotask = callback => typeof queueMicrotask === 'function' ? queueMicrotask : Promise.resolve(null).then(callback).catch(handleErrorInNextTick); | ||
const reconciler = reactReconciler__default["default"]({ | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore - Compat for React <= 17.x | ||
now: Date.now, | ||
@@ -18,4 +22,12 @@ // Timeout | ||
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), | ||
// Microtask scheduling | ||
// @see https://github.com/facebook/react/blob/2c8a1452b82b9ec5ebfa3f370b31fda19610ae92/packages/react-dom/src/client/ReactDOMHostConfig.js#L391-L401 | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore - types in `@types/react-reconciler` are outdated | ||
supportsMicrotasks: true, | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore - types in `@types/react-reconciler` are outdated | ||
scheduleMicrotask, | ||
// Compat for React <= 17.x | ||
queueMicrotask: scheduleMicrotask, | ||
isPrimaryRenderer: true, | ||
@@ -22,0 +34,0 @@ supportsMutation: true, |
@@ -5,2 +5,3 @@ 'use strict'; | ||
var react = require('react'); | ||
var reconciler = require('./reconciler.js'); | ||
@@ -10,4 +11,4 @@ var context = require('./context.js'); | ||
const cache = new WeakMap(); // @see https://github.com/facebook/react/blob/993ca533b42756811731f6b7791ae06a35ee6b4d/packages/react-reconciler/src/ReactRootTags.js | ||
// I think we are a legacy root? | ||
const cache = new WeakMap(); // @see https://github.com/facebook/react/blob/fea6f8da6ab669469f2fa3f18bd3a831f00ab284/packages/react-reconciler/src/ReactRootTags.js#L12 | ||
// We don't support concurrent rendering for now. | ||
@@ -20,5 +21,11 @@ const LEGACY_ROOT = 0; | ||
if (!cached) { | ||
// Since we haven't created a container for this root yet, create a new one | ||
var _version$split; | ||
const major = Number(((_version$split = react.version.split('.')) === null || _version$split === void 0 ? void 0 : _version$split[0]) || 18); // Since we haven't created a container for this root yet, create a new one | ||
const value = { | ||
container: reconciler.reconciler.createContainer(root, LEGACY_ROOT, false, null), | ||
container: major >= 18 ? reconciler.reconciler.createContainer(root, LEGACY_ROOT, null, false, null, // Might not be necessary | ||
'r-ui', () => null, null) : // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore - TS doesn't support multiple type versions of the same package | ||
reconciler.reconciler.createContainer(root, LEGACY_ROOT, false, null), | ||
// We also cache the render context to avoid re-creating it on subsequent render calls | ||
@@ -25,0 +32,0 @@ renderContext: { |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import type { RemoteRoot } from '@remote-ui/core'; | ||
@@ -3,0 +2,0 @@ import type { Reconciler } from './reconciler'; |
@@ -1,4 +0,3 @@ | ||
/// <reference types="react" /> | ||
import type { RemoteComponentProps } from './types'; | ||
export declare const RemoteComponent: import("react").NamedExoticComponent<RemoteComponentProps>; | ||
//# sourceMappingURL=RemoteComponent.d.ts.map |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import { RemoteReceiver } from '@remote-ui/core'; | ||
@@ -3,0 +2,0 @@ import type { Controller } from './types'; |
@@ -1,4 +0,3 @@ | ||
/// <reference types="react" /> | ||
import type { RemoteTextProps } from './types'; | ||
export declare const RemoteText: import("react").NamedExoticComponent<RemoteTextProps>; | ||
//# sourceMappingURL=RemoteText.d.ts.map |
@@ -1,2 +0,3 @@ | ||
import reactReconciler, { Reconciler as ReactReconciler } from 'react-reconciler'; | ||
import reactReconciler from 'react-reconciler'; | ||
import type { Reconciler as ReactReconciler } from 'react-reconciler'; | ||
import type { RemoteRoot, RemoteText, RemoteComponent } from '@remote-ui/core'; | ||
@@ -3,0 +4,0 @@ declare type ViewInstance = RemoteComponent<any, any>; |
import type { ReactNode, ComponentType, ReactElement } from 'react'; | ||
import type { RemoteComponentType, RemoteFragment } from '@remote-ui/core'; | ||
declare type PropsForRemoteComponent<T> = T extends RemoteComponentType<string, infer Props, any> ? Props extends Record<string, never> ? {} : { | ||
declare type PropsForRemoteComponent<T> = T extends RemoteComponentType<string, infer Props, any> ? { | ||
[K in keyof Props]: RemoteFragmentToReactElement<Props[K]>; | ||
@@ -5,0 +5,0 @@ } : never; |
{ | ||
"name": "@remote-ui/react", | ||
"version": "4.5.13", | ||
"version": "5.0.0-alpha.0", | ||
"publishConfig": { | ||
@@ -26,2 +26,3 @@ "access": "public", | ||
}, | ||
"./": "./", | ||
"./host": { | ||
@@ -35,15 +36,26 @@ "esnext": "./host.esnext", | ||
"devDependencies": { | ||
"@types/react-dom": "^17.0.0", | ||
"react": "^17.0.0", | ||
"react-dom": "^17.0.0" | ||
"@types/react-dom": "^18.0.5", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-reconciler": "^0.29.0" | ||
}, | ||
"dependencies": { | ||
"@remote-ui/async-subscription": "^2.1.13", | ||
"@remote-ui/core": "^2.1.16", | ||
"@remote-ui/rpc": "^1.3.4", | ||
"@types/react": ">=17.0.0 <18.0.0", | ||
"@types/react-reconciler": "^0.26.0", | ||
"react-reconciler": ">=0.26.0 <0.27.0" | ||
"@remote-ui/async-subscription": "^2.1.9", | ||
"@remote-ui/core": "^2.1.9", | ||
"@remote-ui/rpc": "^1.3.0", | ||
"@types/react": ">=17.0.0 <19.0.0", | ||
"@types/react-reconciler": ">=0.26.0 <0.30.0" | ||
}, | ||
"gitHead": "607480889c7d85403643c1ebb394d6e683e6e15c" | ||
"peerDependencies": { | ||
"react": ">=17.0.0", | ||
"react-reconciler": ">=0.26.0 <0.30.0" | ||
}, | ||
"peerDependenciesMeta": { | ||
"react": { | ||
"optional": false | ||
}, | ||
"react-reconciler": { | ||
"optional": true | ||
} | ||
} | ||
} |
@@ -19,2 +19,28 @@ # `@remote-ui/react` | ||
### React peer dependencies | ||
This package also has peer dependencies on a few React-related packages, but the versions you need depend on the version of React you are using: | ||
**React 17.x.x**: you will need to have React installed. Additionally, if you are in the “remote” environment, you will need a dependency on `react-reconciler` between greater than or equal to `0.26.0`, and less than `0.28.0`: | ||
``` | ||
yarn add react@^17.0.0 react-reconciler@^0.27.0 | ||
# or, with `npm`: | ||
npm install react@^17.0.0 react-reconciler@^0.27.0 --save | ||
``` | ||
**React 17.0.0 and later**: you will need to have React installed. Additionally, if you are in the “remote” environment, you will need a dependency on `react-reconciler` between greater than or equal to `0.28.0`: | ||
``` | ||
yarn add react react-reconciler | ||
# or, with `npm`: | ||
npm install react react-reconciler --save | ||
``` | ||
If you are only using the utilities for [React host applications](#host-environment), you do not need to declare a dependency on `react-reconciler`. | ||
## Usage | ||
@@ -21,0 +47,0 @@ |
@@ -1,2 +0,3 @@ | ||
import reactReconciler, {Reconciler as ReactReconciler} from 'react-reconciler'; | ||
import reactReconciler from 'react-reconciler'; | ||
import type {Reconciler as ReactReconciler} from 'react-reconciler'; | ||
import type { | ||
@@ -30,2 +31,7 @@ RemoteRoot, | ||
const scheduleMicrotask = (callback: () => void) => | ||
typeof queueMicrotask === 'function' | ||
? queueMicrotask | ||
: Promise.resolve(null).then(callback).catch(handleErrorInNextTick); | ||
export const reconciler = reactReconciler< | ||
@@ -46,2 +52,4 @@ Type, | ||
>({ | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore - Compat for React <= 17.x | ||
now: Date.now, | ||
@@ -53,6 +61,15 @@ | ||
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), | ||
// Microtask scheduling | ||
// @see https://github.com/facebook/react/blob/2c8a1452b82b9ec5ebfa3f370b31fda19610ae92/packages/react-dom/src/client/ReactDOMHostConfig.js#L391-L401 | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore - types in `@types/react-reconciler` are outdated | ||
supportsMicrotasks: true, | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore - types in `@types/react-reconciler` are outdated | ||
scheduleMicrotask, | ||
// Compat for React <= 17.x | ||
queueMicrotask: scheduleMicrotask, | ||
isPrimaryRenderer: true, | ||
@@ -59,0 +76,0 @@ supportsMutation: true, |
@@ -9,6 +9,3 @@ import type {ReactNode, ComponentType, ReactElement} from 'react'; | ||
> | ||
? Props extends Record<string, never> | ||
? // eslint-disable-next-line @typescript-eslint/ban-types | ||
{} | ||
: {[K in keyof Props]: RemoteFragmentToReactElement<Props[K]>} | ||
? {[K in keyof Props]: RemoteFragmentToReactElement<Props[K]>} | ||
: never; | ||
@@ -15,0 +12,0 @@ |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
188685
127
3066
364
7
4
2
+ Added@types/react@18.3.18(transitive)
+ Added@types/react-reconciler@0.28.9(transitive)
+ Addedreact@18.3.119.0.0(transitive)
+ Addedreact-reconciler@0.29.2(transitive)
+ Addedscheduler@0.23.2(transitive)
- Removedreact-reconciler@>=0.26.0 <0.27.0
- Removed@types/react@17.0.83(transitive)
- Removed@types/react-reconciler@0.26.7(transitive)
- Removed@types/scheduler@0.16.8(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedreact@17.0.2(transitive)
- Removedreact-reconciler@0.26.2(transitive)
- Removedscheduler@0.20.2(transitive)
Updated@remote-ui/core@^2.1.9
Updated@remote-ui/rpc@^1.3.0