Comparing version 2.1.0 to 2.1.1
@@ -10,2 +10,3 @@ "use strict"; | ||
}; | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/ban-types | ||
var wrapDisplayName = function (BaseComponent, wrapperName) { | ||
@@ -12,0 +13,0 @@ return "".concat(wrapperName, "(").concat(getDisplayName(BaseComponent), ")"); |
@@ -15,2 +15,3 @@ "use strict"; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
function fromObservable(input$) { | ||
@@ -27,2 +28,3 @@ return function ReactiveComponent() { | ||
exports.reactiveComponent = reactiveComponent; | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/ban-types | ||
function forwardRef(component) { | ||
@@ -29,0 +31,0 @@ var wrappedComponent = (0, react_1.forwardRef)(function (props, ref) { |
@@ -10,3 +10,5 @@ "use strict"; | ||
function observeState(initial) { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
var _a = (0, react_1.useState)(initial), value = _a[0], update = _a[1]; | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
return [(0, useAsObservable_1.useAsObservable)(value), update]; | ||
@@ -16,2 +18,3 @@ } | ||
function observeCallback(operator) { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
var ref = (0, react_1.useRef)(); | ||
@@ -25,2 +28,3 @@ if (!ref.current) { | ||
function observeContext(context) { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
return (0, useAsObservable_1.useAsObservable)((0, react_1.useContext)(context)); | ||
@@ -30,2 +34,3 @@ } | ||
function observeElement() { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
var ref = (0, react_1.useRef)(); | ||
@@ -32,0 +37,0 @@ if (!ref.current) { |
@@ -7,2 +7,3 @@ const getDisplayName = (Component) => { | ||
}; | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/ban-types | ||
export const wrapDisplayName = (BaseComponent, wrapperName) => `${wrapperName}(${getDisplayName(BaseComponent)})`; |
@@ -12,2 +12,3 @@ import { wrapDisplayName } from './displayName'; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
function fromObservable(input$) { | ||
@@ -23,2 +24,3 @@ return function ReactiveComponent() { | ||
} | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/ban-types | ||
export function forwardRef(component) { | ||
@@ -25,0 +27,0 @@ const wrappedComponent = reactForwardRef((props, ref) => { |
@@ -7,6 +7,9 @@ import { useAsObservable } from './useAsObservable'; | ||
export function observeState(initial) { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
const [value, update] = useState(initial); | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
return [useAsObservable(value), update]; | ||
} | ||
export function observeCallback(operator) { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
const ref = useRef(); | ||
@@ -19,5 +22,7 @@ if (!ref.current) { | ||
export function observeContext(context) { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
return useAsObservable(useContext(context)); | ||
} | ||
export function observeElement() { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
const ref = useRef(); | ||
@@ -24,0 +29,0 @@ if (!ref.current) { |
@@ -7,4 +7,5 @@ var getDisplayName = function (Component) { | ||
}; | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/ban-types | ||
export var wrapDisplayName = function (BaseComponent, wrapperName) { | ||
return "".concat(wrapperName, "(").concat(getDisplayName(BaseComponent), ")"); | ||
}; |
@@ -12,2 +12,3 @@ import { wrapDisplayName } from './displayName'; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
function fromObservable(input$) { | ||
@@ -23,2 +24,3 @@ return function ReactiveComponent() { | ||
} | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/ban-types | ||
export function forwardRef(component) { | ||
@@ -25,0 +27,0 @@ var wrappedComponent = reactForwardRef(function (props, ref) { |
@@ -7,6 +7,9 @@ import { useAsObservable } from './useAsObservable'; | ||
export function observeState(initial) { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
var _a = useState(initial), value = _a[0], update = _a[1]; | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
return [useAsObservable(value), update]; | ||
} | ||
export function observeCallback(operator) { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
var ref = useRef(); | ||
@@ -19,5 +22,7 @@ if (!ref.current) { | ||
export function observeContext(context) { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
return useAsObservable(useContext(context)); | ||
} | ||
export function observeElement() { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
var ref = useRef(); | ||
@@ -24,0 +29,0 @@ if (!ref.current) { |
130
package.json
{ | ||
"name": "react-rx", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "React + RxJS = <3", | ||
"keywords": [ | ||
"action", | ||
"behavior", | ||
"concurrent", | ||
"es6", | ||
"events", | ||
"external", | ||
"hooks", | ||
"observables", | ||
"observe", | ||
"pipe", | ||
"react", | ||
"react18", | ||
"reactive", | ||
"realtime", | ||
"rx", | ||
"rxjs", | ||
"sanity", | ||
"sanity-io", | ||
"store", | ||
"streams", | ||
"subject", | ||
"suspense", | ||
"sync", | ||
"typesafe", | ||
"typescript", | ||
"use-sync-external-store", | ||
"use" | ||
], | ||
"homepage": "https://react-rx.dev", | ||
"bugs": { | ||
"url": "https://github.com/sanity-io/react-rx/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/sanity-io/react-rx.git" | ||
}, | ||
"license": "MIT", | ||
"author": "Sanity.io <hello@sanity.io>", | ||
"contributors": [ | ||
"Bjørge Næss <bjoerge@gmail.com>", | ||
"Cody Olsen <stipsan@gmail.com> (https://github.com/stipsan)" | ||
], | ||
"main": "dist/cjs/index.js", | ||
"module": "dist/esm/index.js", | ||
"types": "dist/cjs/index.d.ts", | ||
"module": "dist/esm/index.js", | ||
"es2015": "dist/es2015/index.js", | ||
"files": [ | ||
"dist", | ||
"src" | ||
], | ||
"workspaces": [ | ||
"website", | ||
"." | ||
], | ||
"scripts": { | ||
@@ -17,9 +67,6 @@ "build": "npm run build:es2015 && npm run build:esm && npm run build:cjs", | ||
"prepublishOnly": "npm run clean && npm run build", | ||
"postpublish": "npm run clean", | ||
"watch": "run-p \"build:* -- --watch\"", | ||
"test": "jest" | ||
"test": "jest", | ||
"lint": "eslint --cache ." | ||
}, | ||
"keywords": [], | ||
"author": "Bjørge Næss <bjoerge@gmail.com>", | ||
"license": "MIT", | ||
"dependencies": { | ||
@@ -29,10 +76,8 @@ "observable-callback": "^1.0.1", | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.8 || ^17 || ^18", | ||
"rxjs": "^6.5 || ^7" | ||
}, | ||
"devDependencies": { | ||
"@sanity/semantic-release-preset": "^2.0.1", | ||
"@testing-library/dom": "^8.14.0", | ||
"@testing-library/react": "^13.3.0", | ||
"@types/jest": "^28.1.4", | ||
"@types/node": "^18.8.2", | ||
"@types/react": "^18.0.12", | ||
@@ -47,2 +92,3 @@ "@types/react-dom": "^18.0.5", | ||
"eslint-plugin-react": "^7.22.0", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"jest": "^28.1.2", | ||
@@ -52,3 +98,4 @@ "jest-environment-jsdom": "^28.1.2", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "2.2.1", | ||
"prettier": "^2.7.1", | ||
"prettier-plugin-packagejson": "^2.3.0", | ||
"react": "^18.2.0", | ||
@@ -60,16 +107,51 @@ "react-dom": "^18.2.0", | ||
"ts-jest": "^28.0.5", | ||
"typescript": "^4.2.2" | ||
"typescript": "4.7.4" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/bjoerge/react-rx.git" | ||
"overrides": { | ||
"@babel/plugin-proposal-class-properties": "7.10.1", | ||
"@babel/plugin-proposal-optional-chaining": "7.10.3", | ||
"@babel/plugin-transform-typescript": "7.10.3", | ||
"@babel/preset-env": "7.10.3", | ||
"@babel/preset-react": "7.10.1", | ||
"@babel/preset-typescript": "7.10.1", | ||
"@babel/standalone": "7.10.3", | ||
"@mdx-js/loader": "1.6.22", | ||
"@mdx-js/mdx": "1.6.22", | ||
"@mdx-js/react": "1.6.22", | ||
"@types/codemirror": "0.0.96", | ||
"@types/history": "4.7.6", | ||
"@types/mdx-js__react": "1.5.5", | ||
"@webhotelier/webpack-fast-refresh": "5.0.1", | ||
"babel-loader": "8.1.0", | ||
"babel-plugin-static-fs": "3.0.0", | ||
"babel-plugin-styled-components": "1.10.7", | ||
"bezier-easing": "2.1.0", | ||
"clean-webpack-plugin": "3.0.0", | ||
"codemirror": "5.55.0", | ||
"copy-webpack-plugin": "6.0.2", | ||
"css-loader": "3.6.0", | ||
"date-fns": "2.14.0", | ||
"github-slugger": "1.3.0", | ||
"history": "5.0.0", | ||
"html-loader": "1.1.0", | ||
"html-webpack-plugin": "4.3.0", | ||
"markdown-toc": "1.2.0", | ||
"react-codemirror2": "7.2.1", | ||
"react-css-burger": "0.2.0", | ||
"react-refresh": "0.8.3", | ||
"remark-emoji": "2.1.0", | ||
"remark-slug": "6.0.0", | ||
"style-loader": "1.2.1", | ||
"ts-loader": "7.0.5", | ||
"ts-node": "8.10.2", | ||
"tsconfig-paths": "3.11.0", | ||
"webpack": "4.64.0", | ||
"webpack-cli": "3.3.12", | ||
"webpack-dev-server": "3.11.2" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/bjoerge/react-rx/issues" | ||
"peerDependencies": { | ||
"react": "^16.8 || ^17 || ^18", | ||
"rxjs": "^6.5 || ^7" | ||
}, | ||
"homepage": "https://react-rx.dev", | ||
"workspaces": [ | ||
"website", | ||
"." | ||
] | ||
"es2015": "dist/es2015/index.js" | ||
} |
@@ -0,1 +1,5 @@ | ||
[![CI & Release](https://github.com/sanity-io/react-rx/actions/workflows/ci.yml/badge.svg?event=push)](https://github.com/sanity-io/react-rx/actions/workflows/ci.yml) [![npm version](https://img.shields.io/npm/v/react-rx.svg)](https://www.npmjs.com/package/react-rx) | ||
[![react-rx-some-smaller](https://user-images.githubusercontent.com/81981/194187624-9abd09da-bf03-4886-b512-78c1f22fc2de.png)](https://react-rx.dev/) | ||
> Hooks and utilities for combining React with RxJS Observables | ||
@@ -21,1 +25,10 @@ | ||
- [Code examples](https://react-rx.dev/examples) | ||
--- | ||
# Contributing and publishing new versions to npm | ||
Run the ["CI & Release" workflow](https://github.com/sanity-io/react-rx/actions/workflows/ci.yml). | ||
Make the default branch, `current`, should be preselected. Check "Release new version" and press "Run workflow'. | ||
Semantic release will only release on configured branches, so it is safe to run release on any branch. |
@@ -9,3 +9,4 @@ const getDisplayName = (Component: any) => { | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/ban-types | ||
export const wrapDisplayName = (BaseComponent: Function, wrapperName: string) => | ||
`${wrapperName}(${getDisplayName(BaseComponent)})` |
@@ -0,1 +1,2 @@ | ||
/* eslint-disable react-hooks/rules-of-hooks */ | ||
import {Observable} from 'rxjs' | ||
@@ -29,2 +30,3 @@ import {wrapDisplayName} from './displayName' | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
function fromObservable<Props>(input$: Observable<ReactNode>): FunctionComponent<{}> { | ||
@@ -51,2 +53,3 @@ return function ReactiveComponent() { | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/ban-types | ||
export function forwardRef<RefType, Props = {}>(component: ForwardRefComponent<RefType, Props>) { | ||
@@ -53,0 +56,0 @@ const wrappedComponent = reactForwardRef((props: Props, ref: Ref<RefType>) => { |
@@ -0,1 +1,2 @@ | ||
/* eslint-disable react-hooks/rules-of-hooks */ | ||
import {Observable} from 'rxjs' | ||
@@ -2,0 +3,0 @@ import {useObservable} from './useObservable' |
@@ -15,3 +15,5 @@ import {Observable, OperatorFunction} from 'rxjs' | ||
): [Observable<T | undefined>, Dispatch<SetStateAction<T | undefined>>] { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
const [value, update] = useState<T | undefined>(initial) | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
return [useAsObservable(value), update] | ||
@@ -27,2 +29,3 @@ } | ||
): [Observable<T | K>, (arg: T) => void] { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
const ref = useRef<[Observable<T | K>, (arg: T) => void]>() | ||
@@ -36,2 +39,3 @@ if (!ref.current) { | ||
export function observeContext<T>(context: Context<T>): Observable<T> { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
return useAsObservable(useContext<T>(context)) | ||
@@ -41,2 +45,3 @@ } | ||
export function observeElement<T>(): [Observable<T | null>, (el: T | null) => void] { | ||
// eslint-disable-next-line react-hooks/rules-of-hooks | ||
const ref = useRef<[Observable<T | null>, (value: T | null) => void]>() | ||
@@ -43,0 +48,0 @@ if (!ref.current) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
126240
101
2520
34
28
1