Skip to content

Commit

Permalink
0.0.129
Browse files Browse the repository at this point in the history
  • Loading branch information
ivansglazunov committed Sep 26, 2024
1 parent b3a687f commit ede5206
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 18 deletions.
3 changes: 0 additions & 3 deletions import.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
6 changes: 0 additions & 6 deletions imports/editor-async.tsx

This file was deleted.

10 changes: 8 additions & 2 deletions imports/go.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -156,6 +156,11 @@ export const ValueContext = createContext<any>(undefined);
let _i = 0;
let _p = 0;

export const GoEditorContext = createContext<any>(undefined);
export const GoEditorProvider = memo(function GoEditorProvider({ Editor, children }: { Editor: any; children: any }) {
return <GoEditorContext.Provider value={Editor}>{children}</GoEditorContext.Provider>
});

export const GoProvider = memo(function GoProvider({
linkId,
value: _value,
Expand All @@ -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);
Expand Down
10 changes: 7 additions & 3 deletions imports/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 ? [<PreloadProviderCore key={deep.linkId} preloaded={preloaded} children={children}/>] : children;
return <GoEditorProvider Editor={Editor}>
{deep ? [<PreloadProviderCore key={deep.linkId} preloaded={preloaded} children={children}/>] : children};
</GoEditorProvider>
}

export function useSymbol() {
Expand Down Expand Up @@ -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));
};
}
3 changes: 0 additions & 3 deletions imports/requires.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@deep-foundation/perception-imports",
"version": "0.0.128",
"version": "0.0.129",
"license": "Unlicense",
"type": "module",
"main": "import.js",
Expand Down

0 comments on commit ede5206

Please sign in to comment.