frosty 0.0.14 → 0.0.15

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.
Files changed (40) hide show
  1. package/dist/_native.d.ts +1 -0
  2. package/dist/_native.js +5 -4
  3. package/dist/_native.js.map +1 -1
  4. package/dist/_native.mjs +3 -3
  5. package/dist/_native.mjs.map +1 -1
  6. package/dist/dom.js +3 -3
  7. package/dist/dom.mjs +3 -3
  8. package/dist/index.d.ts +1 -2
  9. package/dist/index.js +29 -29
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +4 -4
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/internals/{common-KSKXTzR8.mjs → common-Comag6Is.mjs} +5 -4
  14. package/dist/internals/{common-KSKXTzR8.mjs.map → common-Comag6Is.mjs.map} +1 -1
  15. package/dist/internals/{common-FG7T3c2f.js → common-CuY4PQF6.js} +5 -4
  16. package/dist/internals/{common-FG7T3c2f.js.map → common-CuY4PQF6.js.map} +1 -1
  17. package/dist/internals/{renderer-jjw2FwKT.js → renderer-CXN_wamO.js} +9 -9
  18. package/dist/internals/{renderer-jjw2FwKT.js.map → renderer-CXN_wamO.js.map} +1 -1
  19. package/dist/internals/{renderer-GTnF-hYa.mjs → renderer-ovOliXPW.mjs} +2 -2
  20. package/dist/internals/{renderer-GTnF-hYa.mjs.map → renderer-ovOliXPW.mjs.map} +1 -1
  21. package/dist/internals/{utils-BJL3yvTI.mjs → state-BRZQ4OPf.mjs} +44 -42
  22. package/dist/internals/state-BRZQ4OPf.mjs.map +1 -0
  23. package/dist/internals/{utils-Bipfwp1R.js → state-BzHki2Zn.js} +44 -41
  24. package/dist/internals/state-BzHki2Zn.js.map +1 -0
  25. package/dist/internals/{sync-B9zfuWYQ.mjs → sync-BM8lmLVc.mjs} +2 -2
  26. package/dist/internals/{sync-B9zfuWYQ.mjs.map → sync-BM8lmLVc.mjs.map} +1 -1
  27. package/dist/internals/{sync-BIbWmXEq.js → sync-wiDTr4Cf.js} +17 -17
  28. package/dist/internals/{sync-BIbWmXEq.js.map → sync-wiDTr4Cf.js.map} +1 -1
  29. package/dist/internals/utils-aV0DDGsD.d.ts +7 -0
  30. package/dist/internals/utils-aV0DDGsD.d.ts.map +1 -0
  31. package/dist/server-dom.js +3 -3
  32. package/dist/server-dom.mjs +3 -3
  33. package/dist/web.d.ts +23 -21
  34. package/dist/web.js +194 -161
  35. package/dist/web.js.map +1 -1
  36. package/dist/web.mjs +194 -162
  37. package/dist/web.mjs.map +1 -1
  38. package/package.json +1 -1
  39. package/dist/internals/utils-BJL3yvTI.mjs.map +0 -1
  40. package/dist/internals/utils-Bipfwp1R.js.map +0 -1
package/dist/_native.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { N as NativeElementType, c as PropsType, b as ComponentNode } from './internals/common-CIXimrNw.js';
2
+ export { u as uniqueId } from './internals/utils-aV0DDGsD.js';
2
3
  export { V as VNode, _ as _Renderer } from './internals/renderer-DeoTMWfn.js';
3
4
  import '@o2ter/utils-js';
4
5
  import 'lodash';
package/dist/_native.js CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  var runtime = require('./internals/runtime-CHi74WKN.js');
4
- var renderer = require('./internals/renderer-jjw2FwKT.js');
5
- var utils = require('./internals/utils-Bipfwp1R.js');
4
+ var state = require('./internals/state-BzHki2Zn.js');
5
+ var renderer = require('./internals/renderer-CXN_wamO.js');
6
6
  var component = require('./internals/component-DJsXAx2C.js');
7
7
  require('lodash');
8
- require('nextick');
9
8
  require('myers.js');
9
+ require('nextick');
10
10
 
11
11
  //
12
12
  // native.ts
@@ -36,8 +36,9 @@ function _createNativeElement(type, props, key) {
36
36
  return runtime._createElement(type, { ...props, key });
37
37
  }
38
38
 
39
+ exports.VNode = state.VNode;
40
+ exports.uniqueId = state.uniqueId;
39
41
  exports._Renderer = renderer._Renderer;
40
- exports.VNode = utils.VNode;
41
42
  exports.NativeElementType = component.NativeElementType;
42
43
  exports._createNativeElement = _createNativeElement;
43
44
  //# sourceMappingURL=_native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_native.js","sources":["../../src/renderer/native.ts"],"sourcesContent":["//\n// native.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { _createElement, PropsType } from '../core/types/runtime';\nimport { ComponentNode, NativeElementType } from '../core/types/component';\n\nexport { _Renderer } from '../core/renderer';\nexport { VNode } from '../core/reconciler/vnode';\nexport { NativeElementType } from '../core/types/component';\n\nexport function _createNativeElement(\n type: typeof NativeElementType,\n props: PropsType,\n key?: string | number\n): ComponentNode {\n return _createElement(type, { ...props, key });\n}\n"],"names":["_createElement"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;SASgB,oBAAoB,CAClC,IAA8B,EAC9B,KAAgB,EAChB,GAAqB,EAAA;IAErB,OAAOA,sBAAc,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC;AAChD;;;;;;;"}
1
+ {"version":3,"file":"_native.js","sources":["../../src/renderer/native.ts"],"sourcesContent":["//\n// native.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { _createElement, PropsType } from '../core/types/runtime';\nimport { ComponentNode, NativeElementType } from '../core/types/component';\n\nexport { uniqueId } from '../core/utils';\nexport { _Renderer } from '../core/renderer';\nexport { VNode } from '../core/reconciler/vnode';\nexport { NativeElementType } from '../core/types/component';\n\nexport function _createNativeElement(\n type: typeof NativeElementType,\n props: PropsType,\n key?: string | number\n): ComponentNode {\n return _createElement(type, { ...props, key });\n}\n"],"names":["_createElement"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;SAUgB,oBAAoB,CAClC,IAA8B,EAC9B,KAAgB,EAChB,GAAqB,EAAA;IAErB,OAAOA,sBAAc,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC;AAChD;;;;;;;;"}
package/dist/_native.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import { _ as _createElement } from './internals/runtime-BN27rc51.mjs';
2
- export { _ as _Renderer } from './internals/renderer-GTnF-hYa.mjs';
3
- export { V as VNode } from './internals/utils-BJL3yvTI.mjs';
2
+ export { V as VNode, a as uniqueId } from './internals/state-BRZQ4OPf.mjs';
3
+ export { _ as _Renderer } from './internals/renderer-ovOliXPW.mjs';
4
4
  export { N as NativeElementType } from './internals/component-tyF62qKh.mjs';
5
5
  import 'lodash';
6
- import 'nextick';
7
6
  import 'myers.js';
7
+ import 'nextick';
8
8
 
9
9
  //
10
10
  // native.ts
@@ -1 +1 @@
1
- {"version":3,"file":"_native.mjs","sources":["../../src/renderer/native.ts"],"sourcesContent":["//\n// native.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { _createElement, PropsType } from '../core/types/runtime';\nimport { ComponentNode, NativeElementType } from '../core/types/component';\n\nexport { _Renderer } from '../core/renderer';\nexport { VNode } from '../core/reconciler/vnode';\nexport { NativeElementType } from '../core/types/component';\n\nexport function _createNativeElement(\n type: typeof NativeElementType,\n props: PropsType,\n key?: string | number\n): ComponentNode {\n return _createElement(type, { ...props, key });\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;SASgB,oBAAoB,CAClC,IAA8B,EAC9B,KAAgB,EAChB,GAAqB,EAAA;IAErB,OAAO,cAAc,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC;AAChD;;;;"}
1
+ {"version":3,"file":"_native.mjs","sources":["../../src/renderer/native.ts"],"sourcesContent":["//\n// native.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { _createElement, PropsType } from '../core/types/runtime';\nimport { ComponentNode, NativeElementType } from '../core/types/component';\n\nexport { uniqueId } from '../core/utils';\nexport { _Renderer } from '../core/renderer';\nexport { VNode } from '../core/reconciler/vnode';\nexport { NativeElementType } from '../core/types/component';\n\nexport function _createNativeElement(\n type: typeof NativeElementType,\n props: PropsType,\n key?: string | number\n): ComponentNode {\n return _createElement(type, { ...props, key });\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;SAUgB,oBAAoB,CAClC,IAA8B,EAC9B,KAAgB,EAChB,GAAqB,EAAA;IAErB,OAAO,cAAc,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC;AAChD;;;;"}
package/dist/dom.js CHANGED
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var common = require('./internals/common-FG7T3c2f.js');
3
+ var common = require('./internals/common-CuY4PQF6.js');
4
4
  require('lodash');
5
5
  require('myers.js');
6
- require('./internals/renderer-jjw2FwKT.js');
7
- require('./internals/utils-Bipfwp1R.js');
6
+ require('./internals/renderer-CXN_wamO.js');
7
+ require('./internals/state-BzHki2Zn.js');
8
8
  require('./internals/component-DJsXAx2C.js');
9
9
  require('nextick');
10
10
  require('postcss');
package/dist/dom.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { _ as _DOMRenderer } from './internals/common-KSKXTzR8.mjs';
1
+ import { _ as _DOMRenderer } from './internals/common-Comag6Is.mjs';
2
2
  import 'lodash';
3
3
  import 'myers.js';
4
- import './internals/renderer-GTnF-hYa.mjs';
5
- import './internals/utils-BJL3yvTI.mjs';
4
+ import './internals/renderer-ovOliXPW.mjs';
5
+ import './internals/state-BRZQ4OPf.mjs';
6
6
  import './internals/component-tyF62qKh.mjs';
7
7
  import 'nextick';
8
8
  import 'postcss';
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import { C as ComponentType, P as PropsWithChildren, S as SetStateAction, E as E
2
2
  import _ from 'lodash';
3
3
  import { Awaitable } from '@o2ter/utils-js';
4
4
  import { F as Fragment } from './internals/fragment-ukIb0ve_.js';
5
+ import { m as mergeRefs } from './internals/utils-aV0DDGsD.js';
5
6
  import 'csstype';
6
7
 
7
8
  /**
@@ -542,8 +543,6 @@ type PropsProviderProps = PropsWithChildren<{
542
543
  }>;
543
544
  declare const PropsProvider: ComponentType<PropsProviderProps>;
544
545
 
545
- declare const mergeRefs: <T>(...refs: Ref<T>[]) => (x: T) => void;
546
-
547
546
  declare const common_ComponentNode: typeof ComponentNode;
548
547
  declare const common_ComponentProps: typeof ComponentProps;
549
548
  declare const common_ComponentPropsWithoutRef: typeof ComponentPropsWithoutRef;
package/dist/index.js CHANGED
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _ = require('lodash');
6
- var sync = require('./internals/sync-BIbWmXEq.js');
7
- var utils = require('./internals/utils-Bipfwp1R.js');
6
+ var sync = require('./internals/sync-wiDTr4Cf.js');
7
+ var state = require('./internals/state-BzHki2Zn.js');
8
8
  var jsxRuntime = require('./jsx-runtime.js');
9
9
  var component = require('./internals/component-DJsXAx2C.js');
10
10
  var runtime = require('./internals/runtime-CHi74WKN.js');
@@ -296,7 +296,7 @@ const useAsyncDebounce = (callback, settings) => {
296
296
  return store.stable;
297
297
  };
298
298
 
299
- const Context = utils.createContext({
299
+ const Context = state.createContext({
300
300
  errors: [],
301
301
  setErrors: () => { },
302
302
  });
@@ -347,7 +347,7 @@ const ResourceErrors = ({ children }) => {
347
347
  * - `error`: The error object or message.
348
348
  * - `refresh`: A function to retry the operation that caused the error.
349
349
  */
350
- const useResourceErrors = () => utils.useContext(Context).errors;
350
+ const useResourceErrors = () => state.useContext(Context).errors;
351
351
 
352
352
  //
353
353
  // index.ts
@@ -396,14 +396,14 @@ const useResourceErrors = () => utils.useContext(Context).errors;
396
396
  const useResource = (config, deps) => {
397
397
  const fetch = _.isFunction(config) ? config : config.fetch;
398
398
  const debounce = _.isFunction(config) ? {} : config.debounce;
399
- const [state, setState] = useState({});
399
+ const [state$1, setState] = useState({});
400
400
  const _dispatch = (token, next) => setState(state => state.token === token ? ({
401
401
  ...(_.isFunction(next) ? next(state.flag ? state : _.omit(state, 'resource', 'error')) : next),
402
402
  count: state.flag ? state.count : (state.count ?? 0) + 1,
403
403
  flag: true,
404
404
  }) : state);
405
405
  const _fetch = useAsyncDebounce(async (type, abort, reset, param, prevState) => {
406
- const token = _.uniqueId();
406
+ const token = state.uniqueId();
407
407
  setState(state => ({ ...state, type, token, abort, flag: !reset }));
408
408
  try {
409
409
  const resource = await fetch({
@@ -431,16 +431,16 @@ const useResource = (config, deps) => {
431
431
  void _fetch('refresh', controller, true);
432
432
  return () => controller.abort();
433
433
  }, deps ?? []);
434
- const _cancelRef = sync.useCallback((reason) => { state.abort?.abort(reason); });
434
+ const _cancelRef = sync.useCallback((reason) => { state$1.abort?.abort(reason); });
435
435
  const _refreshRef = sync.useCallback((param) => _fetch('refresh', new AbortController(), true, param));
436
- const _nextRef = sync.useCallback((param) => _fetch('next', new AbortController(), false, param, state.resource));
436
+ const _nextRef = sync.useCallback((param) => _fetch('next', new AbortController(), false, param, state$1.resource));
437
437
  const _setResRef = sync.useCallback((resource) => setState(state => ({
438
438
  ..._.omit(state, 'resource', 'error'),
439
439
  resource: _.isFunction(resource) ? resource(state.resource) : resource,
440
440
  })));
441
- const { setErrors } = utils.useContext(Context);
441
+ const { setErrors } = state.useContext(Context);
442
442
  sync.useEffect(() => {
443
- const { type, abort, token = _.uniqueId(), error } = state;
443
+ const { type, abort, token = state.uniqueId(), error } = state$1;
444
444
  if (!error)
445
445
  return;
446
446
  setErrors(v => [...v, {
@@ -451,13 +451,13 @@ const useResource = (config, deps) => {
451
451
  loading: !_.isNil(abort),
452
452
  }]);
453
453
  return () => setErrors(v => _.filter(v, x => x.token !== token));
454
- }, [state]);
454
+ }, [state$1]);
455
455
  return {
456
- count: state.count ?? 0,
457
- refreshing: !_.isNil(state.abort) && state.type === 'refresh',
458
- loading: !_.isNil(state.abort),
459
- resource: state.resource,
460
- error: state.error,
456
+ count: state$1.count ?? 0,
457
+ refreshing: !_.isNil(state$1.abort) && state$1.type === 'refresh',
458
+ loading: !_.isNil(state$1.abort),
459
+ resource: state$1.resource,
460
+ error: state$1.error,
461
461
  cancel: _cancelRef,
462
462
  refresh: _refreshRef,
463
463
  next: _nextRef,
@@ -672,10 +672,10 @@ const useStore = (store, selector = v => v, equal = _.isEqual) => sync.useSyncEx
672
672
  * @throws Will throw an error if the function is called outside of a valid render context.
673
673
  */
674
674
  const useStack = () => {
675
- const state = utils.reconciler.currentHookState;
676
- if (!state)
675
+ const state$1 = state.reconciler.currentHookState;
676
+ if (!state$1)
677
677
  throw Error('useStack must be used within a render function.');
678
- return _.map(state.stack, x => x._component);
678
+ return _.map(state$1.stack, x => x._component);
679
679
  };
680
680
 
681
681
  //
@@ -744,18 +744,18 @@ function useReducer(reducer, initialState) {
744
744
  var common = /*#__PURE__*/Object.freeze({
745
745
  __proto__: null,
746
746
  ComponentNode: component.ComponentNode,
747
- ErrorBoundary: utils.ErrorBoundary,
747
+ ErrorBoundary: state.ErrorBoundary,
748
748
  Fragment: jsxRuntime.Fragment,
749
- PropsProvider: utils.PropsProvider,
749
+ PropsProvider: state.PropsProvider,
750
750
  ResourceErrors: ResourceErrors,
751
- createContext: utils.createContext,
751
+ createContext: state.createContext,
752
752
  createElement: runtime.createElement,
753
753
  createStore: createStore,
754
- mergeRefs: utils.mergeRefs,
754
+ mergeRefs: state.mergeRefs,
755
755
  useAnimate: useAnimate,
756
756
  useAsyncDebounce: useAsyncDebounce,
757
757
  useCallback: sync.useCallback,
758
- useContext: utils.useContext,
758
+ useContext: state.useContext,
759
759
  useDebounce: useDebounce,
760
760
  useEffect: sync.useEffect,
761
761
  useInterval: useInterval,
@@ -776,11 +776,11 @@ exports.useCallback = sync.useCallback;
776
776
  exports.useEffect = sync.useEffect;
777
777
  exports.useMemo = sync.useMemo;
778
778
  exports.useSyncExternalStore = sync.useSyncExternalStore;
779
- exports.ErrorBoundary = utils.ErrorBoundary;
780
- exports.PropsProvider = utils.PropsProvider;
781
- exports.createContext = utils.createContext;
782
- exports.mergeRefs = utils.mergeRefs;
783
- exports.useContext = utils.useContext;
779
+ exports.ErrorBoundary = state.ErrorBoundary;
780
+ exports.PropsProvider = state.PropsProvider;
781
+ exports.createContext = state.createContext;
782
+ exports.mergeRefs = state.mergeRefs;
783
+ exports.useContext = state.useContext;
784
784
  exports.Fragment = jsxRuntime.Fragment;
785
785
  exports.ComponentNode = component.ComponentNode;
786
786
  exports.createElement = runtime.createElement;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/core/hooks/ref.ts","../../src/core/hooks/state.ts","../../src/core/hooks/misc/animate.ts","../../src/core/hooks/debounce.ts","../../src/core/hooks/misc/resource/error.tsx","../../src/core/hooks/misc/resource/index.ts","../../src/core/hooks/misc/interval.ts","../../src/core/hooks/misc/store.ts","../../src/core/hooks/stack.ts","../../src/core/hooks/reducer.ts","../../src/common.ts"],"sourcesContent":["//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useEffect, _useMemo } from '../reconciler/hooks';\nimport { Ref, RefObject } from '../types/common';\n\n/**\n * Creates a mutable reference object that persists across function calls.\n * \n * @template T The type of the value stored in the reference.\n * @param initialValue The initial value to store in the reference.\n * @returns An object with a `current` property that holds the value.\n */\nexport function useRef<T>(initialValue: T): RefObject<T>;\nexport function useRef<T = undefined>(): RefObject<T | undefined>;\n\nexport function useRef(initialValue?: any) {\n return _useMemo('useRef', () => ({ current: initialValue }), null);\n}\n\n/**\n * Associates a reference with a value created by an initializer function.\n * \n * @template T The type of the reference.\n * @template R The type of the value created by the initializer function.\n * @param ref A reference object or a callback function to receive the value.\n * @param init A function that initializes and returns the value to associate with the reference.\n * @param deps An optional dependency array. The initializer function is re-executed when the dependencies change.\n */\nexport const useRefHandle = <T, R extends T>(\n ref: Ref<T> | undefined,\n init: () => R,\n deps?: any\n) => _useEffect('useRefHandle', () => {\n try {\n if (ref) {\n const _ref = init();\n if (typeof ref === 'function') ref(_ref);\n else if (typeof ref === 'object') ref.current = _ref;\n }\n return () => void 0;\n } catch (e) {\n console.error(e);\n return () => void 0;\n }\n}, deps);","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\nimport { SetStateAction } from '../types/common';\n\n/**\n * A hook function for managing state within a custom framework or library.\n *\n * @template T - The type of the state value.\n * @param - The initial state value or a function that returns the initial state.\n * @returns - A tuple containing the current state value and a function to update the state.\n *\n * The `useState` function provides a way to manage stateful values. It returns the current state\n * and a setter function that can update the state. The setter function accepts either a new value\n * or a function that receives the current state and returns the updated state.\n *\n * Example:\n * ```typescript\n * const [count, setCount] = useState(0);\n * setCount(5); // Updates the state to 5\n * setCount(prev => prev + 1); // Updates the state to the previous value + 1\n * ```\n */\nexport function useState<T>(initialState: T | (() => T)): [T, (dispatch: SetStateAction<T>) => void];\nexport function useState<T = undefined>(): [T | undefined, (dispatch: SetStateAction<T | undefined>) => void];\n\nexport function useState(initialState?: any) {\n const { value, setValue } = _useMemo('useState', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n setValue: (dispatch: SetStateAction<any>) => {\n state.value = _.isFunction(dispatch) ? dispatch(state.value) : dispatch;\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, setValue];\n}\n","//\n// animate.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { useRef } from '../ref';\nimport { useState } from '../state';\nimport { useCallback } from '../callback';\n\n/**\n * Options for configuring the animation.\n * \n * @property fromValue - The starting value of the animation. Defaults to the current value.\n * @property toValue - The target value of the animation.\n * @property duration - The duration of the animation in milliseconds.\n * @property easing - An optional easing function to control the animation's progress. Defaults to a linear function.\n * @property delay - An optional delay (in milliseconds) before the animation starts. Defaults to `0`.\n * @property onCompleted - An optional callback function invoked when the animation completes or is stopped.\n */\ntype AnimateOptions = {\n fromValue?: number;\n toValue: number;\n duration: number;\n easing?: (value: number) => number;\n delay?: number;\n onCompleted?: (result: {\n value: number;\n finished: boolean;\n }) => void;\n};\n\n/**\n * Options for interpolating a value.\n * \n * @property inputRange - A tuple specifying the input range for interpolation.\n * @property outputRange - A tuple specifying the output range for interpolation.\n */\ntype InterpolateOptions = {\n inputRange: [number, number];\n outputRange: [number, number];\n};\n\n/**\n * Represents an interpolated value and provides a method to further interpolate it.\n * \n * @property value - The interpolated value.\n * @property interpolate - A function to interpolate the current value based on new input and output ranges.\n */\ntype AnimatedInterpolation = {\n value: number;\n interpolate: ({ inputRange, outputRange }: InterpolateOptions) => AnimatedInterpolation;\n};\n\nconst interpolate = (value: number) => ({ inputRange, outputRange }: InterpolateOptions): AnimatedInterpolation => {\n const [inputMin, inputMax] = inputRange;\n const [outputMin, outputMax] = outputRange;\n\n // Safeguard against division by zero\n if (inputMax === inputMin) {\n throw new Error('Input range must have distinct values.');\n }\n\n const t = (value - inputMin) / (inputMax - inputMin);\n const interpolatedValue = outputMin + t * (outputMax - outputMin);\n return {\n value: interpolatedValue,\n interpolate: interpolate(interpolatedValue),\n };\n};\n\n/**\n * A hook to manage animations with support for starting, stopping, and interpolating values.\n * \n * @param initialValue - The initial value of the animation.\n * \n * @returns An object containing:\n * - `value`: The current animated value.\n * - `stop`: A function to stop the animation.\n * - `start`: A function to start the animation with specified options.\n * - `interpolate`: A function to interpolate the current value based on input and output ranges.\n */\nexport const useAnimate = (initialValue: number) => {\n const [value, setValue] = useState(initialValue);\n const ref = useRef<{\n interval: ReturnType<typeof setInterval>;\n callback?: AnimateOptions['onCompleted'];\n }>();\n const _stop = () => {\n const { interval, callback } = ref.current ?? {};\n ref.current = undefined;\n if (interval) clearInterval(interval);\n return callback;\n };\n const stop = useCallback(() => {\n const callback = _stop();\n if (_.isFunction(callback)) callback({ value, finished: false });\n });\n const start = useCallback(({\n fromValue = value,\n toValue,\n duration,\n easing = (x) => x,\n delay = 0,\n onCompleted,\n }: AnimateOptions) => {\n _stop();\n const start = Date.now();\n if (duration > 0) {\n ref.current = {\n interval: setInterval(() => {\n const t = (Date.now() - start) / duration - delay;\n if (t >= 1) {\n clearInterval(ref.current?.interval);\n ref.current = undefined;\n setValue(toValue);\n if (_.isFunction(onCompleted)) onCompleted({ value: toValue, finished: true });\n } else if (t >= 0) {\n setValue((toValue - fromValue) * easing(_.clamp(t, 0, 1)) + fromValue);\n }\n }, 16),\n callback: onCompleted,\n }\n }\n });\n return {\n value,\n stop,\n start,\n interpolate: interpolate(value),\n };\n}","//\n// debounce.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\nconst debounce = <T extends (...args: any) => any>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const { wait, ...options } = settings;\n return _.debounce(callback, wait, {\n ...options,\n leading: 'leading' in options ? !!options.leading : true,\n trailing: 'trailing' in options ? !!options.trailing : true,\n });\n}\n\nconst asyncDebounce = <T extends (...args: any) => PromiseLike<any>>(\n func: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n\n type R = T extends (...args: any) => PromiseLike<infer R> ? R : never;\n let preflight: Promise<R>;\n\n const debounced = debounce(async (\n resolve?: (value: PromiseLike<R>) => void,\n ...args: Parameters<T>\n ) => {\n const result = func(...args as any) as PromiseLike<R>;\n if (_.isFunction(resolve)) resolve(result);\n return result;\n }, settings);\n\n return (...args: Parameters<T>) => {\n if (_.isNil(preflight)) {\n preflight = new Promise<R>(r => debounced(r, ...args));\n return preflight;\n }\n return debounced(undefined, ...args) ?? preflight;\n };\n};\n\n/**\n * A hook that creates a debounced version of a function.\n * The debounced function delays invoking the callback until after\n * the specified wait time has elapsed since the last time it was called.\n * \n * This is useful for optimizing performance in scenarios where frequent\n * function calls (e.g., during user input or window resizing) can be expensive.\n * \n * @template T The type of the callback function.\n * @param callback The function to debounce.\n * @param settings Configuration options for debouncing, including:\n * - `wait` (number): The number of milliseconds to delay.\n * - Other lodash debounce options such as `leading` and `trailing`.\n * @returns A debounced version of the callback function.\n */\nexport const useDebounce = <T extends (...args: any) => any>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const store = _useMemo('useDebounce', () => {\n const store = {\n current: callback,\n stable: debounce(((...args) => store.current(...args)) as T, settings),\n };\n return store;\n }, null);\n store.current = callback;\n return store.stable;\n}\n\n/**\n * A hook that creates a debounced version of an asynchronous function.\n * The debounced function delays invoking the callback until after\n * the specified wait time has elapsed since the last time it was called.\n * \n * This is particularly useful for scenarios where frequent API calls\n * or other asynchronous operations need to be throttled to improve performance.\n * \n * @template T The type of the asynchronous callback function.\n * @param callback The asynchronous function to debounce.\n * @param settings Configuration options for debouncing, including:\n * - `wait` (number): The number of milliseconds to delay.\n * - Other lodash debounce options such as `leading` and `trailing`.\n * @returns A debounced version of the asynchronous callback function.\n */\nexport const useAsyncDebounce = <T extends (...args: any) => PromiseLike<any>>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const store = _useMemo('useAsyncDebounce', () => {\n const store = {\n current: callback,\n stable: asyncDebounce(((...args) => store.current(...args)) as T, settings),\n };\n return store;\n }, null);\n store.current = callback;\n return store.stable;\n}\n","//\n// error.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { ComponentType, PropsWithChildren, SetStateAction } from '../../../types/common';\nimport { createContext } from '../../context';\nimport { useContext } from '../../context';\nimport { useState } from '../../state';\nimport { useMemo } from '../../memo';\n\ntype Errors = {\n token: string;\n error: any;\n refresh: () => Awaitable<void>;\n refreshing: boolean;\n loading: boolean;\n}[];\n\nexport const Context = createContext<{\n errors: Errors;\n setErrors: (values: SetStateAction<Errors>) => void;\n}>({\n errors: [],\n setErrors: () => { },\n});\n\n/**\n * A context provider component for managing asynchronous resource errors.\n * \n * This component provides a shared context for tracking errors encountered during\n * asynchronous operations. It allows child components to access and manage these errors\n * using the `useResourceErrors` hook.\n * \n * ### Usage:\n * Wrap your application or specific parts of it with this component to enable error tracking:\n * \n * ```tsx\n * <ResourceErrors>\n * <YourComponent />\n * </ResourceErrors>\n * ```\n * \n * @param children - The child components that will have access to the error context.\n * \n * @returns A context provider that wraps the provided children.\n */\nexport const ResourceErrors: ComponentType<PropsWithChildren<{}>> = ({\n children\n}) => {\n const [errors, setErrors] = useState<Errors>([]);\n const value = useMemo(() => ({ errors, setErrors }), [errors, setErrors]);\n return (\n <Context value={value}>{children}</Context>\n );\n}\n\n/**\n * A hook to access the list of asynchronous resource errors.\n * \n * This hook allows components to retrieve the current list of errors being tracked\n * in the `ResourceErrors` context. It must be used within a component that is\n * a descendant of the `ResourceErrors` provider.\n * \n * ### Usage:\n * ```tsx\n * const errors = useResourceErrors();\n * \n * errors.forEach(({ token, error, refresh }) => {\n * console.error(`Error [${token}]:`, error);\n * // Optionally call refresh() to retry the operation\n * });\n * ```\n * \n * @returns The list of errors currently being tracked in the context. Each error includes:\n * - `token`: A unique identifier for the error.\n * - `error`: The error object or message.\n * - `refresh`: A function to retry the operation that caused the error.\n */\nexport const useResourceErrors = () => useContext(Context).errors;\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { SetStateAction } from '../../../types/common';\nimport { Config, Fetch, FetchWithIterable } from './types';\nimport { useState } from '../../state';\nimport { useEffect } from '../../effect';\nimport { useContext } from '../../context';\nimport { useCallback } from '../../callback';\nimport { useAsyncDebounce } from '../../debounce';\nimport { Context as ErrorContext } from './error';\nexport { ResourceErrors, useResourceErrors } from './error';\n\n/**\n * A hook to manage asynchronous resources with support for debouncing, error handling, and state management.\n * \n * @template T - The type of the resource being fetched.\n * @template P - The type of the parameters passed to the fetch function.\n * \n * @param config - The fetch function or a configuration object containing the fetch function and optional debounce settings.\n * @param deps - An optional dependency array to control when the resource is refreshed.\n * \n * @returns An object containing:\n * - `count`: The number of times the resource has been fetched.\n * - `refreshing`: A boolean indicating if the resource is currently being refreshed.\n * - `loading`: A boolean indicating if the resource is currently being loaded.\n * - `resource`: The fetched resource.\n * - `error`: Any error encountered during the fetch.\n * - `cancel`: A function to cancel the current fetch operation.\n * - `refresh`: A function to refresh the resource.\n * - `next`: A function to fetch the next set of data (for paginated resources).\n * - `setResource`: A function to manually update the resource state.\n */\nexport const useResource = <T, P = any>(\n config: Fetch<T, P> | Config<Fetch<T, P>>,\n deps?: any,\n) => {\n\n const fetch = _.isFunction(config) ? config : config.fetch;\n const debounce = _.isFunction(config) ? {} : config.debounce;\n\n const [state, setState] = useState<{\n type?: 'refresh' | 'next';\n count?: number;\n flag?: boolean;\n resource?: T;\n error?: any;\n token?: string;\n abort?: AbortController;\n }>({});\n\n const _dispatch = (\n token: string,\n next: SetStateAction<typeof state>,\n ) => setState(state => state.token === token ? ({\n ...(_.isFunction(next) ? next(state.flag ? state : _.omit(state, 'resource', 'error')) : next),\n count: state.flag ? state.count : (state.count ?? 0) + 1,\n flag: true,\n }) : state);\n\n const _fetch = useAsyncDebounce(async (\n type: 'refresh' | 'next',\n abort: AbortController,\n reset: boolean,\n param?: P,\n prevState?: T,\n ) => {\n\n const token = _.uniqueId();\n setState(state => ({ ...state, type, token, abort, flag: !reset }));\n\n try {\n\n const resource = await fetch({\n param,\n prevState,\n abortSignal: abort.signal,\n dispatch: (next) => {\n _dispatch(token, state => ({\n ...state,\n resource: _.isFunction(next) ? next(state.resource) : next,\n }));\n },\n });\n\n _dispatch(token, state => ({ resource: resource ?? state.resource }));\n\n } catch (error) {\n\n _dispatch(token, state => ({\n resource: state.resource,\n error,\n }));\n }\n\n }, debounce ?? {});\n\n useEffect(() => {\n const controller = new AbortController();\n void _fetch('refresh', controller, true);\n return () => controller.abort();\n }, deps ?? []);\n\n const _cancelRef = useCallback((reason?: any) => { state.abort?.abort(reason) });\n const _refreshRef = useCallback((param?: P) => _fetch('refresh', new AbortController(), true, param));\n const _nextRef = useCallback((param?: P) => _fetch('next', new AbortController(), false, param, state.resource));\n const _setResRef = useCallback((resource: T | ((prevState?: T) => T)) => setState(state => ({\n ..._.omit(state, 'resource', 'error'),\n resource: _.isFunction(resource) ? resource(state.resource) : resource,\n })));\n\n const { setErrors } = useContext(ErrorContext);\n useEffect(() => {\n const { type, abort, token = _.uniqueId(), error } = state;\n if (!error) return;\n setErrors(v => [...v, {\n token,\n error,\n refresh: _refreshRef,\n refreshing: !_.isNil(abort) && type === 'refresh',\n loading: !_.isNil(abort),\n }]);\n return () => setErrors(v => _.filter(v, x => x.token !== token));\n }, [state]);\n\n return {\n count: state.count ?? 0,\n refreshing: !_.isNil(state.abort) && state.type === 'refresh',\n loading: !_.isNil(state.abort),\n resource: state.resource,\n error: state.error,\n cancel: _cancelRef,\n refresh: _refreshRef,\n next: _nextRef,\n setResource: _setResRef,\n };\n}\n\n/**\n * A hook to manage asynchronous iterable resources, such as streams or paginated data.\n * \n * @template T - The type of the resource items being fetched.\n * @template P - The type of the parameters passed to the fetch function.\n * \n * @param config - The fetch function or a configuration object containing the fetch function and optional debounce settings.\n * @param deps - An optional dependency array to control when the resource is refreshed.\n * \n * @returns An object containing the same properties as `useResource`, but optimized for iterable resources.\n */\nexport const useIterableResource = <T, P = any>(\n config: FetchWithIterable<T, P> | Config<FetchWithIterable<T, P>>,\n deps?: any,\n) => {\n const fetch = _.isFunction(config) ? config : config.fetch;\n const debounce = _.isFunction(config) ? {} : config.debounce;\n const { next, ...result } = useResource<T[]>({\n fetch: async ({ dispatch, abortSignal, param }) => {\n const resource = await fetch({ abortSignal, param });\n for await (const item of resource) {\n dispatch(items => items ? [...items, item] : [item]);\n }\n },\n debounce,\n }, deps);\n return result;\n}\n","//\n// interval.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { useEffect } from '../effect';\n\n/**\n * A hook that repeatedly calls the provided callback function at the specified interval.\n * \n * @param callback - The function to be executed at each interval.\n * @param ms - The delay in milliseconds between each call to the callback. If not provided, the interval will not be set.\n * @returns void\n * \n * @example\n * useInterval(() => {\n * // Code to run every 1000ms\n * }, 1000);\n */\nexport const useInterval = (\n callback: () => void,\n ms?: number,\n) => useEffect(() => {\n const interval = setInterval(() => {\n callback();\n }, ms);\n return () => clearInterval(interval);\n}, []);\n","//\n// store.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { SetStateAction } from '../../types/common';\nimport { useSyncExternalStore } from '../sync';\n\n/**\n * A class representing a store that holds a value and allows for subscription\n * to changes in that value.\n *\n * @template T - The type of the value stored in the store.\n *\n * @example\n * const store = createStore(0);\n * store.setValue(1);\n * store.subscribe((oldVal, newVal) => {\n * console.log(`Value changed from ${oldVal} to ${newVal}`);\n * });\n */\nclass Store<T> {\n\n #listeners = new Set<(oldVal: T, newVal: T) => void>();\n #value: T;\n\n /** @internal */\n constructor(initialValue: T) {\n this.#value = initialValue;\n }\n\n /**\n * Gets the current value of the store.\n * \n * @returns The current value of the store.\n */\n get value() {\n return this.#value;\n }\n\n /**\n * Sets the value of the store and notifies all subscribers.\n * \n * @param dispatch - The new value or a function that returns the new value.\n */\n setValue(dispatch: SetStateAction<T>) {\n const oldVal = this.#value;\n dispatch = _.isFunction(dispatch) ? dispatch(this.#value) : this.#value;\n this.#listeners.forEach(listener => void listener(oldVal, this.#value));\n }\n\n /**\n * Subscribes to changes in the store's value.\n * \n * @param callback - The function to call when the value changes.\n * @returns A function to unsubscribe from the store.\n */\n subscribe(callback: (oldVal: T, newVal: T) => void) {\n this.#listeners.add(callback);\n return () => { this.#listeners.delete(callback); };\n }\n}\n\n/**\n * Creates a new store with the given initial value.\n * \n * @param initialValue - The initial value to be stored.\n * @returns {Store<T>} A new store instance.\n *\n * @example\n * const counterStore = createStore(0);\n */\nexport const createStore = <T extends unknown = any>(initialValue: T) => new Store(initialValue);\n\n/**\n * A hook to subscribe to a store and select a slice of its state.\n * The component will re-render when the selected state changes.\n * \n * @param store - The store instance to subscribe to.\n * @param selector - A function to select a part of the store's state. Defaults to the entire state.\n * @param equal - A function to compare selected values for equality. Defaults to deep equality.\n * @returns The selected slice of the store's state.\n *\n * @example\n * const count = useStore(counterStore);\n *\n * @example\n * // Using a selector\n * const userName = useStore(userStore, user => user.name);\n */\nexport const useStore = <T extends unknown = any, S = T>(\n store: Store<T>,\n selector: (state: T) => S = v => v as any,\n equal: (value: S, other: S) => boolean = _.isEqual,\n): S => useSyncExternalStore(\n (onStoreChange) => store.subscribe((oldVal, newVal) => {\n if (equal(selector(oldVal), selector(newVal))) onStoreChange();\n }),\n () => selector(store.value)\n);\n","//\n// stack.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\n\n/**\n * Retrieves the stack of parent components from the current hook state.\n *\n * This function accesses the current hook state and extracts the stack of \n * parent components. It throws an error if called outside of a valid render \n * context.\n *\n * @returns An array of parent components from the current hook state.\n * @throws Will throw an error if the function is called outside of a valid render context.\n */\nexport const useStack = () => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useStack must be used within a render function.');\n return _.map(state.stack, x => x._component);\n}\n","//\n// reducer.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that manages state using a reducer pattern.\n * \n * @template T The type of the state.\n * @template A The type of the action object (optional).\n * @param reducer A function that takes the current state and an action, and returns the new state.\n * @param initialState The initial state value or a function that returns the initial state.\n * @returns A tuple containing the current state and a dispatch function to update the state.\n */\nexport function useReducer<T>(\n reducer: (prevState: T) => T,\n initialState: T | (() => T),\n): [T, (dispatch: () => void) => void];\n\nexport function useReducer<T, A = any>(\n reducer: (prevState: T, action: A) => T,\n initialState: T | (() => T),\n): [T, (dispatch: (action: A) => void) => void];\n\nexport function useReducer<T = undefined>(\n reducer: (prevState: T | undefined) => T | undefined\n): [T | undefined, (dispatch: () => void) => void];\n\nexport function useReducer<T = undefined, A = any>(\n reducer: (prevState: T | undefined, action: A) => T | undefined\n): [T | undefined, (dispatch: (action: A) => void) => void];\n\nexport function useReducer(\n reducer: (prevState: any, action?: any) => any,\n initialState?: any,\n) {\n const { value, dispatch } = _useMemo('useReducer', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n dispatch: (action?: any) => {\n state.value = reducer(state.value, action);\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, dispatch];\n}\n","//\n// common.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nexport * from './core/types/common';\nexport * from './core/hooks';\nexport { ComponentNode } from './core/types/component';\nexport { ErrorBoundary } from './core/types/error';\nexport { Fragment } from './core/types/fragment';\nexport { PropsProvider } from './core/types/props';\nexport { _ElementType as ElementType, createElement } from './core/types/runtime';\nexport { mergeRefs } from './core/utils';\n"],"names":["_useMemo","_useEffect","useCallback","createContext","useMemo","_jsx","useContext","useEffect","ErrorContext","useSyncExternalStore","reconciler"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBM,SAAU,MAAM,CAAC,YAAkB,EAAA;AACvC,IAAA,OAAOA,aAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,IAAI,CAAC;AACpE;AAEA;;;;;;;;AAQG;AACU,MAAA,YAAY,GAAG,CAC1B,GAAuB,EACvB,IAAa,EACb,IAAU,KACPC,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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgCgB,SAAA,UAAU,CACxB,OAA8C,EAC9C,YAAkB,EAAA;AAElB,IAAA,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAGV,aAAQ,CAAC,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,KAAI;AAC9D,QAAA,MAAM,KAAK,GAAG;AACZ,YAAA,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,YAAY,EAAE,GAAG,YAAY;AACjE,YAAA,QAAQ,EAAE,CAAC,MAAY,KAAI;gBACzB,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC;gBAC1C,IAAI,EAAE,SAAS,EAAE;aAClB;SACF;AACD,QAAA,OAAO,KAAK;KACb,EAAE,IAAI,CAAC;AACR,IAAA,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC;AAC1B;;ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/core/hooks/ref.ts","../../src/core/hooks/state.ts","../../src/core/hooks/misc/animate.ts","../../src/core/hooks/debounce.ts","../../src/core/hooks/misc/resource/error.tsx","../../src/core/hooks/misc/resource/index.ts","../../src/core/hooks/misc/interval.ts","../../src/core/hooks/misc/store.ts","../../src/core/hooks/stack.ts","../../src/core/hooks/reducer.ts","../../src/common.ts"],"sourcesContent":["//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useEffect, _useMemo } from '../reconciler/hooks';\nimport { Ref, RefObject } from '../types/common';\n\n/**\n * Creates a mutable reference object that persists across function calls.\n * \n * @template T The type of the value stored in the reference.\n * @param initialValue The initial value to store in the reference.\n * @returns An object with a `current` property that holds the value.\n */\nexport function useRef<T>(initialValue: T): RefObject<T>;\nexport function useRef<T = undefined>(): RefObject<T | undefined>;\n\nexport function useRef(initialValue?: any) {\n return _useMemo('useRef', () => ({ current: initialValue }), null);\n}\n\n/**\n * Associates a reference with a value created by an initializer function.\n * \n * @template T The type of the reference.\n * @template R The type of the value created by the initializer function.\n * @param ref A reference object or a callback function to receive the value.\n * @param init A function that initializes and returns the value to associate with the reference.\n * @param deps An optional dependency array. The initializer function is re-executed when the dependencies change.\n */\nexport const useRefHandle = <T, R extends T>(\n ref: Ref<T> | undefined,\n init: () => R,\n deps?: any\n) => _useEffect('useRefHandle', () => {\n try {\n if (ref) {\n const _ref = init();\n if (typeof ref === 'function') ref(_ref);\n else if (typeof ref === 'object') ref.current = _ref;\n }\n return () => void 0;\n } catch (e) {\n console.error(e);\n return () => void 0;\n }\n}, deps);","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\nimport { SetStateAction } from '../types/common';\n\n/**\n * A hook function for managing state within a custom framework or library.\n *\n * @template T - The type of the state value.\n * @param - The initial state value or a function that returns the initial state.\n * @returns - A tuple containing the current state value and a function to update the state.\n *\n * The `useState` function provides a way to manage stateful values. It returns the current state\n * and a setter function that can update the state. The setter function accepts either a new value\n * or a function that receives the current state and returns the updated state.\n *\n * Example:\n * ```typescript\n * const [count, setCount] = useState(0);\n * setCount(5); // Updates the state to 5\n * setCount(prev => prev + 1); // Updates the state to the previous value + 1\n * ```\n */\nexport function useState<T>(initialState: T | (() => T)): [T, (dispatch: SetStateAction<T>) => void];\nexport function useState<T = undefined>(): [T | undefined, (dispatch: SetStateAction<T | undefined>) => void];\n\nexport function useState(initialState?: any) {\n const { value, setValue } = _useMemo('useState', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n setValue: (dispatch: SetStateAction<any>) => {\n state.value = _.isFunction(dispatch) ? dispatch(state.value) : dispatch;\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, setValue];\n}\n","//\n// animate.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { useRef } from '../ref';\nimport { useState } from '../state';\nimport { useCallback } from '../callback';\n\n/**\n * Options for configuring the animation.\n * \n * @property fromValue - The starting value of the animation. Defaults to the current value.\n * @property toValue - The target value of the animation.\n * @property duration - The duration of the animation in milliseconds.\n * @property easing - An optional easing function to control the animation's progress. Defaults to a linear function.\n * @property delay - An optional delay (in milliseconds) before the animation starts. Defaults to `0`.\n * @property onCompleted - An optional callback function invoked when the animation completes or is stopped.\n */\ntype AnimateOptions = {\n fromValue?: number;\n toValue: number;\n duration: number;\n easing?: (value: number) => number;\n delay?: number;\n onCompleted?: (result: {\n value: number;\n finished: boolean;\n }) => void;\n};\n\n/**\n * Options for interpolating a value.\n * \n * @property inputRange - A tuple specifying the input range for interpolation.\n * @property outputRange - A tuple specifying the output range for interpolation.\n */\ntype InterpolateOptions = {\n inputRange: [number, number];\n outputRange: [number, number];\n};\n\n/**\n * Represents an interpolated value and provides a method to further interpolate it.\n * \n * @property value - The interpolated value.\n * @property interpolate - A function to interpolate the current value based on new input and output ranges.\n */\ntype AnimatedInterpolation = {\n value: number;\n interpolate: ({ inputRange, outputRange }: InterpolateOptions) => AnimatedInterpolation;\n};\n\nconst interpolate = (value: number) => ({ inputRange, outputRange }: InterpolateOptions): AnimatedInterpolation => {\n const [inputMin, inputMax] = inputRange;\n const [outputMin, outputMax] = outputRange;\n\n // Safeguard against division by zero\n if (inputMax === inputMin) {\n throw new Error('Input range must have distinct values.');\n }\n\n const t = (value - inputMin) / (inputMax - inputMin);\n const interpolatedValue = outputMin + t * (outputMax - outputMin);\n return {\n value: interpolatedValue,\n interpolate: interpolate(interpolatedValue),\n };\n};\n\n/**\n * A hook to manage animations with support for starting, stopping, and interpolating values.\n * \n * @param initialValue - The initial value of the animation.\n * \n * @returns An object containing:\n * - `value`: The current animated value.\n * - `stop`: A function to stop the animation.\n * - `start`: A function to start the animation with specified options.\n * - `interpolate`: A function to interpolate the current value based on input and output ranges.\n */\nexport const useAnimate = (initialValue: number) => {\n const [value, setValue] = useState(initialValue);\n const ref = useRef<{\n interval: ReturnType<typeof setInterval>;\n callback?: AnimateOptions['onCompleted'];\n }>();\n const _stop = () => {\n const { interval, callback } = ref.current ?? {};\n ref.current = undefined;\n if (interval) clearInterval(interval);\n return callback;\n };\n const stop = useCallback(() => {\n const callback = _stop();\n if (_.isFunction(callback)) callback({ value, finished: false });\n });\n const start = useCallback(({\n fromValue = value,\n toValue,\n duration,\n easing = (x) => x,\n delay = 0,\n onCompleted,\n }: AnimateOptions) => {\n _stop();\n const start = Date.now();\n if (duration > 0) {\n ref.current = {\n interval: setInterval(() => {\n const t = (Date.now() - start) / duration - delay;\n if (t >= 1) {\n clearInterval(ref.current?.interval);\n ref.current = undefined;\n setValue(toValue);\n if (_.isFunction(onCompleted)) onCompleted({ value: toValue, finished: true });\n } else if (t >= 0) {\n setValue((toValue - fromValue) * easing(_.clamp(t, 0, 1)) + fromValue);\n }\n }, 16),\n callback: onCompleted,\n }\n }\n });\n return {\n value,\n stop,\n start,\n interpolate: interpolate(value),\n };\n}","//\n// debounce.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\nconst debounce = <T extends (...args: any) => any>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const { wait, ...options } = settings;\n return _.debounce(callback, wait, {\n ...options,\n leading: 'leading' in options ? !!options.leading : true,\n trailing: 'trailing' in options ? !!options.trailing : true,\n });\n}\n\nconst asyncDebounce = <T extends (...args: any) => PromiseLike<any>>(\n func: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n\n type R = T extends (...args: any) => PromiseLike<infer R> ? R : never;\n let preflight: Promise<R>;\n\n const debounced = debounce(async (\n resolve?: (value: PromiseLike<R>) => void,\n ...args: Parameters<T>\n ) => {\n const result = func(...args as any) as PromiseLike<R>;\n if (_.isFunction(resolve)) resolve(result);\n return result;\n }, settings);\n\n return (...args: Parameters<T>) => {\n if (_.isNil(preflight)) {\n preflight = new Promise<R>(r => debounced(r, ...args));\n return preflight;\n }\n return debounced(undefined, ...args) ?? preflight;\n };\n};\n\n/**\n * A hook that creates a debounced version of a function.\n * The debounced function delays invoking the callback until after\n * the specified wait time has elapsed since the last time it was called.\n * \n * This is useful for optimizing performance in scenarios where frequent\n * function calls (e.g., during user input or window resizing) can be expensive.\n * \n * @template T The type of the callback function.\n * @param callback The function to debounce.\n * @param settings Configuration options for debouncing, including:\n * - `wait` (number): The number of milliseconds to delay.\n * - Other lodash debounce options such as `leading` and `trailing`.\n * @returns A debounced version of the callback function.\n */\nexport const useDebounce = <T extends (...args: any) => any>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const store = _useMemo('useDebounce', () => {\n const store = {\n current: callback,\n stable: debounce(((...args) => store.current(...args)) as T, settings),\n };\n return store;\n }, null);\n store.current = callback;\n return store.stable;\n}\n\n/**\n * A hook that creates a debounced version of an asynchronous function.\n * The debounced function delays invoking the callback until after\n * the specified wait time has elapsed since the last time it was called.\n * \n * This is particularly useful for scenarios where frequent API calls\n * or other asynchronous operations need to be throttled to improve performance.\n * \n * @template T The type of the asynchronous callback function.\n * @param callback The asynchronous function to debounce.\n * @param settings Configuration options for debouncing, including:\n * - `wait` (number): The number of milliseconds to delay.\n * - Other lodash debounce options such as `leading` and `trailing`.\n * @returns A debounced version of the asynchronous callback function.\n */\nexport const useAsyncDebounce = <T extends (...args: any) => PromiseLike<any>>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const store = _useMemo('useAsyncDebounce', () => {\n const store = {\n current: callback,\n stable: asyncDebounce(((...args) => store.current(...args)) as T, settings),\n };\n return store;\n }, null);\n store.current = callback;\n return store.stable;\n}\n","//\n// error.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { ComponentType, PropsWithChildren, SetStateAction } from '../../../types/common';\nimport { createContext } from '../../context';\nimport { useContext } from '../../context';\nimport { useState } from '../../state';\nimport { useMemo } from '../../memo';\n\ntype Errors = {\n token: string;\n error: any;\n refresh: () => Awaitable<void>;\n refreshing: boolean;\n loading: boolean;\n}[];\n\nexport const Context = createContext<{\n errors: Errors;\n setErrors: (values: SetStateAction<Errors>) => void;\n}>({\n errors: [],\n setErrors: () => { },\n});\n\n/**\n * A context provider component for managing asynchronous resource errors.\n * \n * This component provides a shared context for tracking errors encountered during\n * asynchronous operations. It allows child components to access and manage these errors\n * using the `useResourceErrors` hook.\n * \n * ### Usage:\n * Wrap your application or specific parts of it with this component to enable error tracking:\n * \n * ```tsx\n * <ResourceErrors>\n * <YourComponent />\n * </ResourceErrors>\n * ```\n * \n * @param children - The child components that will have access to the error context.\n * \n * @returns A context provider that wraps the provided children.\n */\nexport const ResourceErrors: ComponentType<PropsWithChildren<{}>> = ({\n children\n}) => {\n const [errors, setErrors] = useState<Errors>([]);\n const value = useMemo(() => ({ errors, setErrors }), [errors, setErrors]);\n return (\n <Context value={value}>{children}</Context>\n );\n}\n\n/**\n * A hook to access the list of asynchronous resource errors.\n * \n * This hook allows components to retrieve the current list of errors being tracked\n * in the `ResourceErrors` context. It must be used within a component that is\n * a descendant of the `ResourceErrors` provider.\n * \n * ### Usage:\n * ```tsx\n * const errors = useResourceErrors();\n * \n * errors.forEach(({ token, error, refresh }) => {\n * console.error(`Error [${token}]:`, error);\n * // Optionally call refresh() to retry the operation\n * });\n * ```\n * \n * @returns The list of errors currently being tracked in the context. Each error includes:\n * - `token`: A unique identifier for the error.\n * - `error`: The error object or message.\n * - `refresh`: A function to retry the operation that caused the error.\n */\nexport const useResourceErrors = () => useContext(Context).errors;\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { SetStateAction } from '../../../types/common';\nimport { Config, Fetch, FetchWithIterable } from './types';\nimport { useState } from '../../state';\nimport { useEffect } from '../../effect';\nimport { useContext } from '../../context';\nimport { useCallback } from '../../callback';\nimport { useAsyncDebounce } from '../../debounce';\nimport { Context as ErrorContext } from './error';\nimport { uniqueId } from '../../../../core/utils';\nexport { ResourceErrors, useResourceErrors } from './error';\n\n/**\n * A hook to manage asynchronous resources with support for debouncing, error handling, and state management.\n * \n * @template T - The type of the resource being fetched.\n * @template P - The type of the parameters passed to the fetch function.\n * \n * @param config - The fetch function or a configuration object containing the fetch function and optional debounce settings.\n * @param deps - An optional dependency array to control when the resource is refreshed.\n * \n * @returns An object containing:\n * - `count`: The number of times the resource has been fetched.\n * - `refreshing`: A boolean indicating if the resource is currently being refreshed.\n * - `loading`: A boolean indicating if the resource is currently being loaded.\n * - `resource`: The fetched resource.\n * - `error`: Any error encountered during the fetch.\n * - `cancel`: A function to cancel the current fetch operation.\n * - `refresh`: A function to refresh the resource.\n * - `next`: A function to fetch the next set of data (for paginated resources).\n * - `setResource`: A function to manually update the resource state.\n */\nexport const useResource = <T, P = any>(\n config: Fetch<T, P> | Config<Fetch<T, P>>,\n deps?: any,\n) => {\n\n const fetch = _.isFunction(config) ? config : config.fetch;\n const debounce = _.isFunction(config) ? {} : config.debounce;\n\n const [state, setState] = useState<{\n type?: 'refresh' | 'next';\n count?: number;\n flag?: boolean;\n resource?: T;\n error?: any;\n token?: string;\n abort?: AbortController;\n }>({});\n\n const _dispatch = (\n token: string,\n next: SetStateAction<typeof state>,\n ) => setState(state => state.token === token ? ({\n ...(_.isFunction(next) ? next(state.flag ? state : _.omit(state, 'resource', 'error')) : next),\n count: state.flag ? state.count : (state.count ?? 0) + 1,\n flag: true,\n }) : state);\n\n const _fetch = useAsyncDebounce(async (\n type: 'refresh' | 'next',\n abort: AbortController,\n reset: boolean,\n param?: P,\n prevState?: T,\n ) => {\n\n const token = uniqueId();\n setState(state => ({ ...state, type, token, abort, flag: !reset }));\n\n try {\n\n const resource = await fetch({\n param,\n prevState,\n abortSignal: abort.signal,\n dispatch: (next) => {\n _dispatch(token, state => ({\n ...state,\n resource: _.isFunction(next) ? next(state.resource) : next,\n }));\n },\n });\n\n _dispatch(token, state => ({ resource: resource ?? state.resource }));\n\n } catch (error) {\n\n _dispatch(token, state => ({\n resource: state.resource,\n error,\n }));\n }\n\n }, debounce ?? {});\n\n useEffect(() => {\n const controller = new AbortController();\n void _fetch('refresh', controller, true);\n return () => controller.abort();\n }, deps ?? []);\n\n const _cancelRef = useCallback((reason?: any) => { state.abort?.abort(reason) });\n const _refreshRef = useCallback((param?: P) => _fetch('refresh', new AbortController(), true, param));\n const _nextRef = useCallback((param?: P) => _fetch('next', new AbortController(), false, param, state.resource));\n const _setResRef = useCallback((resource: T | ((prevState?: T) => T)) => setState(state => ({\n ..._.omit(state, 'resource', 'error'),\n resource: _.isFunction(resource) ? resource(state.resource) : resource,\n })));\n\n const { setErrors } = useContext(ErrorContext);\n useEffect(() => {\n const { type, abort, token = uniqueId(), error } = state;\n if (!error) return;\n setErrors(v => [...v, {\n token,\n error,\n refresh: _refreshRef,\n refreshing: !_.isNil(abort) && type === 'refresh',\n loading: !_.isNil(abort),\n }]);\n return () => setErrors(v => _.filter(v, x => x.token !== token));\n }, [state]);\n\n return {\n count: state.count ?? 0,\n refreshing: !_.isNil(state.abort) && state.type === 'refresh',\n loading: !_.isNil(state.abort),\n resource: state.resource,\n error: state.error,\n cancel: _cancelRef,\n refresh: _refreshRef,\n next: _nextRef,\n setResource: _setResRef,\n };\n}\n\n/**\n * A hook to manage asynchronous iterable resources, such as streams or paginated data.\n * \n * @template T - The type of the resource items being fetched.\n * @template P - The type of the parameters passed to the fetch function.\n * \n * @param config - The fetch function or a configuration object containing the fetch function and optional debounce settings.\n * @param deps - An optional dependency array to control when the resource is refreshed.\n * \n * @returns An object containing the same properties as `useResource`, but optimized for iterable resources.\n */\nexport const useIterableResource = <T, P = any>(\n config: FetchWithIterable<T, P> | Config<FetchWithIterable<T, P>>,\n deps?: any,\n) => {\n const fetch = _.isFunction(config) ? config : config.fetch;\n const debounce = _.isFunction(config) ? {} : config.debounce;\n const { next, ...result } = useResource<T[]>({\n fetch: async ({ dispatch, abortSignal, param }) => {\n const resource = await fetch({ abortSignal, param });\n for await (const item of resource) {\n dispatch(items => items ? [...items, item] : [item]);\n }\n },\n debounce,\n }, deps);\n return result;\n}\n","//\n// interval.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { useEffect } from '../effect';\n\n/**\n * A hook that repeatedly calls the provided callback function at the specified interval.\n * \n * @param callback - The function to be executed at each interval.\n * @param ms - The delay in milliseconds between each call to the callback. If not provided, the interval will not be set.\n * @returns void\n * \n * @example\n * useInterval(() => {\n * // Code to run every 1000ms\n * }, 1000);\n */\nexport const useInterval = (\n callback: () => void,\n ms?: number,\n) => useEffect(() => {\n const interval = setInterval(() => {\n callback();\n }, ms);\n return () => clearInterval(interval);\n}, []);\n","//\n// store.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { SetStateAction } from '../../types/common';\nimport { useSyncExternalStore } from '../sync';\n\n/**\n * A class representing a store that holds a value and allows for subscription\n * to changes in that value.\n *\n * @template T - The type of the value stored in the store.\n *\n * @example\n * const store = createStore(0);\n * store.setValue(1);\n * store.subscribe((oldVal, newVal) => {\n * console.log(`Value changed from ${oldVal} to ${newVal}`);\n * });\n */\nclass Store<T> {\n\n #listeners = new Set<(oldVal: T, newVal: T) => void>();\n #value: T;\n\n /** @internal */\n constructor(initialValue: T) {\n this.#value = initialValue;\n }\n\n /**\n * Gets the current value of the store.\n * \n * @returns The current value of the store.\n */\n get value() {\n return this.#value;\n }\n\n /**\n * Sets the value of the store and notifies all subscribers.\n * \n * @param dispatch - The new value or a function that returns the new value.\n */\n setValue(dispatch: SetStateAction<T>) {\n const oldVal = this.#value;\n dispatch = _.isFunction(dispatch) ? dispatch(this.#value) : this.#value;\n this.#listeners.forEach(listener => void listener(oldVal, this.#value));\n }\n\n /**\n * Subscribes to changes in the store's value.\n * \n * @param callback - The function to call when the value changes.\n * @returns A function to unsubscribe from the store.\n */\n subscribe(callback: (oldVal: T, newVal: T) => void) {\n this.#listeners.add(callback);\n return () => { this.#listeners.delete(callback); };\n }\n}\n\n/**\n * Creates a new store with the given initial value.\n * \n * @param initialValue - The initial value to be stored.\n * @returns {Store<T>} A new store instance.\n *\n * @example\n * const counterStore = createStore(0);\n */\nexport const createStore = <T extends unknown = any>(initialValue: T) => new Store(initialValue);\n\n/**\n * A hook to subscribe to a store and select a slice of its state.\n * The component will re-render when the selected state changes.\n * \n * @param store - The store instance to subscribe to.\n * @param selector - A function to select a part of the store's state. Defaults to the entire state.\n * @param equal - A function to compare selected values for equality. Defaults to deep equality.\n * @returns The selected slice of the store's state.\n *\n * @example\n * const count = useStore(counterStore);\n *\n * @example\n * // Using a selector\n * const userName = useStore(userStore, user => user.name);\n */\nexport const useStore = <T extends unknown = any, S = T>(\n store: Store<T>,\n selector: (state: T) => S = v => v as any,\n equal: (value: S, other: S) => boolean = _.isEqual,\n): S => useSyncExternalStore(\n (onStoreChange) => store.subscribe((oldVal, newVal) => {\n if (equal(selector(oldVal), selector(newVal))) onStoreChange();\n }),\n () => selector(store.value)\n);\n","//\n// stack.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\n\n/**\n * Retrieves the stack of parent components from the current hook state.\n *\n * This function accesses the current hook state and extracts the stack of \n * parent components. It throws an error if called outside of a valid render \n * context.\n *\n * @returns An array of parent components from the current hook state.\n * @throws Will throw an error if the function is called outside of a valid render context.\n */\nexport const useStack = () => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useStack must be used within a render function.');\n return _.map(state.stack, x => x._component);\n}\n","//\n// reducer.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that manages state using a reducer pattern.\n * \n * @template T The type of the state.\n * @template A The type of the action object (optional).\n * @param reducer A function that takes the current state and an action, and returns the new state.\n * @param initialState The initial state value or a function that returns the initial state.\n * @returns A tuple containing the current state and a dispatch function to update the state.\n */\nexport function useReducer<T>(\n reducer: (prevState: T) => T,\n initialState: T | (() => T),\n): [T, (dispatch: () => void) => void];\n\nexport function useReducer<T, A = any>(\n reducer: (prevState: T, action: A) => T,\n initialState: T | (() => T),\n): [T, (dispatch: (action: A) => void) => void];\n\nexport function useReducer<T = undefined>(\n reducer: (prevState: T | undefined) => T | undefined\n): [T | undefined, (dispatch: () => void) => void];\n\nexport function useReducer<T = undefined, A = any>(\n reducer: (prevState: T | undefined, action: A) => T | undefined\n): [T | undefined, (dispatch: (action: A) => void) => void];\n\nexport function useReducer(\n reducer: (prevState: any, action?: any) => any,\n initialState?: any,\n) {\n const { value, dispatch } = _useMemo('useReducer', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n dispatch: (action?: any) => {\n state.value = reducer(state.value, action);\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, dispatch];\n}\n","//\n// common.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nexport * from './core/types/common';\nexport * from './core/hooks';\nexport { ComponentNode } from './core/types/component';\nexport { ErrorBoundary } from './core/types/error';\nexport { Fragment } from './core/types/fragment';\nexport { PropsProvider } from './core/types/props';\nexport { _ElementType as ElementType, createElement } from './core/types/runtime';\nexport { mergeRefs } from './core/utils';\n"],"names":["_useMemo","_useEffect","useCallback","createContext","useMemo","_jsx","useContext","state","uniqueId","useEffect","ErrorContext","useSyncExternalStore","reconciler"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBM,SAAU,MAAM,CAAC,YAAkB,EAAA;AACvC,IAAA,OAAOA,aAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,IAAI,CAAC;AACpE;AA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C9C;;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgCgB,SAAA,UAAU,CACxB,OAA8C,EAC9C,YAAkB,EAAA;AAElB,IAAA,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAGP,aAAQ,CAAC,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,KAAI;AAC9D,QAAA,MAAM,KAAK,GAAG;AACZ,YAAA,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,YAAY,EAAE,GAAG,YAAY;AACjE,YAAA,QAAQ,EAAE,CAAC,MAAY,KAAI;gBACzB,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC;gBAC1C,IAAI,EAAE,SAAS,EAAE;aAClB;SACF;AACD,QAAA,OAAO,KAAK;KACb,EAAE,IAAI,CAAC;AACR,IAAA,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC;AAC1B;;ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import _ from 'lodash';
2
- import { _ as _useEffect, a as _useMemo, u as useCallback, b as useMemo, c as useEffect, d as useSyncExternalStore } from './internals/sync-B9zfuWYQ.mjs';
3
- import { c as createContext, u as useContext, r as reconciler, E as ErrorBoundary, P as PropsProvider, m as mergeRefs } from './internals/utils-BJL3yvTI.mjs';
2
+ import { _ as _useEffect, a as _useMemo, u as useCallback, b as useMemo, c as useEffect, d as useSyncExternalStore } from './internals/sync-BM8lmLVc.mjs';
3
+ import { c as createContext, u as useContext, a as uniqueId, r as reconciler, E as ErrorBoundary, P as PropsProvider, m as mergeRefs } from './internals/state-BRZQ4OPf.mjs';
4
4
  import { jsx, Fragment } from './jsx-runtime.mjs';
5
5
  import { C as ComponentNode } from './internals/component-tyF62qKh.mjs';
6
6
  import { c as createElement } from './internals/runtime-BN27rc51.mjs';
@@ -399,7 +399,7 @@ const useResource = (config, deps) => {
399
399
  flag: true,
400
400
  }) : state);
401
401
  const _fetch = useAsyncDebounce(async (type, abort, reset, param, prevState) => {
402
- const token = _.uniqueId();
402
+ const token = uniqueId();
403
403
  setState(state => ({ ...state, type, token, abort, flag: !reset }));
404
404
  try {
405
405
  const resource = await fetch({
@@ -436,7 +436,7 @@ const useResource = (config, deps) => {
436
436
  })));
437
437
  const { setErrors } = useContext(Context);
438
438
  useEffect(() => {
439
- const { type, abort, token = _.uniqueId(), error } = state;
439
+ const { type, abort, token = uniqueId(), error } = state;
440
440
  if (!error)
441
441
  return;
442
442
  setErrors(v => [...v, {