frosty 0.0.58 → 0.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -0
- package/dist/index.d.ts +36 -18
- package/dist/index.js +90 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +90 -23
- package/dist/index.mjs.map +1 -1
- package/dist/web.d.ts +4 -2
- package/dist/web.js +123 -117
- package/dist/web.js.map +1 -1
- package/dist/web.mjs +124 -118
- package/dist/web.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Frosty
|
|
2
|
+
|
|
3
|
+
A fast, flexible, and modern JSX-based UI library.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- ⚡ Fast rendering and reconciliation
|
|
8
|
+
- 🧩 Flexible component model
|
|
9
|
+
- 🎨 Built-in style and CSS support
|
|
10
|
+
- 🪝 Modern hooks API (React-like)
|
|
11
|
+
- 🌐 SSR-ready (Server-side rendering)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
Install Frosty using npm:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm install frosty
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
Here's a simple example to get you started:
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { useState } from 'frosty';
|
|
27
|
+
|
|
28
|
+
function App() {
|
|
29
|
+
const [count, setCount] = useState(0);
|
|
30
|
+
return (
|
|
31
|
+
<div>
|
|
32
|
+
<span>Hello, Frosty!</span>
|
|
33
|
+
<button onClick={() => setCount(count + 1)}>Count: {count}</button>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
See the [API documentation](./docs) for more details and advanced usage.
|
|
40
|
+
|
|
41
|
+
## TypeScript Setup
|
|
42
|
+
|
|
43
|
+
To enable JSX support with Frosty in TypeScript, update your `tsconfig.json`:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"compilerOptions": {
|
|
48
|
+
"jsx": "react-jsx",
|
|
49
|
+
"jsxImportSource": "frosty"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
This configures TypeScript to use Frosty's JSX runtime.
|
|
55
|
+
|
|
56
|
+
## Babel Setup
|
|
57
|
+
|
|
58
|
+
To use Frosty with Babel, add the following to your Babel config:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"presets": [
|
|
63
|
+
[
|
|
64
|
+
"@babel/preset-react",
|
|
65
|
+
{
|
|
66
|
+
"runtime": "automatic",
|
|
67
|
+
"importSource": "frosty"
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Contributing
|
|
75
|
+
|
|
76
|
+
We welcome contributions! Please open issues or submit pull requests.
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
MIT © O2ter Limited
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as SetStateAction, C as ComponentType, P as PropsWithChildren, E as ElementNode, R as RefObject, a as Ref, b as ComponentNode, _ as _ElementType, N as NativeElementType, c as PropsType } from './internals/common-CfPzr225.js';
|
|
2
2
|
export { h as CSSProperties, e as ClassName, j as ComponentProps, k as ComponentPropsWithoutRef, m as ComponentRef, g as ExtendedCSSProperties, i as RefAttribute, l as RefCallback, f as StyleProp, d as createElement } from './internals/common-CfPzr225.js';
|
|
3
3
|
import _ from 'lodash';
|
|
4
4
|
import { Awaitable } from '@o2ter/utils-js';
|
|
@@ -83,7 +83,7 @@ type Fetch<T, P> = (x: {
|
|
|
83
83
|
abortSignal: AbortSignal;
|
|
84
84
|
param?: P;
|
|
85
85
|
prevState?: T;
|
|
86
|
-
dispatch: (value: T
|
|
86
|
+
dispatch: (value: SetStateAction<T, T | undefined>) => void;
|
|
87
87
|
}) => PromiseLike<void | T>;
|
|
88
88
|
/**
|
|
89
89
|
* Represents a function to fetch asynchronous iterable resources, such as streams or paginated data.
|
|
@@ -303,25 +303,33 @@ declare const useStore: <T extends unknown = any, S = T>(store: Store<T>, select
|
|
|
303
303
|
/**
|
|
304
304
|
* Eagerly resolves a promise returned by the factory function and caches its result or error.
|
|
305
305
|
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
* - The renderer will wait for the promise to settle within a single render cycle,
|
|
310
|
-
* ensuring that the result or error is available before the next render.
|
|
306
|
+
* This hook ensures the promise settles before rendering completes. If the promise is still pending,
|
|
307
|
+
* it returns `undefined` and schedules an immediate rerender of the current component. Once resolved, it returns the value.
|
|
308
|
+
* If rejected, it throws the error.
|
|
311
309
|
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
310
|
+
* #### Usage
|
|
311
|
+
* ```typescript
|
|
312
|
+
* const data = useAsyncEager(() => fetchData(id), [id]);
|
|
313
|
+
* ```
|
|
314
|
+
*
|
|
315
|
+
* #### Parameters
|
|
316
|
+
* - `factory`: `() => PromiseLike<T>`
|
|
317
|
+
* A function that returns a promise to resolve.
|
|
318
|
+
* - `deps` (optional): `any`
|
|
319
|
+
* Dependency array for memoization. The promise is recreated when dependencies change.
|
|
320
|
+
*
|
|
321
|
+
* #### Returns
|
|
322
|
+
* - `T | undefined`
|
|
323
|
+
* The resolved value, once available. Returns `undefined` while the promise is pending.
|
|
324
|
+
* - Throws the rejection error if the promise fails.
|
|
325
|
+
*
|
|
326
|
+
* #### Throws
|
|
327
|
+
* - Error if used outside a render function.
|
|
328
|
+
* - The rejection error if the promise fails.
|
|
316
329
|
*
|
|
317
330
|
* @template T Type of the resolved value.
|
|
318
|
-
* @param factory Function returning a Promise-like object to resolve.
|
|
319
|
-
* @param deps Optional dependencies array for memoization. The promise is recreated if dependencies change.
|
|
320
|
-
* @returns The resolved value of the promise, or throws the error if rejected.
|
|
321
|
-
* Returns `undefined` while the promise is pending.
|
|
322
|
-
* @throws Error if used outside a render function, or if the promise rejects.
|
|
323
331
|
*/
|
|
324
|
-
declare const useAsyncEager: <T>(factory: () => PromiseLike<T>, deps?: any) =>
|
|
332
|
+
declare const useAsyncEager: <T>(factory: () => PromiseLike<T>, deps?: any) => T | undefined;
|
|
325
333
|
|
|
326
334
|
/**
|
|
327
335
|
* A hook that creates a debounced version of a function.
|
|
@@ -554,6 +562,16 @@ declare function useReducer<T = undefined, A = any>(reducer: (prevState: T | und
|
|
|
554
562
|
*/
|
|
555
563
|
declare const useSyncExternalStore: <Snapshot>(subscribe: (onStoreChange: () => void, signal: AbortSignal) => Awaitable<void | (() => Awaitable<void>)>, getSnapshot: () => Snapshot, getServerSnapshot?: () => Snapshot) => Snapshot;
|
|
556
564
|
|
|
565
|
+
/**
|
|
566
|
+
* Returns a persistent storage Map associated with the current renderer instance.
|
|
567
|
+
* This hook allows components to store and retrieve values that persist across renders,
|
|
568
|
+
* scoped to the renderer. Must be called within a render function.
|
|
569
|
+
*
|
|
570
|
+
* @throws Error if called outside of a render function.
|
|
571
|
+
* @returns {Map<any, any>} The storage map for the current renderer.
|
|
572
|
+
*/
|
|
573
|
+
declare const useRendererStorage: () => Map<any, any>;
|
|
574
|
+
|
|
557
575
|
type ErrorBoundaryProps = PropsWithChildren<{
|
|
558
576
|
silent?: boolean;
|
|
559
577
|
onError?: (error: any, component: ComponentNode, stack: ComponentNode[]) => void;
|
|
@@ -568,5 +586,5 @@ type PropsProviderProps = PropsWithChildren<{
|
|
|
568
586
|
}>;
|
|
569
587
|
declare const PropsProvider: ComponentType<PropsProviderProps>;
|
|
570
588
|
|
|
571
|
-
export { ComponentNode, ComponentType, type Context, type ContextType, ElementNode, _ElementType as ElementType, ErrorBoundary, PropsProvider, PropsWithChildren, Ref, RefObject, ResourceErrors, SetStateAction, createContext, createStore, useAnimate, useAsyncDebounce, useAsyncEager, useCallback, useContext, useDebounce, useEffect, useInterval, useIterableResource, useMemo, useReducer, useRef, useRefHandle, useResource, useResourceErrors, useStack, useState, useStore, useSyncExternalStore };
|
|
589
|
+
export { ComponentNode, ComponentType, type Context, type ContextType, ElementNode, _ElementType as ElementType, ErrorBoundary, PropsProvider, PropsWithChildren, Ref, RefObject, ResourceErrors, SetStateAction, createContext, createStore, useAnimate, useAsyncDebounce, useAsyncEager, useCallback, useContext, useDebounce, useEffect, useInterval, useIterableResource, useMemo, useReducer, useRef, useRefHandle, useRendererStorage, useResource, useResourceErrors, useStack, useState, useStore, useSyncExternalStore };
|
|
572
590
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var _ = require('lodash');
|
|
4
4
|
var sync = require('./internals/sync-HGSokpPA.js');
|
|
5
|
-
var state = require('./internals/state-N94hLsqm.js');
|
|
6
5
|
var jsxRuntime = require('./jsx-runtime.js');
|
|
6
|
+
var state = require('./internals/state-N94hLsqm.js');
|
|
7
7
|
var component = require('./internals/component-BiP3XIPe.js');
|
|
8
8
|
var runtime = require('./internals/runtime-DCKT7fd6.js');
|
|
9
9
|
require('myers.js');
|
|
@@ -298,10 +298,52 @@ const useAsyncDebounce = (callback, settings) => {
|
|
|
298
298
|
return store.stable;
|
|
299
299
|
};
|
|
300
300
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
301
|
+
//
|
|
302
|
+
// rendererStorage.ts
|
|
303
|
+
//
|
|
304
|
+
// The MIT License
|
|
305
|
+
// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
|
|
306
|
+
//
|
|
307
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
308
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
309
|
+
// in the Software without restriction, including without limitation the rights
|
|
310
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
311
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
312
|
+
// furnished to do so, subject to the following conditions:
|
|
313
|
+
//
|
|
314
|
+
// The above copyright notice and this permission notice shall be included in
|
|
315
|
+
// all copies or substantial portions of the Software.
|
|
316
|
+
//
|
|
317
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
318
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
319
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
320
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
321
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
322
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
323
|
+
// THE SOFTWARE.
|
|
324
|
+
//
|
|
325
|
+
const storage = new WeakMap();
|
|
326
|
+
/**
|
|
327
|
+
* Returns a persistent storage Map associated with the current renderer instance.
|
|
328
|
+
* This hook allows components to store and retrieve values that persist across renders,
|
|
329
|
+
* scoped to the renderer. Must be called within a render function.
|
|
330
|
+
*
|
|
331
|
+
* @throws Error if called outside of a render function.
|
|
332
|
+
* @returns {Map<any, any>} The storage map for the current renderer.
|
|
333
|
+
*/
|
|
334
|
+
const useRendererStorage = () => {
|
|
335
|
+
const state$1 = state.reconciler.currentHookState;
|
|
336
|
+
if (!state$1)
|
|
337
|
+
throw Error('useRendererStorage must be used within a render function.');
|
|
338
|
+
const found = storage.get(state$1.renderer);
|
|
339
|
+
const store = found ?? new Map();
|
|
340
|
+
if (!found)
|
|
341
|
+
storage.set(state$1.renderer, store);
|
|
342
|
+
return store;
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
const defaultStorageKey = Symbol();
|
|
346
|
+
const Context = state.createContext();
|
|
305
347
|
/**
|
|
306
348
|
* A context provider component for managing asynchronous resource errors.
|
|
307
349
|
*
|
|
@@ -327,6 +369,23 @@ const ResourceErrors = ({ children }) => {
|
|
|
327
369
|
const value = sync.useMemo(() => ({ errors, setErrors }), [errors, setErrors]);
|
|
328
370
|
return (jsxRuntime.jsx(Context, { value: value, children: children }));
|
|
329
371
|
};
|
|
372
|
+
const useErrorContext = () => {
|
|
373
|
+
const value = state.useContext(Context);
|
|
374
|
+
if (value)
|
|
375
|
+
return value;
|
|
376
|
+
const storage = useRendererStorage();
|
|
377
|
+
const found = storage.get(defaultStorageKey);
|
|
378
|
+
if (found)
|
|
379
|
+
return found;
|
|
380
|
+
const store = {
|
|
381
|
+
errors: [],
|
|
382
|
+
setErrors: (values) => {
|
|
383
|
+
store.errors = _.isFunction(values) ? values(store.errors) : values;
|
|
384
|
+
},
|
|
385
|
+
};
|
|
386
|
+
storage.set(defaultStorageKey, store);
|
|
387
|
+
return store;
|
|
388
|
+
};
|
|
330
389
|
/**
|
|
331
390
|
* A hook to access the list of asynchronous resource errors.
|
|
332
391
|
*
|
|
@@ -349,7 +408,7 @@ const ResourceErrors = ({ children }) => {
|
|
|
349
408
|
* - `error`: The error object or message.
|
|
350
409
|
* - `refresh`: A function to retry the operation that caused the error.
|
|
351
410
|
*/
|
|
352
|
-
const useResourceErrors = () =>
|
|
411
|
+
const useResourceErrors = () => useErrorContext().errors;
|
|
353
412
|
|
|
354
413
|
//
|
|
355
414
|
// index.ts
|
|
@@ -440,7 +499,7 @@ const useResource = (config, deps) => {
|
|
|
440
499
|
..._.omit(state, 'resource', 'error'),
|
|
441
500
|
resource: _.isFunction(resource) ? resource(state.resource) : resource,
|
|
442
501
|
})));
|
|
443
|
-
const { setErrors } =
|
|
502
|
+
const { setErrors } = useErrorContext();
|
|
444
503
|
sync.useEffect(() => {
|
|
445
504
|
const { type, abort, token = state.uniqueId(), error } = state$1;
|
|
446
505
|
if (!error)
|
|
@@ -667,23 +726,31 @@ const resolved = new WeakMap();
|
|
|
667
726
|
/**
|
|
668
727
|
* Eagerly resolves a promise returned by the factory function and caches its result or error.
|
|
669
728
|
*
|
|
670
|
-
*
|
|
671
|
-
*
|
|
672
|
-
*
|
|
673
|
-
*
|
|
674
|
-
*
|
|
729
|
+
* This hook ensures the promise settles before rendering completes. If the promise is still pending,
|
|
730
|
+
* it returns `undefined` and schedules an immediate rerender of the current component. Once resolved, it returns the value.
|
|
731
|
+
* If rejected, it throws the error.
|
|
732
|
+
*
|
|
733
|
+
* #### Usage
|
|
734
|
+
* ```typescript
|
|
735
|
+
* const data = useAsyncEager(() => fetchData(id), [id]);
|
|
736
|
+
* ```
|
|
737
|
+
*
|
|
738
|
+
* #### Parameters
|
|
739
|
+
* - `factory`: `() => PromiseLike<T>`
|
|
740
|
+
* A function that returns a promise to resolve.
|
|
741
|
+
* - `deps` (optional): `any`
|
|
742
|
+
* Dependency array for memoization. The promise is recreated when dependencies change.
|
|
743
|
+
*
|
|
744
|
+
* #### Returns
|
|
745
|
+
* - `T | undefined`
|
|
746
|
+
* The resolved value, once available. Returns `undefined` while the promise is pending.
|
|
747
|
+
* - Throws the rejection error if the promise fails.
|
|
675
748
|
*
|
|
676
|
-
*
|
|
677
|
-
* -
|
|
678
|
-
* - The
|
|
679
|
-
* - The result or error is cached for the lifetime of the promise instance.
|
|
749
|
+
* #### Throws
|
|
750
|
+
* - Error if used outside a render function.
|
|
751
|
+
* - The rejection error if the promise fails.
|
|
680
752
|
*
|
|
681
753
|
* @template T Type of the resolved value.
|
|
682
|
-
* @param factory Function returning a Promise-like object to resolve.
|
|
683
|
-
* @param deps Optional dependencies array for memoization. The promise is recreated if dependencies change.
|
|
684
|
-
* @returns The resolved value of the promise, or throws the error if rejected.
|
|
685
|
-
* Returns `undefined` while the promise is pending.
|
|
686
|
-
* @throws Error if used outside a render function, or if the promise rejects.
|
|
687
754
|
*/
|
|
688
755
|
const useAsyncEager = (factory, deps) => {
|
|
689
756
|
const state$1 = state.reconciler.currentHookState;
|
|
@@ -790,12 +857,12 @@ exports.useCallback = sync.useCallback;
|
|
|
790
857
|
exports.useEffect = sync.useEffect;
|
|
791
858
|
exports.useMemo = sync.useMemo;
|
|
792
859
|
exports.useSyncExternalStore = sync.useSyncExternalStore;
|
|
860
|
+
exports.Fragment = jsxRuntime.Fragment;
|
|
793
861
|
exports.ErrorBoundary = state.ErrorBoundary;
|
|
794
862
|
exports.PropsProvider = state.PropsProvider;
|
|
795
863
|
exports.createContext = state.createContext;
|
|
796
864
|
exports.mergeRefs = state.mergeRefs;
|
|
797
865
|
exports.useContext = state.useContext;
|
|
798
|
-
exports.Fragment = jsxRuntime.Fragment;
|
|
799
866
|
exports.ComponentNode = component.ComponentNode;
|
|
800
867
|
exports.createElement = runtime.createElement;
|
|
801
868
|
exports.ResourceErrors = ResourceErrors;
|
|
@@ -809,6 +876,7 @@ exports.useIterableResource = useIterableResource;
|
|
|
809
876
|
exports.useReducer = useReducer;
|
|
810
877
|
exports.useRef = useRef;
|
|
811
878
|
exports.useRefHandle = useRefHandle;
|
|
879
|
+
exports.useRendererStorage = useRendererStorage;
|
|
812
880
|
exports.useResource = useResource;
|
|
813
881
|
exports.useResourceErrors = useResourceErrors;
|
|
814
882
|
exports.useStack = useStack;
|
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/asyncEager.ts","../../src/core/hooks/stack.ts","../../src/core/hooks/reducer.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 function (\n this: any,\n resolve?: (value: PromiseLike<R>) => void,\n ...args: Parameters<T>\n ) {\n const result = func.call(this, ...args as any) as PromiseLike<R>;\n if (_.isFunction(resolve)) resolve(result);\n return result;\n }, settings);\n\n return function (this: any, ...args: Parameters<T>) {\n if (_.isNil(preflight)) {\n preflight = new Promise<R>(r => debounced.call(this, r, ...args));\n return preflight;\n }\n return debounced.call(this, 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((function (this: any, ...args) {\n return store.current.call(this, ...args);\n }) 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((function (this: any, ...args) {\n return store.current.call(this, ...args);\n }) 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 this.#value = _.isFunction(dispatch) ? dispatch(this.#value) : dispatch;\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// asyncEager.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';\nimport { _useMemo } from '../reconciler/hooks';\n\nconst resolved = new WeakMap<PromiseLike<any>, { result?: any; error?: any; }>();\n\n/**\n * Eagerly resolves a promise returned by the factory function and caches its result or error.\n *\n * - If the promise resolves, returns the resolved value.\n * - If the promise rejects, throws the error.\n * - If the promise is still pending, schedules its resolution and returns `undefined`.\n * - The renderer will wait for the promise to settle within a single render cycle,\n * ensuring that the result or error is available before the next render.\n *\n * **Usage Notes:**\n * - Must be called inside a render function (e.g., within a component).\n * - The promise is memoized based on the provided dependencies.\n * - The result or error is cached for the lifetime of the promise instance.\n *\n * @template T Type of the resolved value.\n * @param factory Function returning a Promise-like object to resolve.\n * @param deps Optional dependencies array for memoization. The promise is recreated if dependencies change.\n * @returns The resolved value of the promise, or throws the error if rejected.\n * Returns `undefined` while the promise is pending.\n * @throws Error if used outside a render function, or if the promise rejects.\n */\nexport const useAsyncEager = <T>(\n factory: () => PromiseLike<T>,\n deps?: any,\n) => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useAsyncEager must be used within a render function.');\n const promise = _useMemo('useAsyncEager', () => factory(), deps);\n if (resolved.has(promise)) {\n const { result, error } = resolved.get(promise) ?? {};\n if (error) throw error;\n return result;\n }\n state.tasks.push((async () => {\n try {\n const result = await promise;\n resolved.set(promise, { result });\n } catch (error) {\n resolved.set(promise, { error });\n }\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"],"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;AAEA;;;;;;;;AAQG;AACU,MAAA,YAAY,GAAG,CAC1B,GAAuB,EACvB,IAAa,EACb,IAAU,KACPC,eAAU,CAAC,cAAc,EAAE,MAAK;AACnC,IAAA,IAAI;QACF,IAAI,GAAG,EAAE;AACP,YAAA,MAAM,IAAI,GAAG,IAAI,EAAE;YACnB,IAAI,OAAO,GAAG,KAAK,UAAU;gBAAE,GAAG,CAAC,IAAI,CAAC;iBACnC,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,gBAAA,GAAG,CAAC,OAAO,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,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
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/rendererStorage.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/asyncEager.ts","../../src/core/hooks/stack.ts","../../src/core/hooks/reducer.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 function (\n this: any,\n resolve?: (value: PromiseLike<R>) => void,\n ...args: Parameters<T>\n ) {\n const result = func.call(this, ...args as any) as PromiseLike<R>;\n if (_.isFunction(resolve)) resolve(result);\n return result;\n }, settings);\n\n return function (this: any, ...args: Parameters<T>) {\n if (_.isNil(preflight)) {\n preflight = new Promise<R>(r => debounced.call(this, r, ...args));\n return preflight;\n }\n return debounced.call(this, 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((function (this: any, ...args) {\n return store.current.call(this, ...args);\n }) 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((function (this: any, ...args) {\n return store.current.call(this, ...args);\n }) as T, settings),\n };\n return store;\n }, null);\n store.current = callback;\n return store.stable;\n}\n","//\n// rendererStorage.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\nconst storage = new WeakMap<any, Map<any, any>>();\n\n/**\n * Returns a persistent storage Map associated with the current renderer instance.\n * This hook allows components to store and retrieve values that persist across renders,\n * scoped to the renderer. Must be called within a render function.\n *\n * @throws Error if called outside of a render function.\n * @returns {Map<any, any>} The storage map for the current renderer.\n */\nexport const useRendererStorage = () => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useRendererStorage must be used within a render function.');\n const found = storage.get(state.renderer);\n const store = found ?? new Map<any, any>();\n if (!found) storage.set(state.renderer, store);\n return store;\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';\nimport { useRendererStorage } from '../../rendererStorage';\n\ntype Errors = {\n token: string;\n error: any;\n refresh: () => Awaitable<void>;\n refreshing: boolean;\n loading: boolean;\n}[];\n\ntype ContextValue = {\n errors: Errors;\n setErrors: (values: SetStateAction<Errors>) => void;\n};\n\nconst defaultStorageKey = Symbol();\nconst Context = createContext<ContextValue>();\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\nexport const useErrorContext = () => {\n const value = useContext(Context);\n if (value) return value;\n const storage = useRendererStorage();\n const found = storage.get(defaultStorageKey);\n if (found) return found as ContextValue;\n const store: ContextValue = {\n errors: [],\n setErrors: (values: SetStateAction<Errors>) => {\n store.errors = _.isFunction(values) ? values(store.errors) : values;\n },\n };\n storage.set(defaultStorageKey, store);\n return store;\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 = () => useErrorContext().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 { useCallback } from '../../callback';\nimport { useAsyncDebounce } from '../../debounce';\nimport { useErrorContext } 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 } = useErrorContext();\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 this.#value = _.isFunction(dispatch) ? dispatch(this.#value) : dispatch;\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// asyncEager.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';\nimport { _useMemo } from '../reconciler/hooks';\n\nconst resolved = new WeakMap<PromiseLike<any>, { result?: any; error?: any; }>();\n\n/**\n * Eagerly resolves a promise returned by the factory function and caches its result or error.\n *\n * This hook ensures the promise settles before rendering completes. If the promise is still pending,\n * it returns `undefined` and schedules an immediate rerender of the current component. Once resolved, it returns the value.\n * If rejected, it throws the error.\n *\n * #### Usage\n * ```typescript\n * const data = useAsyncEager(() => fetchData(id), [id]);\n * ```\n *\n * #### Parameters\n * - `factory`: `() => PromiseLike<T>` \n * A function that returns a promise to resolve.\n * - `deps` (optional): `any` \n * Dependency array for memoization. The promise is recreated when dependencies change.\n *\n * #### Returns\n * - `T | undefined` \n * The resolved value, once available. Returns `undefined` while the promise is pending.\n * - Throws the rejection error if the promise fails.\n *\n * #### Throws\n * - Error if used outside a render function.\n * - The rejection error if the promise fails.\n *\n * @template T Type of the resolved value.\n */\nexport const useAsyncEager = <T>(\n factory: () => PromiseLike<T>,\n deps?: any,\n): T | undefined => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useAsyncEager must be used within a render function.');\n const promise = _useMemo('useAsyncEager', () => factory(), deps);\n if (resolved.has(promise)) {\n const { result, error } = resolved.get(promise) ?? {};\n if (error) throw error;\n return result;\n }\n state.tasks.push((async () => {\n try {\n const result = await promise;\n resolved.set(promise, { result });\n } catch (error) {\n resolved.set(promise, { error });\n }\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"],"names":["_useMemo","_useEffect","useCallback","state","reconciler","createContext","useMemo","_jsx","useContext","uniqueId","useEffect","useSyncExternalStore"],"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,eAAU,CAAC,cAAc,EAAE,MAAK;AACnC,IAAA,IAAI;QACF,IAAI,GAAG,EAAE;AACP,YAAA,MAAM,IAAI,GAAG,IAAI,EAAE;YACnB,IAAI,OAAO,GAAG,KAAK,UAAU;gBAAE,GAAG,CAAC,IAAI,CAAC;iBACnC,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,gBAAA,GAAG,CAAC,OAAO,GAAG,IAAI;;AAEtD,QAAA,OAAO,MAAM,KAAK,CAAC;;IACnB,OAAO,CAAC,EAAE;AACV,QAAA,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AAChB,QAAA,OAAO,MAAM,MAAM;;AAEvB,CAAC,EAAE,IAAI;;ACpEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA2BM,SAAU,QAAQ,CAAC,YAAkB,EAAA;AACzC,IAAA,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAGD,aAAQ,CAAC,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,KA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