From ede5206b97169de221f43372ceae54ebb9b1b5d8 Mon Sep 17 00:00:00 2001 From: Ivan S Glazunov Date: Thu, 26 Sep 2024 08:52:20 +0300 Subject: [PATCH] 0.0.129 --- import.ts | 3 --- imports/editor-async.tsx | 6 ------ imports/go.tsx | 10 ++++++++-- imports/hooks.tsx | 10 +++++++--- imports/requires.tsx | 3 --- package.json | 2 +- 6 files changed, 16 insertions(+), 18 deletions(-) delete mode 100644 imports/editor-async.tsx diff --git a/import.ts b/import.ts index 414237a..4751a26 100644 --- a/import.ts +++ b/import.ts @@ -1,9 +1,6 @@ export type { onEnterI, onChangeI, PathI, onDoI, GoContextI, GoI, GoCallbackI, FocusI, ParentsI, AllI, DoI, DoHandleI, onDoObjectI } from './imports/go.js'; export { GoContext, ValueContext, GoProvider, noScrollBar, GoCustomContext, useGoCore, useGo, GoCustomProvider } from './imports/go.js'; -export type { IEditor } from './imports/editor.js'; -export { Editor, usePsudoResize } from './imports/editor.js'; - export type { ClientHandlerRendererProps, ClientHandlerProps, UseClientHandlerProps } from './imports/client-handler.js'; export { CatchErrors, evalClientHandler, useHandlersGo, useClientHandler, useFindClientHandler, HandlersGoContext, ClientHandler, HandlerConfigContext, ClientHandlerRenderer } from './imports/client-handler.js'; diff --git a/imports/editor-async.tsx b/imports/editor-async.tsx deleted file mode 100644 index 72657d1..0000000 --- a/imports/editor-async.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import React from 'react'; -import dynamic from 'next/dynamic.js'; - -export const Editor = dynamic(() => import('./editor.js').then(m => m.Editor), { - loading: () => <>, -}) diff --git a/imports/go.tsx b/imports/go.tsx index 919d79f..0593d67 100644 --- a/imports/go.tsx +++ b/imports/go.tsx @@ -21,7 +21,7 @@ import { useQueryStore } from '@deep-foundation/store/query.js'; import { getChakraVar, loader, useChakraColor, useHandlersContext, useLoader, usePreload } from './hooks.js'; import { useDebounceCallback } from '@react-hook/debounce'; import { useAsyncMemo } from "use-async-memo"; -import { Editor } from './editor-async.js'; +// import { Editor } from './editor-async.js'; const dpl = '@deep-foundation/perception-links'; const dc = '@deep-foundation/core'; @@ -71,7 +71,7 @@ export interface GoI { useNav: typeof useNav; Provider: typeof GoProvider; Input: typeof Input; - Editor: typeof Editor; + Editor: any; Handler: typeof Handler; Subscription: typeof Subscription; useLocalStore: typeof useLocalStore; @@ -156,6 +156,11 @@ export const ValueContext = createContext(undefined); let _i = 0; let _p = 0; +export const GoEditorContext = createContext(undefined); +export const GoEditorProvider = memo(function GoEditorProvider({ Editor, children }: { Editor: any; children: any }) { + return {children} +}); + export const GoProvider = memo(function GoProvider({ linkId, value: _value, @@ -177,6 +182,7 @@ export const GoProvider = memo(function GoProvider({ hotkeys?: boolean; }) { + const Editor = useContext(GoEditorContext); const deep = useDeep(); const __p = useMemo(() => { return _p++; }, []); const _parentGo: GoI = useGoCore(context); diff --git a/imports/hooks.tsx b/imports/hooks.tsx index b8797b5..c55c359 100644 --- a/imports/hooks.tsx +++ b/imports/hooks.tsx @@ -3,7 +3,7 @@ import { useTheme } from '@chakra-ui/react'; import { useDeep, Id } from "@deep-foundation/deeplinks"; import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'; -import { useGoCore } from './go.js'; +import { GoEditorProvider, useGoCore } from './go.js'; export function Packages() { const deep = useDeep(); @@ -99,13 +99,17 @@ export function PreloadProviderCore({ export function PreloadProvider({ preloaded = {}, + Editor, children = null, }: { preloaded?: { packages?: any[]; handlers?: any[]; }; + Editor: any; children?: any; }) { const deep = useDeep(); - return deep ? [] : children; + return + {deep ? [] : children}; + } export function useSymbol() { @@ -197,6 +201,6 @@ export function useChakraVar(): (color: string) => string { const theme = useTheme(); const go = useGoCore(); return (color: string) => { - return getChakraVar(go().root().ref.current, getChakraColor(theme, color)); + return getChakraVar(go().root().ref.current, getChakraColor(theme, color)); }; } \ No newline at end of file diff --git a/imports/requires.tsx b/imports/requires.tsx index c8ea030..be8fab5 100644 --- a/imports/requires.tsx +++ b/imports/requires.tsx @@ -6,7 +6,6 @@ import * as axiosHooks from 'axios-hooks'; import * as classnames from 'classnames'; import React from 'react'; import * as perception from '../import.js'; -// import * as reacticons from 'react-icons'; import * as debounce from '@react-hook/debounce'; import * as rjsfChakra from '@rjsf/chakra-ui'; import * as rjsfCore from '@rjsf/core'; @@ -17,7 +16,6 @@ import $ from 'jquery'; import * as json5 from 'json5'; import * as Resizable from 're-resizable'; import * as reactHotkeysHook from 'react-hotkeys-hook'; -import { IconContext } from 'react-icons'; import * as ai from 'react-icons/ai'; import * as bs from 'react-icons/bs'; import * as ci from 'react-icons/ci'; @@ -131,7 +129,6 @@ export const requires: any = { 'react-icons/gi': gi, 'react-icons/io5': io5, 'react-icons/vsc': vsc, - 'react-icons' : IconContext, 'react-linkify': Linkify, '@rjsf/core': rjsfCore, diff --git a/package.json b/package.json index 83a4e3f..f3feb81 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@deep-foundation/perception-imports", - "version": "0.0.128", + "version": "0.0.129", "license": "Unlicense", "type": "module", "main": "import.js",