quidproquo-web-react 0.0.256 → 0.0.258
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/hooks/asmj/QpqRuntimeEffectCatcher.d.ts +1 -3
- package/lib/commonjs/hooks/asmj/QpqRuntimeEffectCatcher.js +5 -27
- package/lib/commonjs/hooks/asmj/bubbleReducer.d.ts +5 -0
- package/lib/commonjs/hooks/asmj/bubbleReducer.js +28 -0
- package/lib/commonjs/hooks/asmj/createQpqRuntimeDefinition.d.ts +1 -1
- package/lib/commonjs/hooks/asmj/index.d.ts +1 -0
- package/lib/commonjs/hooks/asmj/index.js +1 -0
- package/lib/commonjs/hooks/asmj/useQpqRuntime.d.ts +1 -1
- package/lib/commonjs/hooks/asmj/useQpqRuntime.js +2 -2
- package/lib/commonjs/hooks/useQpq.js +2 -2
- package/lib/commonjs/useFieldBinding/useFieldBinding.d.ts +1 -1
- package/lib/commonjs/useFieldBinding/useFieldBinding.js +2 -2
- package/lib/commonjs/useSharedQueryParams/sharedQueryParamsRuntime.d.ts +1 -1
- package/lib/commonjs/useSharedQueryParams/sharedQueryParamsRuntime.js +2 -2
- package/lib/esm/hooks/asmj/QpqRuntimeEffectCatcher.d.ts +1 -3
- package/lib/esm/hooks/asmj/QpqRuntimeEffectCatcher.js +3 -24
- package/lib/esm/hooks/asmj/bubbleReducer.d.ts +5 -0
- package/lib/esm/hooks/asmj/bubbleReducer.js +24 -0
- package/lib/esm/hooks/asmj/createQpqRuntimeDefinition.d.ts +1 -1
- package/lib/esm/hooks/asmj/index.d.ts +1 -0
- package/lib/esm/hooks/asmj/index.js +1 -0
- package/lib/esm/hooks/asmj/useQpqRuntime.d.ts +1 -1
- package/lib/esm/hooks/asmj/useQpqRuntime.js +1 -1
- package/lib/esm/hooks/useQpq.js +1 -1
- package/lib/esm/useFieldBinding/useFieldBinding.d.ts +1 -1
- package/lib/esm/useFieldBinding/useFieldBinding.js +1 -1
- package/lib/esm/useSharedQueryParams/sharedQueryParamsRuntime.d.ts +1 -1
- package/lib/esm/useSharedQueryParams/sharedQueryParamsRuntime.js +1 -1
- package/package.json +7 -7
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { QpqRuntimeDefinition } from './createQpqRuntimeDefinition';
|
|
2
3
|
import { QpqApi } from './QpqMappedApi';
|
|
3
|
-
import { QpqRuntimeDefinition } from '.';
|
|
4
|
-
export type QpqBubbleReducer<S, A> = (prevState: S, action: A) => [S, boolean];
|
|
5
4
|
type QpqRuntimeEffectCatcher = {
|
|
6
5
|
runtime: QpqRuntimeDefinition<any, any, any>;
|
|
7
6
|
name?: string;
|
|
8
7
|
};
|
|
9
|
-
export declare const useQpqRuntimeBubblingReducer: <TState, TAction, TApi extends QpqApi>(runtimeDefinition: QpqRuntimeDefinition<TState, TAction, TApi>, name?: string) => [TState, (action: TAction) => void, () => TState];
|
|
10
8
|
export declare const QpqRuntimeEffectCatcherComponent: <TState, TAction, TApi extends QpqApi>({ children, runtime, name, }: QpqRuntimeEffectCatcher & {
|
|
11
9
|
children: ReactNode;
|
|
12
10
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,35 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QpqRuntimeEffectCatcher = exports.QpqRuntimeEffectCatcherComponent =
|
|
3
|
+
exports.QpqRuntimeEffectCatcher = exports.QpqRuntimeEffectCatcherComponent = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
// Create a context with a default NOOP dispatcher
|
|
9
|
-
const BubbleReducerDispatchContext = (0, react_1.createContext)((_action) => {
|
|
10
|
-
// NOOP
|
|
11
|
-
});
|
|
12
|
-
const useQpqRuntimeBubblingReducer = (runtimeDefinition, name) => {
|
|
13
|
-
const runtimeDefinitionInfo = (0, react_1.useMemo)(() => runtimeDefinition(name), [runtimeDefinition, name]);
|
|
14
|
-
const [state, setState, getState] = (0, _1.useQpqRuntimeState)(runtimeDefinition, name);
|
|
15
|
-
// Get the parent dispatch from the context
|
|
16
|
-
const parentDispatch = (0, react_1.useContext)(BubbleReducerDispatchContext);
|
|
17
|
-
// Custom Dispatch using functional updates
|
|
18
|
-
const dispatch = (0, useFastCallback_1.useFastCallback)((action) => {
|
|
19
|
-
const [newState, preventBubble] = runtimeDefinitionInfo.reducer(getState(), action);
|
|
20
|
-
if (preventBubble) {
|
|
21
|
-
setState(newState);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
parentDispatch(action);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
return [state, dispatch, getState];
|
|
28
|
-
};
|
|
29
|
-
exports.useQpqRuntimeBubblingReducer = useQpqRuntimeBubblingReducer;
|
|
6
|
+
const bubbleReducer_1 = require("./bubbleReducer");
|
|
7
|
+
const useQpqRuntime_1 = require("./useQpqRuntime");
|
|
30
8
|
const QpqRuntimeEffectCatcherComponent = ({ children, runtime, name, }) => {
|
|
31
|
-
const [api, state, dispatch] = (0,
|
|
32
|
-
return (0, jsx_runtime_1.jsx)(BubbleReducerDispatchContext.Provider, { value: dispatch, children: children });
|
|
9
|
+
const [api, state, dispatch] = (0, useQpqRuntime_1.useQpqRuntime)(runtime, undefined, name);
|
|
10
|
+
return (0, jsx_runtime_1.jsx)(bubbleReducer_1.BubbleReducerDispatchContext.Provider, { value: dispatch, children: children });
|
|
33
11
|
};
|
|
34
12
|
exports.QpqRuntimeEffectCatcherComponent = QpqRuntimeEffectCatcherComponent;
|
|
35
13
|
exports.QpqRuntimeEffectCatcher = (0, react_1.memo)(exports.QpqRuntimeEffectCatcherComponent);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { QpqRuntimeDefinition } from './createQpqRuntimeDefinition';
|
|
2
|
+
import { QpqApi } from './QpqMappedApi';
|
|
3
|
+
export type QpqBubbleReducer<S, A> = (prevState: S, action: A) => [S, boolean];
|
|
4
|
+
export declare const BubbleReducerDispatchContext: import("react").Context<(action: any) => void>;
|
|
5
|
+
export declare const useQpqRuntimeBubblingReducer: <TState, TAction, TApi extends QpqApi>(runtimeDefinition: QpqRuntimeDefinition<TState, TAction, TApi>, name?: string) => [TState, (action: TAction) => void, () => TState];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useQpqRuntimeBubblingReducer = exports.BubbleReducerDispatchContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useFastCallback_1 = require("../useFastCallback");
|
|
6
|
+
const createQpqRuntimeDefinition_1 = require("./createQpqRuntimeDefinition");
|
|
7
|
+
// Create a context with a default NOOP dispatcher
|
|
8
|
+
exports.BubbleReducerDispatchContext = (0, react_1.createContext)((_action) => {
|
|
9
|
+
// NOOP
|
|
10
|
+
});
|
|
11
|
+
const useQpqRuntimeBubblingReducer = (runtimeDefinition, name) => {
|
|
12
|
+
const runtimeDefinitionInfo = (0, react_1.useMemo)(() => runtimeDefinition(name), [runtimeDefinition, name]);
|
|
13
|
+
const [state, setState, getState] = (0, createQpqRuntimeDefinition_1.useQpqRuntimeState)(runtimeDefinition, name);
|
|
14
|
+
// Get the parent dispatch from the context
|
|
15
|
+
const parentDispatch = (0, react_1.useContext)(exports.BubbleReducerDispatchContext);
|
|
16
|
+
// Custom Dispatch using functional updates
|
|
17
|
+
const dispatch = (0, useFastCallback_1.useFastCallback)((action) => {
|
|
18
|
+
const [newState, preventBubble] = runtimeDefinitionInfo.reducer(getState(), action);
|
|
19
|
+
if (preventBubble) {
|
|
20
|
+
setState(newState);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
parentDispatch(action);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return [state, dispatch, getState];
|
|
27
|
+
};
|
|
28
|
+
exports.useQpqRuntimeBubblingReducer = useQpqRuntimeBubblingReducer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { atom } from 'jotai';
|
|
2
2
|
import { selectAtom } from 'jotai/utils';
|
|
3
|
+
import { QpqBubbleReducer } from './bubbleReducer';
|
|
3
4
|
import { QpqApi } from './QpqMappedApi';
|
|
4
|
-
import { QpqBubbleReducer } from './QpqRuntimeEffectCatcher';
|
|
5
5
|
type CustomJotaiReducerAtom<TState> = ReturnType<typeof atom<TState>>;
|
|
6
6
|
type CustomJotaiComputedAtom<TState, TSlice> = ReturnType<typeof selectAtom<TState, TSlice>>;
|
|
7
7
|
export type QpqAsmjState<TState, TAction, TApi extends QpqApi> = {
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./actionProcessor"), exports);
|
|
18
|
+
__exportStar(require("./bubbleReducer"), exports);
|
|
18
19
|
__exportStar(require("./createQpqRuntimeDefinition"), exports);
|
|
19
20
|
__exportStar(require("./QpqContextProvider"), exports);
|
|
20
21
|
__exportStar(require("./QpqMappedApi"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Story } from 'quidproquo-core';
|
|
2
|
+
import { QpqRuntimeDefinition } from './createQpqRuntimeDefinition';
|
|
2
3
|
import { QpqApi, QpqMappedApi } from './QpqMappedApi';
|
|
3
|
-
import { QpqRuntimeDefinition } from '.';
|
|
4
4
|
export declare function useQpqRuntime<TState, TAction, TApi extends QpqApi>(atom: QpqRuntimeDefinition<TState, TAction, TApi>, mainStory?: Story<any, any>, name?: string): [QpqMappedApi<TApi>, TState, (action: any) => void];
|
|
@@ -4,10 +4,10 @@ exports.useQpqRuntime = useQpqRuntime;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const useQpq_1 = require("../useQpq");
|
|
6
6
|
const actionProcessor_1 = require("./actionProcessor");
|
|
7
|
-
const
|
|
7
|
+
const bubbleReducer_1 = require("./bubbleReducer");
|
|
8
8
|
function useQpqRuntime(atom, mainStory, name) {
|
|
9
9
|
const atomInfo = (0, react_1.useMemo)(() => atom(name), [atom, name]);
|
|
10
|
-
const [state, dispatch, getCurrentState] = (0,
|
|
10
|
+
const [state, dispatch, getCurrentState] = (0, bubbleReducer_1.useQpqRuntimeBubblingReducer)(atom, name);
|
|
11
11
|
// Api generators are memoized to prevent unnecessary re-renders.
|
|
12
12
|
const [memoedApiGenerators] = (0, react_1.useState)(() => atomInfo.api);
|
|
13
13
|
const resolver = (0, useQpq_1.useQpq)((0, actionProcessor_1.getStateActionProcessor)(dispatch, getCurrentState));
|
|
@@ -13,7 +13,7 @@ exports.useQpq = useQpq;
|
|
|
13
13
|
const quidproquo_actionprocessor_web_1 = require("quidproquo-actionprocessor-web");
|
|
14
14
|
const quidproquo_core_1 = require("quidproquo-core");
|
|
15
15
|
const react_1 = require("react");
|
|
16
|
-
const
|
|
16
|
+
const QpqContextProvider_1 = require("./asmj/QpqContextProvider");
|
|
17
17
|
// WIP ~ useFastCallback, wack things like loggers in a context, try to only make once instance of the runtime.
|
|
18
18
|
// Also don't create every refresh.. useMemo / useCallback etc
|
|
19
19
|
const logger = {
|
|
@@ -23,7 +23,7 @@ const logger = {
|
|
|
23
23
|
moveToPermanentStorage: () => __awaiter(void 0, void 0, void 0, function* () { }),
|
|
24
24
|
};
|
|
25
25
|
function useQpq(getActionProcessors = () => __awaiter(this, void 0, void 0, function* () { return ({}); })) {
|
|
26
|
-
const qpqContextValues = (0,
|
|
26
|
+
const qpqContextValues = (0, QpqContextProvider_1.useQpqContextValues)();
|
|
27
27
|
const resolveStory = (0, react_1.useMemo)(() => (0, quidproquo_core_1.createRuntime)([(0, quidproquo_core_1.defineModule)('UI')], {
|
|
28
28
|
depth: 0,
|
|
29
29
|
context: qpqContextValues,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QpqRuntimeComputed } from '../hooks';
|
|
1
|
+
import { QpqRuntimeComputed } from '../hooks/asmj/createQpqRuntimeDefinition';
|
|
2
2
|
export declare const useFieldBinding: <TState, V, E = any>(computedAtom: QpqRuntimeComputed<TState, V>, someSetter: (value: V) => Promise<void> | void, valueExtractor?: (event: E, ...args: any[]) => V) => [V, (event: E, ...args: any[]) => void];
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useFieldBinding = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
5
|
+
const createQpqRuntimeDefinition_1 = require("../hooks/asmj/createQpqRuntimeDefinition");
|
|
6
6
|
const useFieldBinding = (computedAtom, someSetter, valueExtractor) => {
|
|
7
|
-
const computedValue = (0,
|
|
7
|
+
const computedValue = (0, createQpqRuntimeDefinition_1.useQpqRuntimeComputed)(computedAtom);
|
|
8
8
|
const [value, setValue] = (0, react_1.useState)(computedValue);
|
|
9
9
|
const handleChange = (event, ...args) => {
|
|
10
10
|
const newValue = valueExtractor ? valueExtractor(event, ...args) : event.target.value;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const sharedQueryParamsRuntime: import("../hooks").QpqRuntimeDefinition<import("./logic").SharedQueryParamsState, import("./logic").SharedQueryParamsSetParamEffect, {
|
|
1
|
+
export declare const sharedQueryParamsRuntime: import("../hooks/asmj/createQpqRuntimeDefinition").QpqRuntimeDefinition<import("./logic").SharedQueryParamsState, import("./logic").SharedQueryParamsSetParamEffect, {
|
|
2
2
|
askSetParam: typeof import("./logic/runtime/askSetParam").askSetParam;
|
|
3
3
|
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sharedQueryParamsRuntime = void 0;
|
|
4
|
-
const
|
|
4
|
+
const createQpqRuntimeDefinition_1 = require("../hooks/asmj/createQpqRuntimeDefinition");
|
|
5
5
|
const runtime_1 = require("./logic/runtime");
|
|
6
6
|
const logic_1 = require("./logic");
|
|
7
|
-
exports.sharedQueryParamsRuntime = (0,
|
|
7
|
+
exports.sharedQueryParamsRuntime = (0, createQpqRuntimeDefinition_1.createQpqRuntimeDefinition)(runtime_1.sharedQueryParamsLogic, logic_1.sharedQueryParamsInitalState, logic_1.sharedQueryParamsReducer);
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { QpqRuntimeDefinition } from './createQpqRuntimeDefinition';
|
|
2
3
|
import { QpqApi } from './QpqMappedApi';
|
|
3
|
-
import { QpqRuntimeDefinition } from '.';
|
|
4
|
-
export type QpqBubbleReducer<S, A> = (prevState: S, action: A) => [S, boolean];
|
|
5
4
|
type QpqRuntimeEffectCatcher = {
|
|
6
5
|
runtime: QpqRuntimeDefinition<any, any, any>;
|
|
7
6
|
name?: string;
|
|
8
7
|
};
|
|
9
|
-
export declare const useQpqRuntimeBubblingReducer: <TState, TAction, TApi extends QpqApi>(runtimeDefinition: QpqRuntimeDefinition<TState, TAction, TApi>, name?: string) => [TState, (action: TAction) => void, () => TState];
|
|
10
8
|
export declare const QpqRuntimeEffectCatcherComponent: <TState, TAction, TApi extends QpqApi>({ children, runtime, name, }: QpqRuntimeEffectCatcher & {
|
|
11
9
|
children: ReactNode;
|
|
12
10
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,28 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useQpqRuntime
|
|
5
|
-
// Create a context with a default NOOP dispatcher
|
|
6
|
-
const BubbleReducerDispatchContext = createContext((_action) => {
|
|
7
|
-
// NOOP
|
|
8
|
-
});
|
|
9
|
-
export const useQpqRuntimeBubblingReducer = (runtimeDefinition, name) => {
|
|
10
|
-
const runtimeDefinitionInfo = useMemo(() => runtimeDefinition(name), [runtimeDefinition, name]);
|
|
11
|
-
const [state, setState, getState] = useQpqRuntimeState(runtimeDefinition, name);
|
|
12
|
-
// Get the parent dispatch from the context
|
|
13
|
-
const parentDispatch = useContext(BubbleReducerDispatchContext);
|
|
14
|
-
// Custom Dispatch using functional updates
|
|
15
|
-
const dispatch = useFastCallback((action) => {
|
|
16
|
-
const [newState, preventBubble] = runtimeDefinitionInfo.reducer(getState(), action);
|
|
17
|
-
if (preventBubble) {
|
|
18
|
-
setState(newState);
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
parentDispatch(action);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
return [state, dispatch, getState];
|
|
25
|
-
};
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { BubbleReducerDispatchContext } from './bubbleReducer';
|
|
4
|
+
import { useQpqRuntime } from './useQpqRuntime';
|
|
26
5
|
export const QpqRuntimeEffectCatcherComponent = ({ children, runtime, name, }) => {
|
|
27
6
|
const [api, state, dispatch] = useQpqRuntime(runtime, undefined, name);
|
|
28
7
|
return _jsx(BubbleReducerDispatchContext.Provider, { value: dispatch, children: children });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { QpqRuntimeDefinition } from './createQpqRuntimeDefinition';
|
|
2
|
+
import { QpqApi } from './QpqMappedApi';
|
|
3
|
+
export type QpqBubbleReducer<S, A> = (prevState: S, action: A) => [S, boolean];
|
|
4
|
+
export declare const BubbleReducerDispatchContext: import("react").Context<(action: any) => void>;
|
|
5
|
+
export declare const useQpqRuntimeBubblingReducer: <TState, TAction, TApi extends QpqApi>(runtimeDefinition: QpqRuntimeDefinition<TState, TAction, TApi>, name?: string) => [TState, (action: TAction) => void, () => TState];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createContext, useContext, useMemo } from 'react';
|
|
2
|
+
import { useFastCallback } from '../useFastCallback';
|
|
3
|
+
import { useQpqRuntimeState } from './createQpqRuntimeDefinition';
|
|
4
|
+
// Create a context with a default NOOP dispatcher
|
|
5
|
+
export const BubbleReducerDispatchContext = createContext((_action) => {
|
|
6
|
+
// NOOP
|
|
7
|
+
});
|
|
8
|
+
export const useQpqRuntimeBubblingReducer = (runtimeDefinition, name) => {
|
|
9
|
+
const runtimeDefinitionInfo = useMemo(() => runtimeDefinition(name), [runtimeDefinition, name]);
|
|
10
|
+
const [state, setState, getState] = useQpqRuntimeState(runtimeDefinition, name);
|
|
11
|
+
// Get the parent dispatch from the context
|
|
12
|
+
const parentDispatch = useContext(BubbleReducerDispatchContext);
|
|
13
|
+
// Custom Dispatch using functional updates
|
|
14
|
+
const dispatch = useFastCallback((action) => {
|
|
15
|
+
const [newState, preventBubble] = runtimeDefinitionInfo.reducer(getState(), action);
|
|
16
|
+
if (preventBubble) {
|
|
17
|
+
setState(newState);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
parentDispatch(action);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return [state, dispatch, getState];
|
|
24
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { atom } from 'jotai';
|
|
2
2
|
import { selectAtom } from 'jotai/utils';
|
|
3
|
+
import { QpqBubbleReducer } from './bubbleReducer';
|
|
3
4
|
import { QpqApi } from './QpqMappedApi';
|
|
4
|
-
import { QpqBubbleReducer } from './QpqRuntimeEffectCatcher';
|
|
5
5
|
type CustomJotaiReducerAtom<TState> = ReturnType<typeof atom<TState>>;
|
|
6
6
|
type CustomJotaiComputedAtom<TState, TSlice> = ReturnType<typeof selectAtom<TState, TSlice>>;
|
|
7
7
|
export type QpqAsmjState<TState, TAction, TApi extends QpqApi> = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Story } from 'quidproquo-core';
|
|
2
|
+
import { QpqRuntimeDefinition } from './createQpqRuntimeDefinition';
|
|
2
3
|
import { QpqApi, QpqMappedApi } from './QpqMappedApi';
|
|
3
|
-
import { QpqRuntimeDefinition } from '.';
|
|
4
4
|
export declare function useQpqRuntime<TState, TAction, TApi extends QpqApi>(atom: QpqRuntimeDefinition<TState, TAction, TApi>, mainStory?: Story<any, any>, name?: string): [QpqMappedApi<TApi>, TState, (action: any) => void];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { useQpq } from '../useQpq';
|
|
3
3
|
import { getStateActionProcessor } from './actionProcessor';
|
|
4
|
-
import { useQpqRuntimeBubblingReducer } from './
|
|
4
|
+
import { useQpqRuntimeBubblingReducer } from './bubbleReducer';
|
|
5
5
|
export function useQpqRuntime(atom, mainStory, name) {
|
|
6
6
|
const atomInfo = useMemo(() => atom(name), [atom, name]);
|
|
7
7
|
const [state, dispatch, getCurrentState] = useQpqRuntimeBubblingReducer(atom, name);
|
package/lib/esm/hooks/useQpq.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getWebActionProcessors } from 'quidproquo-actionprocessor-web';
|
|
2
2
|
import { createRuntime, defineModule, QpqRuntimeType, } from 'quidproquo-core';
|
|
3
3
|
import { useCallback, useMemo } from 'react';
|
|
4
|
-
import { useQpqContextValues } from './asmj';
|
|
4
|
+
import { useQpqContextValues } from './asmj/QpqContextProvider';
|
|
5
5
|
// WIP ~ useFastCallback, wack things like loggers in a context, try to only make once instance of the runtime.
|
|
6
6
|
// Also don't create every refresh.. useMemo / useCallback etc
|
|
7
7
|
const logger = {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QpqRuntimeComputed } from '../hooks';
|
|
1
|
+
import { QpqRuntimeComputed } from '../hooks/asmj/createQpqRuntimeDefinition';
|
|
2
2
|
export declare const useFieldBinding: <TState, V, E = any>(computedAtom: QpqRuntimeComputed<TState, V>, someSetter: (value: V) => Promise<void> | void, valueExtractor?: (event: E, ...args: any[]) => V) => [V, (event: E, ...args: any[]) => void];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
-
import { useQpqRuntimeComputed } from '../hooks';
|
|
2
|
+
import { useQpqRuntimeComputed } from '../hooks/asmj/createQpqRuntimeDefinition';
|
|
3
3
|
export const useFieldBinding = (computedAtom, someSetter, valueExtractor) => {
|
|
4
4
|
const computedValue = useQpqRuntimeComputed(computedAtom);
|
|
5
5
|
const [value, setValue] = useState(computedValue);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const sharedQueryParamsRuntime: import("../hooks").QpqRuntimeDefinition<import("./logic").SharedQueryParamsState, import("./logic").SharedQueryParamsSetParamEffect, {
|
|
1
|
+
export declare const sharedQueryParamsRuntime: import("../hooks/asmj/createQpqRuntimeDefinition").QpqRuntimeDefinition<import("./logic").SharedQueryParamsState, import("./logic").SharedQueryParamsSetParamEffect, {
|
|
2
2
|
askSetParam: typeof import("./logic/runtime/askSetParam").askSetParam;
|
|
3
3
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createQpqRuntimeDefinition } from '../hooks';
|
|
1
|
+
import { createQpqRuntimeDefinition } from '../hooks/asmj/createQpqRuntimeDefinition';
|
|
2
2
|
import { sharedQueryParamsLogic } from './logic/runtime';
|
|
3
3
|
import { sharedQueryParamsInitalState, sharedQueryParamsReducer } from './logic';
|
|
4
4
|
export const sharedQueryParamsRuntime = createQpqRuntimeDefinition(sharedQueryParamsLogic, sharedQueryParamsInitalState, sharedQueryParamsReducer);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-web-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.258",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/joe-coady/quidproquo#readme",
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"quidproquo-core": "0.0.
|
|
36
|
-
"quidproquo-tsconfig": "0.0.
|
|
35
|
+
"quidproquo-core": "0.0.258",
|
|
36
|
+
"quidproquo-tsconfig": "0.0.258",
|
|
37
37
|
"typescript": "^5.8.2"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"jotai": "^2.12.1",
|
|
44
44
|
"symbol-observable": "^4.0.0",
|
|
45
|
-
"quidproquo-web": "0.0.
|
|
46
|
-
"quidproquo-webserver": "0.0.
|
|
47
|
-
"quidproquo-actionprocessor-node": "0.0.
|
|
48
|
-
"quidproquo-actionprocessor-web": "0.0.
|
|
45
|
+
"quidproquo-web": "0.0.258",
|
|
46
|
+
"quidproquo-webserver": "0.0.258",
|
|
47
|
+
"quidproquo-actionprocessor-node": "0.0.258",
|
|
48
|
+
"quidproquo-actionprocessor-web": "0.0.258"
|
|
49
49
|
}
|
|
50
50
|
}
|