redux-astroglide 0.1.21 → 0.1.24

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/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+
2
+ ### Bug Fixes
3
+
4
+ ### Features
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
- var configure = function configure(_ref) {
3748
- var _middleware = _ref.middleware,
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(staticReducers),
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, staticReducers, slice);
3837
+ return injectSlice(store, initialReducers, slice);
3767
3838
  };
3768
3839
  var injectReducer$1 = function injectReducer$1(key, asyncReducer) {
3769
- return injectReducer(store, staticReducers, key, asyncReducer);
3840
+ return injectReducer(store, initialReducers, key, asyncReducer);
3770
3841
  };
3771
- var createAutomatedSlice = function createAutomatedSlice(sliceConfig, rtkConfig) {
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(key) {
3828
- var actionType = "set".concat(upperFirst_1(key));
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[key] = _action.payload;
3902
+ _state[_key] = _action.payload;
3831
3903
  };
3832
3904
  setter(state, {
3833
3905
  type: actionType,
3834
- payload: action.payload[key]
3906
+ payload: action.payload[_key]
3835
3907
  });
3836
3908
  };
3837
- for (var key in action.payload) {
3838
- _loop(key);
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), _key = 0; _key < _len; _key++) {
3852
- args[_key] = arguments[_key];
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,16 +3960,24 @@ var configure = function configure(_ref) {
3888
3960
  injectSlice$1(slice);
3889
3961
  return slice;
3890
3962
  };
3891
- var astroglide = function astroglide(name, initialState) {
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
3898
3976
  })]), [shorthandParams ? astroglideConfigOverrides : initialState]);
3977
+
3978
+ // @ts-ignore - params is dynamically constructed based on shorthand vs normal call
3899
3979
  return createAutomatedSlice.apply(void 0, _toConsumableArray(params));
3900
- };
3980
+ }
3901
3981
  return {
3902
3982
  createSlice: astroglide,
3903
3983
  astroglide: astroglide,
@@ -3908,6 +3988,8 @@ var configure = function configure(_ref) {
3908
3988
  };
3909
3989
  };
3910
3990
 
3991
+ // Export types for consumer usage
3992
+
3911
3993
  exports.addPlugin = addPlugin;
3912
3994
  exports.addPlugins = addPlugins;
3913
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
- var configure = function configure(_ref) {
3744
- var _middleware = _ref.middleware,
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(staticReducers),
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, staticReducers, slice);
3833
+ return injectSlice(store, initialReducers, slice);
3763
3834
  };
3764
3835
  var injectReducer$1 = function injectReducer$1(key, asyncReducer) {
3765
- return injectReducer(store, staticReducers, key, asyncReducer);
3836
+ return injectReducer(store, initialReducers, key, asyncReducer);
3766
3837
  };
3767
- var createAutomatedSlice = function createAutomatedSlice(sliceConfig, rtkConfig) {
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(key) {
3824
- var actionType = "set".concat(upperFirst_1(key));
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[key] = _action.payload;
3898
+ _state[_key] = _action.payload;
3827
3899
  };
3828
3900
  setter(state, {
3829
3901
  type: actionType,
3830
- payload: action.payload[key]
3902
+ payload: action.payload[_key]
3831
3903
  });
3832
3904
  };
3833
- for (var key in action.payload) {
3834
- _loop(key);
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), _key = 0; _key < _len; _key++) {
3848
- args[_key] = arguments[_key];
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,16 +3956,24 @@ var configure = function configure(_ref) {
3884
3956
  injectSlice$1(slice);
3885
3957
  return slice;
3886
3958
  };
3887
- var astroglide = function astroglide(name, initialState) {
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
3894
3972
  })]), [shorthandParams ? astroglideConfigOverrides : initialState]);
3973
+
3974
+ // @ts-ignore - params is dynamically constructed based on shorthand vs normal call
3895
3975
  return createAutomatedSlice.apply(void 0, _toConsumableArray(params));
3896
- };
3976
+ }
3897
3977
  return {
3898
3978
  createSlice: astroglide,
3899
3979
  astroglide: astroglide,
@@ -3904,4 +3984,6 @@ var configure = function configure(_ref) {
3904
3984
  };
3905
3985
  };
3906
3986
 
3987
+ // Export types for consumer usage
3988
+
3907
3989
  export { addPlugin, addPlugins, configure, createSelectorHook, createSelectorUpdateHook, configure as default, plugins };