Comparing version 2.3.0-beta.1 to 2.3.0
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
## 2.3.0 (unreleased/beta) - 2021-02-07 | ||
- Adds `<BindProps logic={keyedLogic} props={{ id: 12 }}>`, which passes a specific build of | ||
## 2.3.0 - 2021-02-10 | ||
- Adds `<BindLogic logic={keyedLogic} props={{ id: 12 }}>`, which passes a specific build of | ||
`keyedLogic` via React Context down to nested components. This build will be used when calling | ||
a hook like `useValues(keyedLogic)` without props. [Read more here](https://kea.js.org/blog/kea-2.3). | ||
a hook like `useValues(keyedLogic)` without props. | ||
Essentially, you pass the props without actually passing the props. | ||
[Read more here](https://kea.js.org/blog/kea-2.3). | ||
## 2.2.2 - 2020-10-27 | ||
@@ -10,0 +14,0 @@ - Create store automatically if calling `resetContext`, except for the default initial context. |
@@ -1385,5 +1385,7 @@ 'use strict'; | ||
run: { | ||
heap: [], | ||
reactContexts: new WeakMap() | ||
heap: [] | ||
}, | ||
react: { | ||
contexts: new WeakMap() | ||
}, | ||
reducers: { | ||
@@ -2081,3 +2083,3 @@ tree: {}, | ||
function useMountedLogic(logic) { | ||
var builtLogicContext = isWrapper(logic) ? getContext().run.reactContexts.get(logic) : null; | ||
var builtLogicContext = isWrapper(logic) ? getContext().react.contexts.get(logic) : null; | ||
var defaultBuiltLogic = React.useContext(builtLogicContext || blankContext); | ||
@@ -2108,7 +2110,7 @@ var builtLogic = isWrapper(logic) ? defaultBuiltLogic || logic.build() : logic; | ||
function getOrCreateContextForLogicWrapper(logic) { | ||
var context = getContext().run.reactContexts.get(logic); | ||
var context = getContext().react.contexts.get(logic); | ||
if (!context) { | ||
context = React.createContext(undefined); | ||
getContext().run.reactContexts.set(logic, context); | ||
getContext().react.contexts.set(logic, context); | ||
} | ||
@@ -2118,3 +2120,3 @@ | ||
} | ||
function BindProps(_ref) { | ||
function BindLogic(_ref) { | ||
var logic = _ref.logic, | ||
@@ -2136,3 +2138,3 @@ props = _ref.props, | ||
exports.ATTACH_REDUCER = ATTACH_REDUCER$1; | ||
exports.BindProps = BindProps; | ||
exports.BindLogic = BindLogic; | ||
exports.DETACH_REDUCER = DETACH_REDUCER$1; | ||
@@ -2139,0 +2141,0 @@ exports.activatePlugin = activatePlugin; |
@@ -237,4 +237,6 @@ import { AnyAction, Reducer, Middleware, compose, StoreEnhancer, Store, Action } from 'redux'; | ||
}[]; | ||
reactContexts: WeakMap<LogicWrapper, Context$1<BuiltLogic | undefined>>; | ||
}; | ||
react: { | ||
contexts: WeakMap<LogicWrapper, Context$1<BuiltLogic | undefined>>; | ||
}; | ||
reducers: { | ||
@@ -266,3 +268,3 @@ tree: any; | ||
}; | ||
declare function BindProps({ logic, props, children }: BindPropsProps): JSX.Element; | ||
declare function BindLogic({ logic, props, children }: BindPropsProps): JSX.Element; | ||
@@ -300,2 +302,2 @@ declare function getContext(): Context; | ||
export { ATTACH_REDUCER, AnyComponent, BindProps, BreakPointFunction, BuiltLogic, BuiltLogicAdditions, Context, ContextOptions, CreateStoreOptions, DETACH_REDUCER, InternalContextOptions, KeaComponent, KeaPlugin, ListenerFunction, ListenerFunctionWrapper, Logic, LogicEventType, LogicInput, LogicWrapper, LogicWrapperAdditions, MakeLogicType, PartialRecord, PathCreator, PathType, PluginEventArrays, PluginEvents, Props, ReducerFunction, RequiredPathCreator, Selector, activatePlugin, addConnection, closeContext, connect, createAction, getContext, getPluginContext, getStore, isBreakpoint, kea, keaReducer, openContext, resetContext, setPluginContext, useActions, useAllValues, useKea, useMountedLogic, useValues }; | ||
export { ATTACH_REDUCER, AnyComponent, BindLogic, BreakPointFunction, BuiltLogic, BuiltLogicAdditions, Context, ContextOptions, CreateStoreOptions, DETACH_REDUCER, InternalContextOptions, KeaComponent, KeaPlugin, ListenerFunction, ListenerFunctionWrapper, Logic, LogicEventType, LogicInput, LogicWrapper, LogicWrapperAdditions, MakeLogicType, PartialRecord, PathCreator, PathType, PluginEventArrays, PluginEvents, Props, ReducerFunction, RequiredPathCreator, Selector, activatePlugin, addConnection, closeContext, connect, createAction, getContext, getPluginContext, getStore, isBreakpoint, kea, keaReducer, openContext, resetContext, setPluginContext, useActions, useAllValues, useKea, useMountedLogic, useValues }; |
@@ -1381,5 +1381,7 @@ import { createSelector } from 'reselect'; | ||
run: { | ||
heap: [], | ||
reactContexts: new WeakMap() | ||
heap: [] | ||
}, | ||
react: { | ||
contexts: new WeakMap() | ||
}, | ||
reducers: { | ||
@@ -2077,3 +2079,3 @@ tree: {}, | ||
function useMountedLogic(logic) { | ||
var builtLogicContext = isWrapper(logic) ? getContext().run.reactContexts.get(logic) : null; | ||
var builtLogicContext = isWrapper(logic) ? getContext().react.contexts.get(logic) : null; | ||
var defaultBuiltLogic = useContext(builtLogicContext || blankContext); | ||
@@ -2104,7 +2106,7 @@ var builtLogic = isWrapper(logic) ? defaultBuiltLogic || logic.build() : logic; | ||
function getOrCreateContextForLogicWrapper(logic) { | ||
var context = getContext().run.reactContexts.get(logic); | ||
var context = getContext().react.contexts.get(logic); | ||
if (!context) { | ||
context = createContext(undefined); | ||
getContext().run.reactContexts.set(logic, context); | ||
getContext().react.contexts.set(logic, context); | ||
} | ||
@@ -2114,3 +2116,3 @@ | ||
} | ||
function BindProps(_ref) { | ||
function BindLogic(_ref) { | ||
var logic = _ref.logic, | ||
@@ -2131,2 +2133,2 @@ props = _ref.props, | ||
export { ATTACH_REDUCER$1 as ATTACH_REDUCER, BindProps, DETACH_REDUCER$1 as DETACH_REDUCER, activatePlugin, addConnection, closeContext, connect, createAction, getContext, getPluginContext, getStore, isBreakpoint, kea, keaReducer, openContext, resetContext, setPluginContext, useActions, useAllValues, useKea, useMountedLogic, useValues }; | ||
export { ATTACH_REDUCER$1 as ATTACH_REDUCER, BindLogic, DETACH_REDUCER$1 as DETACH_REDUCER, activatePlugin, addConnection, closeContext, connect, createAction, getContext, getPluginContext, getStore, isBreakpoint, kea, keaReducer, openContext, resetContext, setPluginContext, useActions, useAllValues, useKea, useMountedLogic, useValues }; |
@@ -0,0 +0,0 @@ import { complexLogicType } from './complexLogicType'; |
@@ -0,0 +0,0 @@ import { Logic } from '../src/types'; |
@@ -0,0 +0,0 @@ import { githubLogicType } from './githubLogicType'; |
@@ -0,0 +0,0 @@ import { Logic } from '../src/types'; |
@@ -0,0 +0,0 @@ import { logicType } from './logicType'; |
@@ -0,0 +0,0 @@ import { Logic } from '../src/types'; |
export {}; |
@@ -0,0 +0,0 @@ import { Context, ContextOptions } from '../types'; |
import { KeaPlugin } from '../types'; | ||
export declare const corePlugin: KeaPlugin; |
@@ -0,0 +0,0 @@ interface KeaReduxAction { |
import { Logic } from '../../types'; | ||
export declare function addConnection(logic: Logic, otherLogic: Logic): void; |
import { Logic, LogicInput } from '../../types'; | ||
export declare function createActionCreators(logic: Logic, input: LogicInput): void; | ||
export declare function createActionType(key: string, pathString: string): string; |
import { Logic, LogicInput } from '../../types'; | ||
export declare function createActions(logic: Logic, input: LogicInput): void; |
@@ -0,0 +0,0 @@ import { BuiltLogic, Logic, LogicInput, LogicWrapper, Selector } from '../../types'; |
import { Logic, LogicInput } from '../../types'; | ||
export declare function createConstants(logic: Logic, input: LogicInput): void; | ||
export default function convertConstants(constants: string[]): Record<string, string>; |
import { Logic, LogicInput } from '../../types'; | ||
export declare function createDefaults(logic: Logic, input: LogicInput): void; |
import { Logic, LogicInput } from '../../types'; | ||
export declare function createEvents(logic: Logic, input: LogicInput): void; |
import { Logic, LogicInput } from '../../types'; | ||
export declare function createReducerSelectors(logic: Logic, input: LogicInput): void; |
import { Logic, LogicInput } from '../../types'; | ||
export declare function createReducer(logic: Logic, input: LogicInput): void; |
import { Logic, LogicInput } from '../../types'; | ||
export declare function createReducers(logic: Logic, input: LogicInput): void; |
import { Logic, LogicInput } from '../../types'; | ||
export declare function createSelectors(logic: Logic, input: LogicInput): void; |
import { Logic, LogicInput } from '../../types'; | ||
export declare function createValues(logic: Logic, input: LogicInput): void; |
export * from './types'; | ||
export { kea, connect } from './kea'; | ||
export { useValues, useAllValues, useActions, useMountedLogic, useKea } from './react/hooks'; | ||
export { BindProps } from './react/bind-props'; | ||
export { BindLogic } from './react/bind'; | ||
export { resetContext, openContext, closeContext, getContext, getPluginContext, setPluginContext } from './context'; | ||
@@ -6,0 +6,0 @@ export { getStore } from './store/store'; |
import { LogicWrapper, Props, LogicInput, BuiltLogic } from '../types'; | ||
export declare function getBuiltLogic(inputs: LogicInput[], props: Props, wrapper: LogicWrapper, autoConnectInListener?: boolean): BuiltLogic; |
export { kea, connect } from './kea'; |
@@ -0,0 +0,0 @@ import { Logic, LogicInput, LogicWrapper, LogicWrapperAdditions } from '../types'; |
import { BuiltLogic, Logic } from '../types'; | ||
export declare function mountLogic(logic: Logic, count?: number): void; | ||
export declare function unmountLogic(logic: BuiltLogic): void; |
import { LogicInput, PathType, Props } from '../types'; | ||
export declare function getPathForInput(input: LogicInput, props: Props): PathType; | ||
export declare function getPathStringForInput(input: LogicInput, props: Props): string; |
@@ -0,0 +0,0 @@ import { KeaPlugin } from '../types'; |
@@ -0,0 +0,0 @@ import { KeaPlugin, PluginEvents } from '../types'; |
@@ -0,0 +0,0 @@ import { LogicInput, LogicWrapper, BuiltLogic } from '../types'; |
import { AnyComponent, KeaComponent, LogicWrapper } from '../types'; | ||
export declare function wrapComponent(Component: AnyComponent, wrapper: LogicWrapper): KeaComponent; |
@@ -0,0 +0,0 @@ import { BuiltLogic, ReducerFunction } from '../types'; |
import { Store } from 'redux'; | ||
export declare function getStore(opts?: {}): Store | void; |
@@ -236,4 +236,6 @@ import { Reducer, Store, Action as ReduxAction, Middleware, StoreEnhancer, compose, AnyAction } from 'redux'; | ||
}[]; | ||
reactContexts: WeakMap<LogicWrapper, ReactContext<BuiltLogic | undefined>>; | ||
}; | ||
react: { | ||
contexts: WeakMap<LogicWrapper, ReactContext<BuiltLogic | undefined>>; | ||
}; | ||
reducers: { | ||
@@ -240,0 +242,0 @@ tree: any; |
export {}; |
{ | ||
"name": "kea", | ||
"version": "2.3.0-beta.1", | ||
"version": "2.3.0", | ||
"description": "Smart front-end architecture", | ||
@@ -5,0 +5,0 @@ "author": "Marius Andra", |
@@ -7,3 +7,3 @@ export * from './types' | ||
export { useValues, useAllValues, useActions, useMountedLogic, useKea } from './react/hooks' | ||
export { BindProps } from './react/bind-props' | ||
export { BindLogic } from './react/bind' | ||
@@ -10,0 +10,0 @@ export { resetContext, openContext, closeContext, getContext, getPluginContext, setPluginContext } from './context' |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
16
279117
73
7005