redux-astroglide 0.1.22 → 0.1.25
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/dist/index.js +96 -16
- package/dist/{index.es.js → index.mjs} +96 -16
- package/dist/index.umd.js +2686 -7873
- package/dist/plugins/index.umd.js +9 -89
- package/dist/plugins/type/index.umd.js +9 -89
- package/dist/selectors/index.umd.js +21 -4040
- package/dist/types/astroglide.d.ts +98 -17
- package/dist/types/index.d.ts +1 -0
- package/dist/types/plugins/persist/index.d.ts +2 -2
- package/dist/types/plugins/persist/types.d.ts +5 -0
- package/dist/types/plugins/plugins.d.ts +40 -0
- package/dist/types/plugins/service.d.ts +1 -1
- package/package.json +11 -9
- /package/dist/plugins/{index.es.js → index.mjs} +0 -0
- /package/dist/plugins/persist/{index.es.js → index.mjs} +0 -0
- /package/dist/plugins/set/{index.es.js → index.mjs} +0 -0
- /package/dist/plugins/type/{index.es.js → index.mjs} +0 -0
- /package/dist/selectors/{index.es.js → index.mjs} +0 -0
package/dist/index.js
CHANGED
|
@@ -3744,15 +3744,86 @@ var configure$1 = function configure(store) {
|
|
|
3744
3744
|
|
|
3745
3745
|
var _excluded = ["middleware", "devTools", "preloadedState", "enhancers"],
|
|
3746
3746
|
_excluded2 = ["selectDomain"];
|
|
3747
|
-
|
|
3748
|
-
|
|
3747
|
+
|
|
3748
|
+
// ============================================================================
|
|
3749
|
+
// Utility Types
|
|
3750
|
+
// ============================================================================
|
|
3751
|
+
|
|
3752
|
+
/** Capitalize first letter of a string type */
|
|
3753
|
+
|
|
3754
|
+
// ============================================================================
|
|
3755
|
+
// Hook Types
|
|
3756
|
+
// ============================================================================
|
|
3757
|
+
|
|
3758
|
+
/** Return type for hooks - [value, setter, extras] */
|
|
3759
|
+
|
|
3760
|
+
/** A hook with static methods for non-component usage */
|
|
3761
|
+
|
|
3762
|
+
/** Generate hook types from initial state - creates useFieldName for each field */
|
|
3763
|
+
|
|
3764
|
+
/** Domain hook for the entire slice state */
|
|
3765
|
+
|
|
3766
|
+
// ============================================================================
|
|
3767
|
+
// Selector Types
|
|
3768
|
+
// ============================================================================
|
|
3769
|
+
|
|
3770
|
+
/** Generate selector types from initial state - creates selectFieldName for each field */
|
|
3771
|
+
|
|
3772
|
+
// ============================================================================
|
|
3773
|
+
// Action Types
|
|
3774
|
+
// ============================================================================
|
|
3775
|
+
|
|
3776
|
+
/** Generate setter action types from initial state - creates setFieldName for each field */
|
|
3777
|
+
|
|
3778
|
+
/** Slice-level setter action */
|
|
3779
|
+
|
|
3780
|
+
/** Extract action types from custom reducers */
|
|
3781
|
+
|
|
3782
|
+
// ============================================================================
|
|
3783
|
+
// Extended Slice Type
|
|
3784
|
+
// ============================================================================
|
|
3785
|
+
|
|
3786
|
+
/** Extended slice with hooks, selectors, and properly typed actions */
|
|
3787
|
+
|
|
3788
|
+
// ============================================================================
|
|
3789
|
+
// Configure Options Types
|
|
3790
|
+
// ============================================================================
|
|
3791
|
+
|
|
3792
|
+
/** Configuration options for the store - reducer is NOT required */
|
|
3793
|
+
|
|
3794
|
+
// ============================================================================
|
|
3795
|
+
// RTK Config Types
|
|
3796
|
+
// ============================================================================
|
|
3797
|
+
|
|
3798
|
+
/** RTK-compatible configuration for custom reducers */
|
|
3799
|
+
|
|
3800
|
+
/** Astroglide-specific configuration overrides */
|
|
3801
|
+
|
|
3802
|
+
// ============================================================================
|
|
3803
|
+
// Configure Result Type
|
|
3804
|
+
// ============================================================================
|
|
3805
|
+
|
|
3806
|
+
/** Result returned from configure() */
|
|
3807
|
+
|
|
3808
|
+
var configure = function configure() {
|
|
3809
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
3810
|
+
_middleware = _ref.middleware,
|
|
3749
3811
|
devTools = _ref.devTools,
|
|
3750
3812
|
preloadedState = _ref.preloadedState,
|
|
3751
3813
|
enhancers = _ref.enhancers,
|
|
3752
3814
|
staticReducers = _objectWithoutProperties(_ref, _excluded);
|
|
3815
|
+
// Add a placeholder reducer if no static reducers provided
|
|
3816
|
+
// This prevents combineReducers({}) from throwing an error
|
|
3817
|
+
var hasStaticReducers = Object.keys(staticReducers).length > 0;
|
|
3818
|
+
var initialReducers = hasStaticReducers ? staticReducers : {
|
|
3819
|
+
__astroglide_init__: function __astroglide_init__() {
|
|
3820
|
+
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3821
|
+
return state;
|
|
3822
|
+
}
|
|
3823
|
+
};
|
|
3753
3824
|
var store = toolkit.configureStore({
|
|
3754
3825
|
// @ts-ignore-next-line
|
|
3755
|
-
reducer: toolkit.combineReducers(
|
|
3826
|
+
reducer: toolkit.combineReducers(initialReducers),
|
|
3756
3827
|
middleware: function middleware(getDefaultMiddleware) {
|
|
3757
3828
|
return [].concat(_toConsumableArray(typeof _middleware === "function" ? _middleware(getDefaultMiddleware) : _middleware || []), [reduxInjectableMiddleware.injectableMiddleware]);
|
|
3758
3829
|
},
|
|
@@ -3763,12 +3834,13 @@ var configure = function configure(_ref) {
|
|
|
3763
3834
|
var _configureSelectors = configure$1(store),
|
|
3764
3835
|
makePropertySelectorsFromSlice = _configureSelectors.makePropertySelectorsFromSlice;
|
|
3765
3836
|
var injectSlice$1 = function injectSlice$1(slice) {
|
|
3766
|
-
return injectSlice(store,
|
|
3837
|
+
return injectSlice(store, initialReducers, slice);
|
|
3767
3838
|
};
|
|
3768
3839
|
var injectReducer$1 = function injectReducer$1(key, asyncReducer) {
|
|
3769
|
-
return injectReducer(store,
|
|
3840
|
+
return injectReducer(store, initialReducers, key, asyncReducer);
|
|
3770
3841
|
};
|
|
3771
|
-
var createAutomatedSlice = function createAutomatedSlice(sliceConfig
|
|
3842
|
+
var createAutomatedSlice = function createAutomatedSlice(sliceConfig) {
|
|
3843
|
+
var rtkConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3772
3844
|
var pluginData = {};
|
|
3773
3845
|
map_1(sliceConfig.initialState, function (_item, key) {
|
|
3774
3846
|
var item = _item; // cache it here to pull item -> value -> value -> value if multiple plugins are used...
|
|
@@ -3824,18 +3896,18 @@ var configure = function configure(_ref) {
|
|
|
3824
3896
|
return action.payload;
|
|
3825
3897
|
}
|
|
3826
3898
|
}, sliceSetterKey, function (state, action) {
|
|
3827
|
-
var _loop = function _loop(
|
|
3828
|
-
var actionType = "set".concat(upperFirst_1(
|
|
3899
|
+
var _loop = function _loop(_key) {
|
|
3900
|
+
var actionType = "set".concat(upperFirst_1(_key));
|
|
3829
3901
|
var setter = setterReducers[actionType] || function (_state, _action) {
|
|
3830
|
-
_state[
|
|
3902
|
+
_state[_key] = _action.payload;
|
|
3831
3903
|
};
|
|
3832
3904
|
setter(state, {
|
|
3833
3905
|
type: actionType,
|
|
3834
|
-
payload: action.payload[
|
|
3906
|
+
payload: action.payload[_key]
|
|
3835
3907
|
});
|
|
3836
3908
|
};
|
|
3837
|
-
for (var
|
|
3838
|
-
_loop(
|
|
3909
|
+
for (var _key in action.payload) {
|
|
3910
|
+
_loop(_key);
|
|
3839
3911
|
}
|
|
3840
3912
|
}), sliceConfig.reducers || {})
|
|
3841
3913
|
}));
|
|
@@ -3848,8 +3920,8 @@ var configure = function configure(_ref) {
|
|
|
3848
3920
|
domainHookKey = domainHookKey.replace(/(^use)(.*)(Slice$)/, "$1$2_$3");
|
|
3849
3921
|
}
|
|
3850
3922
|
var getParams = function getParams() {
|
|
3851
|
-
for (var _len = arguments.length, args = new Array(_len),
|
|
3852
|
-
args[
|
|
3923
|
+
for (var _len = arguments.length, args = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
|
3924
|
+
args[_key2] = arguments[_key2];
|
|
3853
3925
|
}
|
|
3854
3926
|
var params = args;
|
|
3855
3927
|
if (args.length === 1 && typeof args[0] === "function") {
|
|
@@ -3888,10 +3960,16 @@ var configure = function configure(_ref) {
|
|
|
3888
3960
|
injectSlice$1(slice);
|
|
3889
3961
|
return slice;
|
|
3890
3962
|
};
|
|
3891
|
-
|
|
3963
|
+
|
|
3964
|
+
// Overload signatures for the astroglide/createSlice function
|
|
3965
|
+
|
|
3966
|
+
function astroglide(name) {
|
|
3967
|
+
var initialState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3892
3968
|
var rtkConfig = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
3893
3969
|
var astroglideConfigOverrides = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
3894
3970
|
var shorthandParams = _typeof(name) === "object";
|
|
3971
|
+
|
|
3972
|
+
// Restore original parameter passing logic exactly
|
|
3895
3973
|
var params = [].concat(_toConsumableArray(shorthandParams ? [name, initialState, rtkConfig] : [_objectSpread2(_objectSpread2({}, rtkConfig), {}, {
|
|
3896
3974
|
name: name,
|
|
3897
3975
|
initialState: initialState
|
|
@@ -3899,7 +3977,7 @@ var configure = function configure(_ref) {
|
|
|
3899
3977
|
|
|
3900
3978
|
// @ts-ignore - params is dynamically constructed based on shorthand vs normal call
|
|
3901
3979
|
return createAutomatedSlice.apply(void 0, _toConsumableArray(params));
|
|
3902
|
-
}
|
|
3980
|
+
}
|
|
3903
3981
|
return {
|
|
3904
3982
|
createSlice: astroglide,
|
|
3905
3983
|
astroglide: astroglide,
|
|
@@ -3910,6 +3988,8 @@ var configure = function configure(_ref) {
|
|
|
3910
3988
|
};
|
|
3911
3989
|
};
|
|
3912
3990
|
|
|
3991
|
+
// Export types for consumer usage
|
|
3992
|
+
|
|
3913
3993
|
exports.addPlugin = addPlugin;
|
|
3914
3994
|
exports.addPlugins = addPlugins;
|
|
3915
3995
|
exports.configure = configure;
|
|
@@ -3740,15 +3740,86 @@ var configure$1 = function configure(store) {
|
|
|
3740
3740
|
|
|
3741
3741
|
var _excluded = ["middleware", "devTools", "preloadedState", "enhancers"],
|
|
3742
3742
|
_excluded2 = ["selectDomain"];
|
|
3743
|
-
|
|
3744
|
-
|
|
3743
|
+
|
|
3744
|
+
// ============================================================================
|
|
3745
|
+
// Utility Types
|
|
3746
|
+
// ============================================================================
|
|
3747
|
+
|
|
3748
|
+
/** Capitalize first letter of a string type */
|
|
3749
|
+
|
|
3750
|
+
// ============================================================================
|
|
3751
|
+
// Hook Types
|
|
3752
|
+
// ============================================================================
|
|
3753
|
+
|
|
3754
|
+
/** Return type for hooks - [value, setter, extras] */
|
|
3755
|
+
|
|
3756
|
+
/** A hook with static methods for non-component usage */
|
|
3757
|
+
|
|
3758
|
+
/** Generate hook types from initial state - creates useFieldName for each field */
|
|
3759
|
+
|
|
3760
|
+
/** Domain hook for the entire slice state */
|
|
3761
|
+
|
|
3762
|
+
// ============================================================================
|
|
3763
|
+
// Selector Types
|
|
3764
|
+
// ============================================================================
|
|
3765
|
+
|
|
3766
|
+
/** Generate selector types from initial state - creates selectFieldName for each field */
|
|
3767
|
+
|
|
3768
|
+
// ============================================================================
|
|
3769
|
+
// Action Types
|
|
3770
|
+
// ============================================================================
|
|
3771
|
+
|
|
3772
|
+
/** Generate setter action types from initial state - creates setFieldName for each field */
|
|
3773
|
+
|
|
3774
|
+
/** Slice-level setter action */
|
|
3775
|
+
|
|
3776
|
+
/** Extract action types from custom reducers */
|
|
3777
|
+
|
|
3778
|
+
// ============================================================================
|
|
3779
|
+
// Extended Slice Type
|
|
3780
|
+
// ============================================================================
|
|
3781
|
+
|
|
3782
|
+
/** Extended slice with hooks, selectors, and properly typed actions */
|
|
3783
|
+
|
|
3784
|
+
// ============================================================================
|
|
3785
|
+
// Configure Options Types
|
|
3786
|
+
// ============================================================================
|
|
3787
|
+
|
|
3788
|
+
/** Configuration options for the store - reducer is NOT required */
|
|
3789
|
+
|
|
3790
|
+
// ============================================================================
|
|
3791
|
+
// RTK Config Types
|
|
3792
|
+
// ============================================================================
|
|
3793
|
+
|
|
3794
|
+
/** RTK-compatible configuration for custom reducers */
|
|
3795
|
+
|
|
3796
|
+
/** Astroglide-specific configuration overrides */
|
|
3797
|
+
|
|
3798
|
+
// ============================================================================
|
|
3799
|
+
// Configure Result Type
|
|
3800
|
+
// ============================================================================
|
|
3801
|
+
|
|
3802
|
+
/** Result returned from configure() */
|
|
3803
|
+
|
|
3804
|
+
var configure = function configure() {
|
|
3805
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
3806
|
+
_middleware = _ref.middleware,
|
|
3745
3807
|
devTools = _ref.devTools,
|
|
3746
3808
|
preloadedState = _ref.preloadedState,
|
|
3747
3809
|
enhancers = _ref.enhancers,
|
|
3748
3810
|
staticReducers = _objectWithoutProperties(_ref, _excluded);
|
|
3811
|
+
// Add a placeholder reducer if no static reducers provided
|
|
3812
|
+
// This prevents combineReducers({}) from throwing an error
|
|
3813
|
+
var hasStaticReducers = Object.keys(staticReducers).length > 0;
|
|
3814
|
+
var initialReducers = hasStaticReducers ? staticReducers : {
|
|
3815
|
+
__astroglide_init__: function __astroglide_init__() {
|
|
3816
|
+
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3817
|
+
return state;
|
|
3818
|
+
}
|
|
3819
|
+
};
|
|
3749
3820
|
var store = configureStore({
|
|
3750
3821
|
// @ts-ignore-next-line
|
|
3751
|
-
reducer: combineReducers(
|
|
3822
|
+
reducer: combineReducers(initialReducers),
|
|
3752
3823
|
middleware: function middleware(getDefaultMiddleware) {
|
|
3753
3824
|
return [].concat(_toConsumableArray(typeof _middleware === "function" ? _middleware(getDefaultMiddleware) : _middleware || []), [injectableMiddleware]);
|
|
3754
3825
|
},
|
|
@@ -3759,12 +3830,13 @@ var configure = function configure(_ref) {
|
|
|
3759
3830
|
var _configureSelectors = configure$1(store),
|
|
3760
3831
|
makePropertySelectorsFromSlice = _configureSelectors.makePropertySelectorsFromSlice;
|
|
3761
3832
|
var injectSlice$1 = function injectSlice$1(slice) {
|
|
3762
|
-
return injectSlice(store,
|
|
3833
|
+
return injectSlice(store, initialReducers, slice);
|
|
3763
3834
|
};
|
|
3764
3835
|
var injectReducer$1 = function injectReducer$1(key, asyncReducer) {
|
|
3765
|
-
return injectReducer(store,
|
|
3836
|
+
return injectReducer(store, initialReducers, key, asyncReducer);
|
|
3766
3837
|
};
|
|
3767
|
-
var createAutomatedSlice = function createAutomatedSlice(sliceConfig
|
|
3838
|
+
var createAutomatedSlice = function createAutomatedSlice(sliceConfig) {
|
|
3839
|
+
var rtkConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3768
3840
|
var pluginData = {};
|
|
3769
3841
|
map_1(sliceConfig.initialState, function (_item, key) {
|
|
3770
3842
|
var item = _item; // cache it here to pull item -> value -> value -> value if multiple plugins are used...
|
|
@@ -3820,18 +3892,18 @@ var configure = function configure(_ref) {
|
|
|
3820
3892
|
return action.payload;
|
|
3821
3893
|
}
|
|
3822
3894
|
}, sliceSetterKey, function (state, action) {
|
|
3823
|
-
var _loop = function _loop(
|
|
3824
|
-
var actionType = "set".concat(upperFirst_1(
|
|
3895
|
+
var _loop = function _loop(_key) {
|
|
3896
|
+
var actionType = "set".concat(upperFirst_1(_key));
|
|
3825
3897
|
var setter = setterReducers[actionType] || function (_state, _action) {
|
|
3826
|
-
_state[
|
|
3898
|
+
_state[_key] = _action.payload;
|
|
3827
3899
|
};
|
|
3828
3900
|
setter(state, {
|
|
3829
3901
|
type: actionType,
|
|
3830
|
-
payload: action.payload[
|
|
3902
|
+
payload: action.payload[_key]
|
|
3831
3903
|
});
|
|
3832
3904
|
};
|
|
3833
|
-
for (var
|
|
3834
|
-
_loop(
|
|
3905
|
+
for (var _key in action.payload) {
|
|
3906
|
+
_loop(_key);
|
|
3835
3907
|
}
|
|
3836
3908
|
}), sliceConfig.reducers || {})
|
|
3837
3909
|
}));
|
|
@@ -3844,8 +3916,8 @@ var configure = function configure(_ref) {
|
|
|
3844
3916
|
domainHookKey = domainHookKey.replace(/(^use)(.*)(Slice$)/, "$1$2_$3");
|
|
3845
3917
|
}
|
|
3846
3918
|
var getParams = function getParams() {
|
|
3847
|
-
for (var _len = arguments.length, args = new Array(_len),
|
|
3848
|
-
args[
|
|
3919
|
+
for (var _len = arguments.length, args = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
|
3920
|
+
args[_key2] = arguments[_key2];
|
|
3849
3921
|
}
|
|
3850
3922
|
var params = args;
|
|
3851
3923
|
if (args.length === 1 && typeof args[0] === "function") {
|
|
@@ -3884,10 +3956,16 @@ var configure = function configure(_ref) {
|
|
|
3884
3956
|
injectSlice$1(slice);
|
|
3885
3957
|
return slice;
|
|
3886
3958
|
};
|
|
3887
|
-
|
|
3959
|
+
|
|
3960
|
+
// Overload signatures for the astroglide/createSlice function
|
|
3961
|
+
|
|
3962
|
+
function astroglide(name) {
|
|
3963
|
+
var initialState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3888
3964
|
var rtkConfig = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
3889
3965
|
var astroglideConfigOverrides = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
3890
3966
|
var shorthandParams = _typeof(name) === "object";
|
|
3967
|
+
|
|
3968
|
+
// Restore original parameter passing logic exactly
|
|
3891
3969
|
var params = [].concat(_toConsumableArray(shorthandParams ? [name, initialState, rtkConfig] : [_objectSpread2(_objectSpread2({}, rtkConfig), {}, {
|
|
3892
3970
|
name: name,
|
|
3893
3971
|
initialState: initialState
|
|
@@ -3895,7 +3973,7 @@ var configure = function configure(_ref) {
|
|
|
3895
3973
|
|
|
3896
3974
|
// @ts-ignore - params is dynamically constructed based on shorthand vs normal call
|
|
3897
3975
|
return createAutomatedSlice.apply(void 0, _toConsumableArray(params));
|
|
3898
|
-
}
|
|
3976
|
+
}
|
|
3899
3977
|
return {
|
|
3900
3978
|
createSlice: astroglide,
|
|
3901
3979
|
astroglide: astroglide,
|
|
@@ -3906,4 +3984,6 @@ var configure = function configure(_ref) {
|
|
|
3906
3984
|
};
|
|
3907
3985
|
};
|
|
3908
3986
|
|
|
3987
|
+
// Export types for consumer usage
|
|
3988
|
+
|
|
3909
3989
|
export { addPlugin, addPlugins, configure, createSelectorHook, createSelectorUpdateHook, configure as default, plugins };
|