New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@codemirror-toolkit/react

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codemirror-toolkit/react - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

23

dist/index.js
import { useSyncExternalStore, useDebugValue, useEffect, useCallback, useRef, createContext, createElement, useContext } from "react";
import { EditorView } from "@codemirror/view";
import { unstable_batchedUpdates } from "react-dom";
function runTask(callback) {

@@ -85,8 +84,6 @@ let task = callback;

scheduler.cancel();
scheduler.request(
() => unstable_batchedUpdates(() => {
setView(null);
setView(container && createView(container));
})
);
scheduler.request(() => {
setView(null);
setView(container && createView(container));
});
}

@@ -125,6 +122,6 @@ });

const CodeMirrorProvider = ({ config, children }) => {
const contextValue = useSingleton(() => createCodeMirror(config));
const instance = useSingleton(() => createCodeMirror(config));
return /* @__PURE__ */ createElement(
InternalCodeMirrorContext.Provider,
{ value: contextValue },
{ value: instance },
children

@@ -139,9 +136,9 @@ );

const useCodeMirrorContext = () => {
const contextValue = useContext(InternalCodeMirrorContext);
if (!contextValue) {
const instance = useContext(InternalCodeMirrorContext);
if (!instance) {
throw new Error(
"could not find CodeMirrorContext value; please ensure the component is wrapped in a <Provider>"
"could not find instance from CodeMirrorContext; please ensure the component is wrapped in a <Provider>"
);
}
return contextValue;
return instance;
};

@@ -148,0 +145,0 @@ const useGetView = () => {

{
"name": "@codemirror-toolkit/react",
"version": "0.5.0",
"version": "0.5.1",
"description": "A small and flexible solution for binding CodeMirror 6 to React",

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

"@codemirror/state": "^6.3.3",
"@codemirror/view": "^6.22.1",
"@testing-library/react": "^14.0.0",
"@types/react": "^18.2.42",
"@codemirror/view": "^6.22.2",
"@testing-library/react": "^14.1.2",
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",

@@ -70,0 +70,0 @@ "react": "^18.2.0",

@@ -48,6 +48,6 @@ import type { ReactNode } from 'react'

const CodeMirrorProvider: CodeMirrorProvider = ({ config, children }) => {
const contextValue = useSingleton(() => createCodeMirror<ContainerElement>(config))
const instance = useSingleton(() => createCodeMirror<ContainerElement>(config))
return /*#__PURE__*/ createElement(
InternalCodeMirrorContext.Provider,
{ value: contextValue },
{ value: instance },
children,

@@ -64,9 +64,9 @@ )

const useCodeMirrorContext: UseCodeMirrorContextHook<ContainerElement> = () => {
const contextValue = useContext(InternalCodeMirrorContext)
if (!contextValue) {
const instance = useContext(InternalCodeMirrorContext)
if (!instance) {
throw new Error(
'could not find CodeMirrorContext value; please ensure the component is wrapped in a <Provider>',
'could not find instance from CodeMirrorContext; please ensure the component is wrapped in a <Provider>',
)
}
return contextValue
return instance
}

@@ -73,0 +73,0 @@

import type { EditorState } from '@codemirror/state'
import { EditorView } from '@codemirror/view'
import { useCallback, useDebugValue, useEffect, useSyncExternalStore } from 'react'
import { unstable_batchedUpdates as batch } from 'react-dom'

@@ -62,2 +61,3 @@ import type {

/* v8 ignore next */
const getServerView: GetView = () => null

@@ -104,8 +104,6 @@

scheduler.cancel()
scheduler.request(() =>
batch(() => {
setView(null)
setView(container && createView(container))
}),
)
scheduler.request(() => {
setView(null)
setView(container && createView(container))
})
},

@@ -125,5 +123,4 @@ })

// Using `useSyncExternalStore` with a no-op subscription function would have the same effect.
// Check out the shim implementations for pre-18 versions at
// https://github.com/facebook/react/tree/main/packages/use-sync-external-store/src
// or find the functions `mountSyncExternalStore` and `updateSyncExternalStore` at
// Check out the shim implementations for pre-18 versions in the `use-sync-external-store`
// package or find the functions `mountSyncExternalStore` and `updateSyncExternalStore` at
// https://github.com/facebook/react/blob/main/packages/react-reconciler/src/ReactFiberHooks.js

@@ -130,0 +127,0 @@ // Regardless, if the store never updates, during rendering `useSyncExternalStore` calls the

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